I was advised to use RVM to manage Ruby on the Mac.
- Sign up as an Apple developer
- Download and install XCode
- Follow the instructions for installing RVM.
- Install RVM by executing
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
in the terminal window. - I didn’t have one, so I had to create a .bash_profile file by following the instructions at redfinsolutions.com:
- Start up Terminal
cd ~/
(to go to your home folder)touch .bash_profile
to create the file.open -e .bash_profile
to open it in TextEdit.
- Paste
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
into the file and save - Close the Terminal window, open another one, and type
$ type rvm | head -1
. If everything has worked, you should seervm is a function
-
Then you can run
rvm install 1.9.2
rvm use 1.9.2
- Install RVM by executing
Next you follow the instructions to set up rvm with TextMate. In order to run the script,
- Create the file in the same way as creating the .bash_profile file, naming it [myfilename].command
- Execute
chmod u+rwx [myfilename].command
to give yourself read-write-execute permissions - Double-click on it in Finder to execute it.
Finally, install the pg gem:
- Find out the pg_config path by executing
mdfind pg_config|grep bin|uniq
- 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.