How to setup your Mac for RoR development

1) Developer tools – install Xcode

2) Package manager homebrew

We will install homebrew + some common packages (git, ImageMagick, PostgreSQL, …) into /usr/local and take ownership over directory. This way we will not need to use sudo and all binaries will be in our $PATH (because /usr/local/bin is by default).

sudo chown -R $USER /usr/local
ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)"
brew install wget git postgresql sqlite imagemagick

To initialize a database cluster for PostgreSQL use initdb /usr/local/var/postgres. (it will be owned by your user, again, it should not be problem)

3) Ruby version manager – rvm

RVM allows you to have multiple rubies (1.8.7, 1.9.2, jruby, ..) in parallel. It installs everything into your home directory, so again, you can forget about sudo and messing with $PATH variable. Run as normal user:

bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
echo 'if [[ -s "$HOME/.rvm/scripts/rvm" ]]  ; then source "$HOME/.rvm/scripts/rvm" ; fi' >> .bashrc

Open new tab in terminal and rvm should work (be sure your .bash_profile contains source $HOME/.bashrc).

Now you can install last ruby 1.8.7 and set it as default:

rvm install 1.8.7
rvm use 1.8.7 --default
gem install bundler rails capistrano unicorn

Additional ruby interprets can be installed such as:

rvm install 1.9.2
rvm use 1.9.2

4) Git GUI and text editor

5) You are all set

I would suggest using bundler for managing your project gems (even on RoR 2.3.x). Than just cd PROJECT_PATH; bundle install and ejoy simple management of rubies and packages via rvm and homebrew.

Filed under  //   homebrew   mac   rvm  

Comments [3]

About

Web developer. Visit my links. Follow me on twitter.