Upgrading your development machine to Sierra on macOS

A shiney new operating system? Let’s install it! Hold up. If you’re working on a development machine which you rely on to do work with, think about the dependencies that might break. Luckily, I’ve already done the hard work for you and figured out all the things you need to do for your development machine to be in good working order. There’s just a few things to do once you’ve upgraded.

Homebrew

Firstly, we need to go ahead and tell homebrew that we’ve upgraded to Sierra by running an update and upgrade. This will check for the latest packages that are built for the new operating system you’re on. Simply run the following (please note, this may take a while):

After that’s complete, check everything has installed successfully and that there are no errors by looking at the output from above and, if necessary, by running:

If you encounter any issues, homebrew should be fairly vocal with how you go about fixing issues. If you’re lucky, it will even give you the command to run.

Apache

After the upgrade, you’ll notice all your virtual hosts have disappeared! Not a great start, but luckily macOS keeps the original files you appended with ~orig and the previous versions (with all your old data in) appended with ~previous. You can go ahead and reinstate those files using the commands below:

The above command only copies over your previous versions of the httpd-vhosts.conf and httpd-ssl.conf file. If you’re aware you’ve changed more than these two files for your extra set up, go ahead and copy those over as well. You can see a list of these files by running:

When you’re ready, go ahead and test the configuration files are set up in the right way by running the Apache configuration test:

You may come across some issues, but this command should show you the file and line number where it occurred. Since there may be changes made in the httpd configuration files from your previous version (depending on what you had before and how out of date the syntax was), you might find it easier to start your httpd.conf file from fresh, and make the necessary changes you need for your local set up manually. For more information on how to set up a virtual host in Apache on MacOSX, check out my other post.

When you finally get the a-ok from the Apache configuration test, go ahead and restart Apache using the following command:

MySQL

This one took me a while to work out. When trying to access your database from ‘localhost’, it doesn’t work. But when you try ‘127.0.0.1’, it does. It can also show up as a ‘2002 Socket error’.

This is because MySQL places the socket in a specific location and macOS thinks it should be somewhere else. MySQL puts it in /tmp and macOS looks for it in /var/mysql. The socket is a type of file that allows mysql client/server communication. To fix the error, we simply create a system link, so both parties can be happy:

And that’s it! If you have any further issues, feel free to comment and I’ll happily suggest a solution and update this post.

Leave a Reply

Your email address will not be published. Required fields are marked *