Upgrading to Mountain Lion and your development environment

Hemant's avatar

Hemant

Prem of thoughtbot already had some brief instructions about upgrading to mountain lion and then thanks to Kenny for adding much to those instructions.

What follows is my own upgrade path:

  1. Take backup via Time Machine or superduper!.
  2. Upgrade using installer from App store and reboot.
  3. Install XCode 4.4 from App store. Looks like, if you don't care much about developing iOS or OSX applications, you can skip this step. But I didn't.
  4. Install command line tools of XCode as instructed in Prem's blog post.
  5. Change permissions of Homebrew directory.
  sudo chown -R `whoami` /usr/local
  brew update
  1. If you are like me, you still have few applications running on 1.8.7. Ruby versions before 1.9.3 can't be easily compiled using llvm-gcc compiler. Install gcc-4.2 using homebrew:
  brew tap homebrew/dupes
  brew install apple-gcc42
  1. Configure apple-gcc42 as default compiler. Update your ~/.zshrc or ~/.bashrc and add following lines:
  export CC=/usr/local/bin/gcc-4.2

Above line should take care of compiling ruby itself and many native gems which use proper compiler detection. Unfortunately this won't work for few odd gems and hence, you also need to do:

  sudo ln -s /usr/local/bin/gcc-4.2 /usr/bin/gcc-4.2
  1. Install XQuartz. This step may require you to logout and login again.

  2. Even if you already had ruby 1.8.7/1.9.3 compiled, I will urge you to recompile new one - just to ensure everything works perfectly. For compiling Ruby 1.8.7/REE:

  export CPPFLAGS="-I/opt/X11/include"
  export CFLAGS="-I/opt/X11/include"

For compiling ruby:

  rvm reinstall ree
  rvm reinstall 1.9.3

You should be able to compile ruby 1.9.3 without requiring any of above flags.

  1. Some recommend reinstalling key packages that you have installed using homebrew before ML upgrade.I did not bother to reinstall all the packages, but I did reinstall imagemagick.
  brew unlink imagemagick
  brew install imagemagick
  1. At this point you should have a working ruby and rails setup. I faced a minor problem where I was running mysql using packages downloaded from Mysql website and they were installed in /usr/local and after I changed permissions to restore Homebrew setup, my Mysql installation broke. To restore the sanity:

    sudo chown -R _mysql:_mysql /usr/local/mysql-5.xx

  2. In some of Rails applications, Nokogiri was throwing warning about being compiled against different version of libxml2. To get rid of those, I simply nuked Rails.root/vendor/ruby and reinstalled the gems my app was using via bundle install.

  3. Mark has suggested these instructions for getting pow running with Safari 6.

  4. I found that automatic reconnecting to wi-fi after coming out of sleep was broken. To fix this, I removed all the remembered locations and then in Configure Network Prefrences -> TCP/IP changed Configure IPV6 to Link-local only.

  5. I also noticed that external monitor when plugged in, won't be detected at all.To fix this I had to reset my PRAM. You can follow this article for more information on resetting PRAM.