Dealing with SSL
The package manager Homebrew is a phenomenal tool which has made working on a Mac even easier and more productive. It’s a great way to keep tools and packages updated, is easy to manage, and my time spent fixing dependency issues and similar problems has been greatly reduced ever since I started using it a couple of years ago. However, as Homebrew doesn’t delete old versions of installed formulae, over time the ‘Cellar’ become filled with old/unused files and directories and it was time for a clearout. As with most things involving Homebrew, this was very straightforward and relatively painless:
$ brew cleanup
A number of old formula versions were taking up a surprising amount of sapce, visible during the cleanup process, ranging from 22 versions of Node.js each taking ~35-40MB, and 11 versions of MySQL, each between 315-445MB. In total I managed to clear 21.9 GB of disk space, which was very welcome indeed! If I need older versions, I can reinstall and
brew switch to them as needed.
A dry-run of the cleanup, where nothing is deleted but the items to be deleted are listed can be done by using the -n switch:
$ brew cleanup -n
Fixing virtualenv problems post-cleanup
One adverse thing from this cleanup was that my virtualenvironments for Python projects now seem to be all broken. This is due to the original symlinks made when the virtualenv was created were links to the Python installed by Homebrew and in use at the time of creation. When
brew cleanup is run, Homebrew deletes old versions of Python, and those symlinks then point to paths that don’t exist. The fix to this is relatively simple though, recreating the symlinks in the virtualenv. For example, in a virtualenv called ‘foo-env’, this would be:
# Delete old symlinks for virtualenv foo-env find ~/.virtualenvs/foo-env/ -type l -delete # Create new symlinks for virtualenv foo-env virtualenv ~/.virtualenvs/foo-env
gfind can be used to fix only those links that are broken:
gfind ~/.virtualenvs/my-virtual-env/ -type l -xtype l -delete
The fix to this problem was found in this Stackoverflow post.