Dean Perry

05 October 2013 by Dean Perry

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.

  1. 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.
  2. 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.
  3. Install Homebrew - ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
  4. Run brew doctor to check that Homebrew is installed correctly. It currently shows on mine that 10.9 is pre-release and not supported.
  5. 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-gcc42 and sudo ln -s /usr/local/bin/gcc-4.2 /usr/bin/gcc-4.2
  6. Install RVM - curl -L https://get.rvm.io | bash -s stable --autolibs=enabled
  7. You may need to run source $HOME/.rvm/scripts/rvm after (replacing YOUR-USERNAME with the username of your machine)
  8. To install Ruby 2.1.0 - rvm install 2.1.0
  9. To install Ruby 2.0.0 - rvm install 2.0.0
  10. To install Ruby 1.9.3 - rvm install 1.9.3
  11. Set Ruby 2.0.0 as the default - rvm use 2.0.0 --default
  12. Install Rails & Bundler - gem install rails bundler --no-ri --no-rdoc
  13. Install Pow - curl get.pow.cx | sh
  14. (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.