Hi Christian
Thanks a lot for this info! I have no problems with terminal commands or compiling (just don’t do it if not required) but I think it’s a good way if i get stuck.
Best regards, Robert
swingman:
Hi, the Windows installer provided on www.postgresql.org provides a lot of options. They don’t do an installer for the Mac, so I normally use Mark Liyanage’s installer, see www.entropy.ch.
Then I found a needed fuzzy string match, and decided to compile myself. I combined the instructions on Apple’s web site (Google OS X and PostgreSQL) with Mark’s notes and came up with the following:
(run the commands one-by-one)
# HOWTO Custom install PostgreSQL on Mac OS X
Install Apple Developer Tools
Install Fink (search Fink in Google)
Backup any existing PostgreSQL databases on your computer
/usr/local/bin/pg_dumpall > /tmp/postgresql.dump
Shut down PostgreSQL
/usr/local/bin/pg_ctl stop -D /usr/local/pgsql/data/
exit (to exit postgres user)
cd /usr/local/src
sudo sh
If you get:
cd: /usr/local/src: No such file or directory
Try this first
sudo sh
cd /usr/local/
mkdir src
cd src
Then make a postgres directory inside src
mkdir postgres
cd postgres
Download the source for Postgres, replace “8.2.3” with latest stable version in the commands below
curl -O ftp://ftp5.us.postgresql.org/pub/PostgreSQL/source/v8.2.3/postgresql-8.2.3.tar.gz
Unpack
tar -xzvf postgresql-8.2.3.tar.gz
Change directory
cd postgresql-8.2.3
Run configure script
./configure --bindir=/usr/local/bin --mandir=/usr/local/share/man/ --enable-recode --with-CXX --enable-odbc --with-java --enable-syslog --enable-unicode-conversion --enable-multibyte
(You’ll get warnings’)
configure: WARNING: option ignored: --enable-multibyte
configure: WARNING: option ignored: --enable-odbc
configure: WARNING: option ignored: --enable-recode
configure: WARNING: option ignored: --enable-syslog
configure: WARNING: option ignored: --enable-unicode-conversion
configure: WARNING: option ignored: --with-CXX
configure: WARNING: option ignored: --with-java
Make
make
At the end you will see
All of PostgreSQL successfully made. Ready to install.
Install
make install
At the you will see
PostgreSQL installation complete.
Compile and install additional modules
These are located inside the contrib directory. Navigate to the folder for the module you’d like to install and
do
cd contrib/fuzzystrmatch
make
make install
navigate out of folder
cd …
repeat for other modules
cd tsearch2
make
make install
In a new terminal window, change permissions:
sudo chown -R postgres /usr/local/pgsql/
a new terminal window, move the old data directory and create a new one
su postgres
mv /usr/local/pgsql/data/ /tmp/
mkdir /usr/local/pgsql/data/
Initialize the new data directory
/usr/local/bin/initdb -D --encoding=UTF8 /usr/local/pgsql/data
Start the DB server using
/usr/local/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
Needed to navigate into /usr/local/pgsql/data as postgres user and
touch logfile
Before getting it to work
Initialize fuzzystrmatch
psql -U postgres template1 < fuzzystrmatch.sql
It looks scary, but the process only takes 20-30 mins and it opens a world of new possibilities.
As for management tools, I use pgAdmin (Free) and Aqua data studio.
pgAdmin will hold your hand and warn you of some problems.
Hope this helps.