Last Updated: February 25, 2016
·
7.678K
· corysimmons

Clean Postgres on Mac Mavericks

You're probably reading this because you've installed Postgres 20 different ways. It's no wonder, tutorials never work and always leave you hanging so you just move on to the next thing without knowing how to undo what you just did as most of it was command line stuff.

This is almost a straight lift from https://wiki.postgresql.org/wiki/Opinionated_OS_X but I'll try to make it a bit more concise and readable.

Here's the quick and easy way to get Postgres on Mac Mavericks.

  • Remove any "Postgres" Applications you might have installed
  • Run ps auxw | grep postgres to see any Postgres instances that might be going. The thing to really care about is if something is in your LaunchAgents dir. If it is, cd to that directory, run open . and delete the Postgres symlink in that directory.
  • Restart your computer to kill all the other Postgres processes (and they won't restart because we removed them from LaunchAgents)
  • Install Postgres.app (unzip, drag to Applications folder, open it)
  • Open your bash profile (I'm using oh-my-zsh so my profile is located at ~/.zshrc, yours might be at ~/.bash_profile or something) and add export PATH="/Applications/Postgres93.app/Contents/MacOS/bin:$PATH" to the bottom of it
  • In Terminal run source ~/.zshrc (or whatever your bash profile file is)
  • Run psql
  • Boom.

4 Responses
Add your response

Why would people do development on their main machine when they can just spin up vagrant with premade buildVagrant.sh files? 5 minutes and bam, you've got yourself a clean environment to work in without polluting your main machine.

over 1 year ago ·

Have a CoderWall on that? :)

over 1 year ago ·

@estolarsky vagrant does not always make sense for large and complex apps. (due to computer resources)

over 1 year ago ·

This works fine for getting Postgres installed and running but it doesn't make psql available. For one the latest version of Postgres.app is installed here now: /Applications/Postgres.app and there is no /bin directory that I could find in a quick skim where you can access psql.

over 1 year ago ·