whenpenguinsattack.com

Wednesday, April 05, 2006

How to install postgres 8 on Mac OS X


By Justin Silverton

step 1
: install the fink project, available Here

from the fink website: "The Fink project wants to bring the full world of Unix Open Source software to Darwin and Mac OS X. We modify Unix software so that it compiles and runs on Mac OS X ("port" it) and make it available for download as a coherent distribution. Fink uses Debian tools like dpkg and apt-get to provide powerful binary package management. You can choose whether you want to download precompiled binary packages or build everything from source"

Step 2: (install readline) (within a terminal) sudo /sw/bin/fink install readline

Step 3: give yourself root access with sudo and download the latest version of postgres with curl
note: this can be extracted into any directory, I just chose to use /usr/local/postgres_src

mkdir /usr/local/postgres_src
cd /usr/local/postgres_src
sudo sh
curl -O ftp://ftp.us.postgresql.org/pub/PostgreSQL/source/v8.1.3/postgresql-8.1.3.tar.gz
tar -xzvf postgresql-8.1.3.tar.gz
cd postgresql-8.1.3

Step 4: make and configure postgres 8

(within the postgres-8.1.3 directory)
./configure --with-includes=/sw/include/ --with-libraries=/sw/lib
make
make install

Step 5: add a new user that will have permissions on the database.

This can be done by going into System->Preferences->Accounts and "New User". Call this new user "postgres".

Step 6: Create postgres data directories and change the ownership to the postgre user that was created in step 5.

mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data

Login to the postgres user account

su -l postgres

Step 7: initialize the database

/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data


Step 8: start the server

/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

Step 9: start creating tables

createdb test

Step 10: start executing commands on the newly created table. Postgres is now installed.

psql test (psql is a command-line utility for executing sql commands)

create table newtable (name varchar, email varchar);

insert into newtable (name,address) values ('John','john@email.com');

1 Comments:

  • running make, i crash w/ the following:

    make -C interfaces all
    gcc -no-cpp-precomp -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wendif-labels -fno-strict-aliasing -dynamiclib -install_name /usr/local/pgsql/lib/libpq.4.dylib -compatibility_version 4 -current_version 4.1 -multiply_defined suppress fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o md5.o ip.o wchar.o encnames.o noblock.o pgstrcasecmp.o thread.o -L../../../src/port -L/sw/lib -lresolv -o libpq.4.1.dylib
    /usr/bin/libtool: for architecture: cputype (16777234) cpusubtype (0) file: -lSystem is not an object file (not allowed in a library)
    make[3]: *** [libpq.4.1.dylib] Error 1
    make[2]: *** [all] Error 2
    make[1]: *** [all] Error 2
    make: *** [all] Error 2

    By Anonymous Anonymous, at 12:35 AM  

Post a Comment

Links to this post:

Create a Link

<< Home