Setting up a Ruby on Rails development environment on Mavericks
I've just installed the GM (Gold Master) version of Mavericks, Apple's latest OSX operating system. After my other popular blog post on setting up a Ruby on Rails development environment on Mountain Lion, here is my post on setting it up for Mavericks.
Mavericks comes with Ruby 2.0 out of the box but some of my Rails apps are built using 1.9.3. Also, I use RVM because of its gemset feature.
- Install Xcode. This can be found on the App Store. This isn't completely required but some packages on Homebrew require some components of it to install correctly.
- The Xcode Command Line Tools are also good to install. These can either be installed by downloading them from the Apple Developer site or from running
xcode-select --install. This will trigger a popup. Click on install and it will download & install the tools.
- Install Homebrew -
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
brew doctorto check that Homebrew is installed correctly. It currently shows on mine that 10.9 is pre-release and not supported.
- Because Mavericks, like Mountaion Lion, doesn't come with GCC 4.2, it needs to be installed and linked to the correct place. Some packages require it so it's best to install it now -
brew install apple-gcc42and
sudo ln -s /usr/local/bin/gcc-4.2 /usr/bin/gcc-4.2
- Install RVM -
curl -L https://get.rvm.io | bash -s stable --autolibs=enabled
- You may need to run
source $HOME/.rvm/scripts/rvmafter (replacing YOUR-USERNAME with the username of your machine)
- To install Ruby 2.1.0 -
rvm install 2.1.0
- To install Ruby 2.0.0 -
rvm install 2.0.0
- To install Ruby 1.9.3 -
rvm install 1.9.3
- Set Ruby 2.0.0 as the default -
rvm use 2.0.0 --default
- Install Rails & Bundler -
gem install rails bundler --no-ri --no-rdoc
- Install Pow -
curl get.pow.cx | sh
- (Optional) Install MySQL. I had issues with Homebrew installing MySQL so had to revert to downloading and installing manually. @nrollr tweeted me saying that running this command will install MySQL. I've not tried it so cannot comment.
bash <(curl -Ls http://git.io/eUx7rg )
That's it. You should now have a fully functional Rails development environment setup.