Wow, this is really a nasty one, but here’s how to ease the pain:
1) do yourself a huge favor, get macports, it will install ALL the dependencies it needs for an installation
2) sudo port install mysql5-server
sudo port install postgresql84-server
3) Setup you Server:
sudo mkdir -p /opt/local/var/db/postgresql84/defaultdb
sudo chown postgres:postgres /opt/local/var/db/postgresql84/defaultdb
sudo su postgres -c '/opt/local/lib/postgresql84/bin/initdb -D /opt/local/var/db/postgresql84/defaultdb'
Setup Postgres to auto-run as a server on start up:
sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql84-server.plist
Start the Server:
sudo su postgres -c '/opt/local/lib/postgresql84/bin/postgres -D /opt/local/var/db/postgresql84/defaultdb'
4) add the pg_config path to your path mate .bashrc
should be similar to:
export PATH="/opt/local/bin:/opt/local/sbin:/opt/local/lib/postgresql84/bin:/usr/local/bin:/usr/local:$PATH"
5) since 10.6 is a 32-64bit System for top performance add this to your .bashrc file (it will help with installing the gem later)
export ARCHFLAGS='-arch x86_64'
6) Add the Path to the RVM Config
mate ~/.rvm/config/db
at the bottom:
system_path=/opt/local/bin:/opt/local/sbin:/opt/local/lib/postgresql84/bin/:/usr/local/lib:/usr/local/bin:/usr/local:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin
7) Switch to the ruby version you want with rvm rvm use 1.8.7
8) Source the .bashrc => source ~/.bashrc
9) Install the gem
gem install pg (no sudo!!!)
Done
it took me 3 hours to set it up, what a pain!!!
I will post the procedure for 1.9.1 in a comment to this post
rubynyc said,
September 19, 2009 at 5:19 pm
1.9.1 => Again make sure you have arch flags set correctly , just by typing echo $ARCHFLAGS, there should not be any i386 in it
if there is or you don’t see x86_64 source your .bashrc again
source ~/.bashrc
gem install pg
Building native extensions. This could take a while…
Successfully installed pg-0.8.0
1 gem installed
Installing ri documentation for pg-0.8.0…
Updating class cache with 1513 classes…
Installing RDoc documentation for pg-0.8.0…
Fijai said,
January 22, 2010 at 12:09 am
Hi,
Why no sudo when installing the pg gem?
rubynyc said,
January 23, 2010 at 12:48 am
Since RVM uses your home folder to install all the gems, you are the owner of the gems folder and there’s no need to sudo because you are not modifying files that are not belong to you.
Fijai said,
January 23, 2010 at 1:00 am
Thx. Makes sense. I ignored all the RVM related stuff. RVM looks interesting.