Ruby 1.9.3 without Xcode or GCC
I recently purchased a new Mac, and needed to set up my development environment again; I thought I’d record the steps taken, in case it helps anyone else out in a similar position.
- Run OS X’s “Software Update”, to make sure the operating system and built-in software are up-to-date.
- Download and install Command Line Tools for Xcode.
- Install Homebrew:
$ ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
- Install Git:
$ brew install git
- Install rbenv:
$ cd $ git clone git://github.com/sstephenson/rbenv.git .rbenv $ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_login $ echo 'eval "$(rbenv init -)"' >> ~/.bash_login
- Install ruby-build:
$ mkdir -p ~/.rbenv/plugins $ cd ~/.rbenv/plugins $ git clone git://github.com/sstephenson/ruby-build.git
- Install Ruby 1.9.3:
$ CC=/usr/bin/clang rbenv install 1.9.3-p194
- Set Ruby 1.9.3 as global version to use:
$ rbenv global 1.9.3-p194
In steps 3, 5 and 6, I’m showing you the commands I used, which are based on the respective tool’s current installation guide; but, those commands are subject to change. Also, in step 3, I’m using the version of Ruby that ships with OS X.
Homebrew makes sure you are well aware that its support of using “Command Line Tools” without Xcode is experimental:
Error: Experimental support for using the "Command Line Tools" without Xcode. Some formulae need Xcode to be installed (for the Frameworks not in the CLT.)