Skip to content

Setting up development environment

pjfranzini edited this page Jan 9, 2014 · 17 revisions

To get the development environment setup for OS 10.9 please follow the below instructions. All of the commands are to be typed inside the command line so have that open. The $ indicates the prompt, don't actually type it in.

Command line tools

$ xcode-select --install Follow the UI that pops up to install the command line tools.

Type $ xcode-select -p to verify that it is installed. The command should print out /Library/Developer/CommandLineTools.

Install HomeBrew

$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"

Type $ brew doctor to check that you've installed it properly. Follow the instructions that it gives for fixing any issues.

Make HomeBrew packages priority

open the file called .bash_profile (or .zshrc if you have it) in the home directory. add a line at the end: PATH=/usr/local/bin:$PATH

Install git

$ brew install git

To check that you've installed it properly:

$ git --version

Configure git

$ git config --global user.name "Your Actual Name"
$ git config --global user.email "Your Actual Email"

Verify with:

$ git config --get user.name
$ git config --get user.email

Install rbenv

$ brew update
$ brew install rbenv ruby-build
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

Note: replace .bash_profile with .zshrc if you've installed oh-my-zsh.

Restart your terminal at this point.

Install Ruby

Get the Ruby version# from Curri's Gemfile. For example, if the Gemfile says ruby "2.0.0" then from the command line run $ rbenv install --list and find the latest 2.0.0 patch.

$ rbenv install <version#>
$ rbenv global <version#>
$ gem update --system
$ gem install bundler

Check that Ruby is installed with $ ruby -v.

Postgresql

$ brew install postgresql
$ initdb /usr/local/var/postgres
$ psql --version
$ which psql

The last command should return /usr/local/bin/psql

Now to get Postgres running type this:

$ mkdir -p ~/Library/LaunchAgents
$ cp /usr/local/Cellar/postgresql/<psql-version>/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents
$ gem install lunchy
$ lunchy start postgres

In the copy command above, replace with the version number. For example, if psql --version returns 9.3.2 then do:

$ cp /usr/local/Cellar/postgresql/9.3.2/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents

Use $ lunchy stop postgres to stop Postgres.

Or try the app

If the above command line process doesn't work (especially if you get homebrew errors) then try the following:

  • Download the app from http://postgresapp.com/
  • Install and run the app
  • In the command line type $ echo 'PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"' >> ~/.bash_profile
  • Restart your computer
  • The app needs to be on whenever you use Rails. It'll add a little elephant icon in the top right corner of your screen.

Maintaining the environment

$ brew update // to update Homebrew itself
$ brew upgrade <package-name>