22 August 2011

Mac OS X Lion upgrade notes

My upgrade to Mac OS X 10.7 “Lion” worked flawlessly from a normal user’s point of view. However, there were a few issues with my development environment after the upgrade that needed fixing up.

Custom directories in /var/log deleted

I had a virtual host configured in Apache which was sending its error output to /var/log/apache2/vhosts/. This directory didn’t exist after the upgrade, so Apache didn’t start. Instead, it just shows the lines in the console app:

17/08/11 11:24:44.711 PM com.apple.launchd: (org.apache.httpd[885]) Exited with code: 1
17/08/11 11:24:44.711 PM com.apple.launchd: (org.apache.httpd) Throttling respawn: Will start in 10 seconds

It turns out that looking in the Apache logs, in /var/log/apache2/error.log gives you exact information about what the problem is. In my case, I just had to recreate the directory where my virtual host sticks its log files and Apache started up straight away.

Perl modules need reinstallation

Lion also upgrades Perl, this time to 5.12. Any modules you’ve installed from CPAN will need to be reinstalled as well.

But trying to install CPAN modules directly on a fresh Lion upgrade will fail because you don’t have the necessary build tools installed: gcc, make, and so on.

Developer tools need to be reinstalled

Thanks to geekofhearts, I found out that you need to install Xcode to get the standard Unix developer tools installed. With Lion, you can get Xcode from the Mac App Store for free — it’s just yet another 3 GB download.

Once your Xcode download finishes, you’ll find an Install Xcode application in your Applications folder, which you need to run to actually install the software and get working versions of gcc, make and friends. Even after the installation is complete, this application remains there, but I presume it can be deleted without any ill effects.

Python modules need reinstallation

OS X 10.7 uses Python 2.7 by default, and reinstalls Python 2.6, thereby blowing away all your local modules. You’ll need to reinstall and rebuild any Python modules, and potentially symlink /usr/local/bin/python to /usr/bin/python2.6 if you want to stick with the old version.

My Mercurial installation wouldn’t work at all after the upgrade:

$ hg st
abort: couldn't find mercurial libraries in [/usr/platlib/Library/Python/2.6/site-packages /usr/local/bin …]
(check your install and PYTHONPATH)

Reinstalling Mercurial with easy_install seemed to do the trick:

sudo easy_install Mercurial

The hgkeychain Mercurial extension I was using was also broken with the most recent Mercurial release, failing with this error message:

** unknown exception encountered, please report by visiting
**  http://mercurial.selenic.com/wiki/BugTracker
** Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]
** Mercurial Distributed SCM (version 1.9.1)
** Extensions loaded: rebase, purge, mq, color, pager, graphlog, convert, hgkeychain
Traceback (most recent call last):
  File "/usr/local/bin/hg", line 5, in <module>
pkg_resources.run_script('mercurial==1.9.1', 'hg')
  ...
  File "/Library/Python/2.7/site-packages/hgkeychain-0.2.0-py2.7.egg/hgkeychain.py", line 86, in find_user_password
auth = self.readauthtoken(authuri)
AttributeError: passwordmgr instance has no attribute 'readauthtoken'

According to the project page, hgkeychain is no longer actively developed so I fixed this by I switched to using the mercurial_keyring extension instead.

Is it worth it?

After all this, I finally had my local dev environment up and going again. I was wondering whether the upgrade was worth it.

What convinced me was running the system software update to upgrade to 10.7.1 when it popped up last week. I clicked Install then Restart to kick off the upgrade process and walked away from the computer while it did its thing.

When I came back after dinner, my computer was exactly as I had left it. The same applications were running in the same position on the screen. Even my terminal windows had the same tabs open with the same scrollback history in them. I was confused: hadn’t I asked the computer to upgrade itself?

Then I realised this was the beauty of Resume, one of the headline features in Lion. I didn’t have to worry about restarting my computer for a software update, because everything would come back the way it was before.

Given that’s just one of the many improvements that Apple are touting in this release, I’m looking forward to discovering what other benefits Lion brings to my computing experience.