huh, the title quite long isn’t it ?, yeah that’s because there’s a lot of options how to make postgresql working in Mac OSX environment (i’m used Mac OSX 10.5.8), the most common and easy way to install it is via macports, sadly i wasn’t going into that way,because my Apache + PHP installation came from MAMP, not macports, and also my postgresql installation came from EnterpriseDB. yeah install using this way would be pain in the ass, but only complaining wouldn’t solve something, so let’s start doing something real
1. Ruby + Rubygems
i assume you already have ruby installed, below is my configurations
aditmac:~ adit$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9]
aditmac:~ adit$ gem -v
1.3.3
so at least you need to install ruby 1.8.x or rubygems 1.3.x
2. Install MAMP + EnterpriseDB Postgresql
download MAMP at here
download EnterpriseDB Postgresql at here
install DMG is easy, so i don’t need to explain how to do that
3. Install and config phpPgAdmin
download phpPgAdmin at here
extract the file, copy phpPgAdmin onto htdocs directory on MAMP installation
cp -R Downloads/phpPgAdmin-4.2.2 /Applications/MAMP/htdocs/
cd /Applications/MAMP/htdocs
mv phpPgAdmin-4.2.2 phpPgAdmin
edit phpPgAdmin configurations, file is located at /Applications/MAMP/htdocs/phpPgAdmin/conf/config.inc.php
set $conf[’extra_login_security’] to false
set $conf[’owned_only’] to true
please keep in mind, this configurations should be APPLIED for localhost or development environment only, don’t use this configs for production environment because it’s very less secure
access phpPgAdmin
make sure your PostgreSql daemon is running, in finder, just click Applications/PostgreSql 8.4/Start Server
make sure your Apache daemon is running, you can start it via MAMP control panel
go to http://localhost/phpPgAdmin/, you can login using postgres username
4. Install postgres rubygems
add postgres path onto your environment variable
go to your home diretory and edit .profile file
add “/Library/PostgreSQL/8.4/bin” onto export PATH
example of my .profile file looks like this
export PATH=/usr/bin:/opt/local/bin:/opt/local/sbin:/Library/PostgreSQL/8.4/bin:$PATH
export SVN_EDITOR=/usr/bin/nano
# Finished adapting your PATH environment variable for use with MacPorts.export MANPATH=/opt/local/share/man:$MANPATH
# Finished adapting your MANPATH environment variable for use with MacPorts.# Setting PATH for MacPython 2.6
# The orginal version is saved in .profile.pysave
PATH=”/Library/Frameworks/Python.framework/Versions/2.6/bin:${PATH}”
export PATH
reload your profile, assume you are on your home directory, execute this
. ./.profile
echo $PATH
install postgres rubygems
sudo gem install postgres
5. Check whether postgres rubygems works well alongside Ruby on Rails
create dummy rails app
rails dummy
edit dummy/config/database.yml, it should looks like this
development: adapter: postgresql database: dummy_development username: postgres password: some_password test: adapter: postgresql database: dummy_test username: postgres password: some_password production: adapter: postgresql database: dummy_production username: postgres password: some_password
in your RAILS_ROOT, execute
rake db:create:all
go to your phpPgAdmin,and if you see something like this

congratz, it means your installation was succeed