Installing PostgreSQL on Mac
Written by matt on May 9th, 2007
I'm working on a Rails project and I need to make sure that our code is compatible with PostgreSQL. I never installed/used before and since I'm lazy and rely on other people knowledge, I decided to install Postgresql using MacPort.
It was actually simpler than I expected. I simply followed this post and almost everything went ok.
sudo port install postgresql81 +server
will install postgresql
sudo gem install postgres -- --with-pgsql-include-dir=/opt/local/include/postgresql81 --with-pgsql-lib-dir=/opt/local/lib/postgresql81
Will do a gem install
Start your server automatically by doing:
sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql81-server.plist
sudo launchctl start org.macports.postgresql81-server
Create a folder for your dbs mkdir /opt/local/var/db/pgsql/data
Add pgsql to your path (I use textmate)
mate ~/.profile
My path looks like that:
export PATH=/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:/opt/local/lib/postgresql81/bin/:$PATH
export PGDATA="/opt/local/var/db/pgsql/data"
restart your shell (or open a new tab) and type initdb -D /opt/local/var/db/pgsql/data
Success. You can now start the database server using:
postmaster -D /opt/local/var/db/pgsql/data
or pg_ctl -D /opt/local/var/db/pgsql/data -l logfile start
Now, create your db: $ createdb test -E utf8 or drop your newly created db: $ dropdb test
That's it, it was easy.
Post a comment
Recent
Articles
feed- Rails and Merb core team working together (December 24th)
- MerbCamp 2008 SanDiego (September 15th)
- db fixtures replacement solution step by step (September 7th)
- Ruby developers don't scale (August 27th)
- Googlecharts featured on Github (June 27th)
- About Metaprogramming speed (June 18th)
- News update (June 17th)
- Avoid using metaprogramming (seriously!) (May 4th)
- BarCamp San Diego rev.3 (April 27th)
- Freezing Rails with Git (April 16th)
- Merb tip - how to freeze a project? (April 15th)
- Rails or Merb, what's best for you? (April 10th)
- Merb tips II (April 7th)
- Merb tips I (April 4th)
- How Duplo (and I) offended people (March 20th)
Comments
feed- SingleShot onAjax Pagination in less than 5 minutes
- SingleShot onAjax Pagination in less than 5 minutes
- ???????? onSexy charts in less than 5 minutes
- daniel lopes onSexy charts in less than 5 minutes
- larry onSexy charts in less than 5 minutes
- jack onSexy charts in less than 5 minutes
- grosser onRails and Merb core team working together
- Thomas Kilb onSexy charts in less than 5 minutes
- Jonathon Hill onSexy charts in less than 5 minutes
- Eike Herzbach onAbout Metaprogramming speed
- grosser ondb fixtures replacement solution step by step
- Bryan Ray ondb fixtures replacement solution step by step
- Matt Aimonetti ondb fixtures replacement solution step by step
- Nicolas Mérouze ondb fixtures replacement solution step by step
- Tahjappychiessers onSexy charts in less than 5 minutes
Archives
Archives
- December 2008 (1)
- September 2008 (2)
- August 2008 (1)
- June 2008 (3)
- May 2008 (1)
- April 2008 (6)
- March 2008 (4)
- February 2008 (2)
- January 2008 (2)
- December 2007 (8)
- November 2007 (5)
- October 2007 (5)
- September 2007 (6)
- August 2007 (5)
- July 2007 (11)
- June 2007 (10)
- May 2007 (7)
- April 2007 (4)
- March 2007 (3)


