Upgrading: Mountain Lion, XCode 4.5, Ruby 1.8
31 Oct 2012Ok, maybe I can save someone else an hour or two of time. I have an existing Ruby (rbenv) environment and transferred my entire user folder to a brand new Retina MBP 13". I had already installed the latest XCode and the Command Line tools. The mysql2 gem didn't want to build, but in hindsight I bet no gem would have wanted to compiled. Here are the quick steps to fix:
brew tap homebrew/dupes brew install apple-gcc42 sudo ln -s `which gcc-4.2` /usr/bin/gcc-4.2 # add to .bashrc, .zshrc, etc
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/:$DYLD_LIBRARY_PATH
First we get GCC 4.2 back, which Ruby 1.8 loves (and all my other stuff was built with anyways). Then we link the new binary (wherever it is) to the old binary location since rbconfig.rb hardcodes the old compilers path. Finally (for MySQL) we insure that MySQL's libs are added to the system dynamic load path.
Problem solved.