Updating Dev Environment After A Long Break

A while back I created a few apps that have been pleasantly working away for a few years now. Every once in a while I updated the dependencies to keep things up to date, but when major versions were released that would require a lot of refactoring, I pretty much just let them sit at the old versions…they’re still working after all! Well now I want to make some updates and changes to the apps and am finding that I have to get them completely up to date in order to do so. Oh no, here we go…

The Long And Winding Road

Updating MongoDB

First up is updating my local installation of MongoDB 😱 I’m running version 3 while the latest is v6, and the major dependency mongoose won’t run anymore. Aaaaaaaaages ago I installed MongoDB manually by downloading the binaries. I remember it being an absolute mission, and a miracle that I’d gotten it to work. To update in the same way, their website said that you’d have to upgrade progressively through each version (4 then 5 then 6) to get it working properly. By comparison, now you can install it pretty simply using homebrew which sounds a LOT easier. So I guess I’ll try that? Following the MongoDB installation guide, v6 should still be compatible with my (old) OS, so Homebrew it is.

First Stop, Python

Unfortunately though, part-way through this process Python did not install correctly. I got the following error:

Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir - /usr/local/Frameworks
Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

This is a known issue going back ages; I had to manually create the Frameworks/ directory within local:

sudo mkdir Frameworks

Then change the ownership to make it match the other Homebrew directories:

sudo chown -R username:admin Frameworks/

This resulted in the folder being created, but without the right permissions:

...
drwxrwxr-x 4 username admin 128B Aug 14 2019 Caskroom
drwxrwxr-x 54 username admin 1.7K Jul 22 23:28 Cellar
drwxr-xr-x 2 username admin 64B Jul 23 09:59 Frameworks
drwxrwxr-x 21 username admin 672B Jul 22 21:47 Homebrew
...

So I updated the permissions as well:

sudo chmod -R g=rwx Frameworks/

Now I should be able to complete the Python installation:

brew link python

…And done!

Well, not quite. Python was fully installed and linked, but the next problem was installing Node 16.x.

(Re-) Installing Node

MongoDB also required Node 16 as a dependency, and because I’m using Homebrew it doesn’t see that Node is already installed (I use nvm).

But Homebrew couldn’t install node…apparently I need to install the Gnu compiler since my command lines tools are out of date:

brew install gcc

two hours later

I wish I was kidding!

==> Installing gcc
==> ../configure --prefix=/usr/local/opt/gcc --libdir=/usr/local/opt/gcc/lib/gcc/11 --disable-nls --enable-checking=release --wit
==> make
==> make install-strip DESTDIR=/private/tmp/gcc-20220723-76523-2srzew/gcc-11.3.0/build/../instdir
🍺 /usr/local/Cellar/gcc/11.3.0_2: 2,150 files, 326.9MB, built in 108 minutes 8 seconds

108 MINUTES!!

I also ran into an error while running brew cleanup because I had uninstalled Docker a while back to free up hard drive space. Thanks to this Flavio Copes article for helping solve it.

Error: Permission denied @ apply2files - /usr/local/lib/docker/cli-plugins
e$ mkdir -p /Applications/Docker.app/Contents/Resources/cli-plugins
$ brew cleanup
Pruned 2 symbolic links and 4 directories from /usr/local
$

Road Block

After all that, even with an updated gcc, Homebrew still couldn’t install Node because the command line tools remain out of date. The command line tools can’t be updated because I don’t have enough space on my hard drive to download the installation package. And Homebrew can’t install MongoDB without Node.

So, no MongoDB update!

Also, I kept getting a bunch of red warnings that the installations may not work anyway, because Homebrew and Apple no longer support MacOS 10.14. But I can’t update to a newer OS without breaking the 32-bit programs on my computer or losing Apple’s now-retired dashboard, which I still actually use!

TL;DR

I need a new computer to update my old code 🤣 😭 🙈