PostgreSQL and Rails
The official PostgreSQL gem for rails is ruby-pg. Its installation includes native extensions that require the development version of PostgreSQL to be installed on the target machine. This in a requirement easy to accomplish in Debian installations: apt-get install libpq-dev, but in OsX the speediest method is to install directly PostgreSQL.
The distribution of PostgreSQL includes a binary package for Os X, which simplifies the installation and setup of a PostgreSQL database in Os X. However, it also modifies the memory settings in the machine and install a database server, so the devlopment machine ends being a proper server -with additional daemons running full time-.
In many cases this is not required: perhaps a laptop used for casual development, or perhaps the development environment implies already a test database running on a separate machine. For these cases, the best alternative is to download the source code and compile it:
./configure make sudo make install
Which gets PostgreSQL installed under /usr/local/pgsql. This path (/usr/local/pgsql/bin) must now be included in the PATH environment variable. Then, installing the ruby gem is as easy as typing:
gem install pg
Although easy, this solution pollutes the /usr/local/ area, so a cleaner alternative is to install it in a separate directory:
./configure --prefix=TARGET_FOLDER make make install
And TARGET_FOLDER/bin must be added now to the environment PATH variable.