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, runopen .
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 addexport 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.
Written by Cory Simmons
Related protips
4 Responses
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.
Have a CoderWall on that? :)
@estolarsky vagrant does not always make sense for large and complex apps. (due to computer resources)
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.