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 Lion
Duh!Install XCode
Available in the App Store, also make sure to install the command line tools.Install rbenv
There is a chicken and egg problem here: to installrbenv you need git to clone the repo, and to install git you need homebrew, and to install homebrew you need ruby. So work around that, pull down a tar-ball of the rbenv first.cd ~ mkdir tmp cd tmp wget https://github.com/sstephenson/rbenv/tarball/master tar xf master mv sstephenson-rbenv-* ~/.rbenv
Install Ruby
Add the following to~/.gemrc to 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
rbenv in your .bash_profileInstall homebrew
Now thatruby is available, homebrew can be installedruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
Install git
brew install git
Install libyaml
brew install libyaml
Reinstall rbenv & Ruby
Now we have all pieces to installrbenv for realcd ~ 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 X11
Mountain 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
export CPPFLAGS=-I/opt/X11/include
Install Ruby 1.8
If you don't need tcl/tk & X11 in Ruby 1.8 you can just supply the flags--disable-tcl --disable-tkto your
configure command, 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 :)

No comments:
Post a Comment