Creating a Rails 3 Project with PostgreSQL and TextMate on a Mac OS X Machine

I was advised to use RVM to manage Ruby on the Mac.

  1. Sign up as an Apple developer
  2. Download and install XCode
  3. Follow the instructions for installing RVM.
    1. Install RVM by executing $ bash < <( curl ) in the terminal window.
    2. I didn’t have one, so I had to create a .bash_profile file by following the instructions at
      1. Start up Terminal
      2. cd ~/ (to go to your home folder)
      3. touch .bash_profile to create the file.
      4. open -e .bash_profile to open it in TextEdit.
    3. Paste [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session. into the file and save
    4. Close the Terminal window, open another one, and type $ type rvm | head -1. If everything has worked, you should see rvm is a function
        Then you can run

      • rvm install 1.9.2
      • rvm use 1.9.2

Next you follow the instructions to set up rvm with TextMate. In order to run the script,

  1. Create the file in the same way as creating the .bash_profile file, naming it [myfilename].command
  2. Execute chmod u+rwx [myfilename].command to give yourself read-write-execute permissions
  3. Double-click on it in Finder to execute it.

Finally, install the pg gem:

  1. Find out the pg_config path by executing mdfind pg_config|grep bin|uniq
  2. Install the gem using gem install pg -- --with-pg-config=[the path returned by the previous line]

Notice that sudo isn’t used, because RVM is being used.

See this tutorial for setting up a Rails app with a PostgreSQL DB.

About Jennifer Phillips Campbell

Software Developer and Medieval Historian
This entry was posted in PostgreSQL, Ruby on Rails. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s