Sidenote: I am very positively suprised about the documentation of PostgreSQL...
I chose to install PostgreSQL on my MacBook using Fink (I try to use Fink whenever possible, because I believe serious package management pays off in the long term).
However the installation did not run through as smoothly as possible...
Here are the necessary steps:
Step 0: Install Fink
Go to the Fink project and follow their installation instructions.
Step 1: Install PostgreSQL
Just type
sudo fink install postgresql82
This takes a while and a lot of gibberish appears on your terminal...
In my case there was a warning at the end, telling something about not installing plpgsql. Since I am not planning to use PL/pgSQL, I just ignored that...
Step 2: Initialize the Database
According to the fink package description, this step should not be necessary. But in my case the installation process did not initialize the database, so I had to do it manually.
Type
sudo -u postgres initdb -D /sw/var/postgresql-8.2/data/
Step 3: Start the dbms
Type
sudo pgsql.sh start
This uses a script provided by fink. You could also start the dbms with the native command (i.e.
pg_ctl
, just look at the script...)
Step 4: Create a database
This is optional, you can do this also with pgAdmin (see below). But it is a good check, if the previous step worked.
Type
sudo -u postgres createdb testdb
Step 5: Get pgAdmin and connect
PgAdmin is a client application to access postgres databases. You can get it here.
After starting pgAdmin you have to add the server (File->Add Server...):
To begin with connect as the user 'postgres' (which was created during the fink installation process), which has full administration privileges. Leave the password blank.
This should be it...
BTW: Fink installs the PostgreSQL documentation here:
/sw/share/doc/postgresql-8.2/html/index.html
Great article, thank you. This is exactly what I was looking for.
ReplyDeleteI have installed PostgreSQL on my macbook but I didn't know how to run it.
I have to run a few tests for my Jabber server with PostgreSQL so I started to search Internet for a guide to use PostgreSQL on the macbook. Thanks to you I didn't have to look too long.
Thanks a lot, now I have pg working on my MacBook :)
ReplyDeleteHow to install PG and make it work with APache/PHP on OSX? I have XAMPP installed. Thanks for any help!
ReplyDeleteHello, i've found this blog when i wae really getting confused how to install postgre on my mac.
ReplyDeleteThis is really helpful :)
Thank you very much.
How can i uninstall it using fink?
ReplyDeleteFink remove does not seem to work.