Untitled-1 @ 66.7% (RGB/16)

  • Archive
  • RSS
  • Ask me anything

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.

    • #geekery
    • #postgresql
  • 5 months ago
  • 12
  • Permalink
  • Share

12 Notes/ Hide

  1. everyone78rt liked this
  2. native99go liked this
  3. transientyou83 liked this
  4. seasonalyp9 liked this
  5. lescommunes liked this
  6. repetitivelyaffirmative reblogged this from pseudonym
  7. onlydavid liked this
  8. pseudonym posted this
← Previous • Next →

About

Me. Manhattan. Twenty-Something.

This is the chronologically-sorted collection of thoughts from my otherwise unorganized mind.

flickr | ogali
twitter | oogali

Twitter

loading tweets…

Following

  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr