Installing PostgreSQL on OS X Lion
Under Mac OS X Lion, the PostgreSQL one-click installer always fails on the post-install step. Ugh.
If you run this as root (or prefix every line with “sudo”, ick). This will create the “postgres” user and its home directory, initialize the database, and add PostgreSQL to system startup.
dscl . -create /Users/postgres
dscl . -create /Users/postgres NFSHomeDirectory /usr/local/postgres
dscl . -create /Users/postgres UniqueID `dscl . -list /Users UniqueID | sort -n -k +2 | tail -1 | awk '{ print $2+1 }'`
dscl . -create /Users/postgres PrimaryGroupID `dscl . -read /Users/_postgres PrimaryGroupID | awk '{ print $2 }'`
mkdir -p /usr/local/postgres/data
chown -R postgres:_postgres /usr/local/postgres
sudo -u postgres -i /Library/PostgreSQL/9.0/bin/initdb -D /usr/local/postgres/data
curl -Lo /Library/LaunchDaemons/org.postgresql.postgres.plist http://be.gs/postgresql.plist
launchctl load /Library/LaunchDaemons/org.postgresql.postgres.plist
Why not use the default “_postgres” user? I don’t what that user account is used for, or what Apple plans to do with that account in the future.
12 Notes/ Hide
-
everyone78rt liked this
-
native99go liked this
-
transientyou83 liked this
-
seasonalyp9 liked this
-
lescommunes liked this
-
repetitivelyaffirmative reblogged this from pseudonym
-
onlydavid liked this
-
pseudonym posted this