I wanted to install rails 3.2.4 on Mac OS 10.7. The system ruby is 1.8, but I wanted to run against 1.9.3, and it was tricky getting everything working with XCode 4.3.
I wanted to use RVM, but right now RVM spits out an error telling you that 1.9.3 is kind of covered with XCode 4.3, that prior versions of ruby aren’t supported with 4.3, and that you might want to install OSX-GCC-Installer and remove XCode. If you want to go down that path, the OSX-GCC dude seems like a nice bloke: http://kennethreitz.com/xcode-gcc-and-homebrew.html
I didn’t! As such, I decided to see if homebrew would install ruby 1.9.3 (it does) and how hard it would be to switch between its version of ruby and the system ruby (it’s trivial).
- Remove rvm if you’ve installed it:
rm -Rf ~/.rvm
-
Install XCode 4.3 from the app store.
Once installed, open XCode -> Preferences -> Downloads -> Command Line Tools. Download ’em. - Install HomeBrew: http://mxcl.github.com/homebrew/. Do your best with their post-install instructions. I especially found it useful to uninstall macports http://guide.macports.org/chunked/installing.macports.uninstalling.html
- Install ruby 1.9.3: brew install ruby
- Open .profile (or .bashrc or whatever bash config file you’re using) and add
PREPATH=$PATH #homebrew suggests putting usr/local/bin before /usr/bin export PATH=/usr/local/bin:$HOME/.gems/bin:$PATH alias unbrew="export PATH=${PREPATH}"
Now, if you want to use the system ruby you run unbrew from the command line