[ chrup]chrupAnonymous 25 Jul 2012 02:28
1. Create user postgres
2. log in as root and build with:
export MACOSX_DEPLOYMENT_TARGET=10.7
export CC=gcc
export CPP="gcc -E"
export CXX=g++
export CXXFLAGS='-O3 -fno-common -arch x86_64'
export CFLAGS='-O3 -fno-common -arch x86_64'
export LDFLAGS='-O3 -fno-common -arch x86_64'
./configureprefix=/usr/local —enable-integer-datetimes —enable-thread-safet —with-libxml —with-libxslt —with-ossp-uuidwith-tclwith-perl —with-python —with-gssapi —with-krb5 —with-pamwith-ldap with-bonjourwith-openssl —with-zlib
make
make install
cd contrib
make
make install
su - postgres
export PGDATA=/Users/postgres/data
initdb
Create this file:
/Library/LaunchDaemons/org.postgresql.dbms.plist
Content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-Apple ComputerDTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.postgresql.dbms</string>
<key>UserName</key>
<string>postgres</string>
<key>GroupName</key>
<string>staff</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/postmaster</string>
<string>-D</string>
<string>/Users/postgres/data</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Start Postgres server with:
launchctl load /Library/LaunchDaemons/org.postgresql.dbms.plist
Stop the server with:
launchctl unload /Library/LaunchDaemons/org.postgresql.dbms.plist
works great.
Start when the machine starts
No issues.
Fast!