Here are the the (very terse) steps I took to get my Ruby development environment back up, more a reminder to myself than a installation cookbook, but I'm sure it will be helpful for someone...
Install Mountain LionDuh!
Install XCodeAvailable in the App Store, also make sure to install the command line tools.
Install rbenvThere is a chicken and egg problem here: to install
gitto clone the repo, and to install
gityou need homebrew, and to install homebrew you need ruby. So work around that, pull down a tar-ball of the
cd ~ mkdir tmp cd tmp wget https://github.com/sstephenson/rbenv/tarball/master tar xf master mv sstephenson-rbenv-* ~/.rbenv
Install RubyAdd the following to
~/.gemrcto avoid generating ri & rdoc.
gem: --no-ri --no-rdocI use yard instead, which is much nicer!
Get the latest version of Ruby from
http://www.ruby-lang.org/en/downloads/(1.9.3-p194 at the time of writing)
cd ~/tmp tar xzf ruby-1.9.3-p194.tar.gz cd ruby-1.9.3-p194 ./configure --prefix $HOME/.rbenv/versions/1.9.3-p194 make make installAlso do the normal
Install homebrewNow that
rubyis available, homebrew can be installed
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
brew install git
brew install libyaml
Reinstall rbenv & RubyNow we have all pieces to install
cd ~ rm -rf .rbenv git clone git://github.com/sstephenson/rbenv.git .rbenv cd ~/tmp/ruby-1.9.3-p194 make distclean ./configure --prefix $HOME/.rbenv/versions/1.9.3-p194 make make install
Install X11Mountain Lion doesn't come with X11 headers any more, and if you try to compile Ruby 1.8 it requires X11 for tcl/tk, so it will fail with:
/usr/include/tk.h:78:23: error: X11/Xlib.h: No such file or directoryYou can get X11 from http://xquartz.macosforge.org/landing/
After that you need to set
Install Ruby 1.8If you don't need tcl/tk & X11 in Ruby 1.8 you can just supply the flags
--disable-tcl --disable-tkto your
configurecommand, but if you do, you are now ready to compile 1.8
./configure --prefix $HOME/.rbenv/versions/1.8.7-p370
Done!After this you are done!
martin@mbp[master]$ rbenv versions 1.8.7-p370 1.9.2-p320 * 1.9.3-p194 (set by /Users/martin/.rbenv/version)Happy Ruby hacking :)