Skip to content

Instantly share code, notes, and snippets.

@mikesjewett
Created December 11, 2012 20:16
Show Gist options
  • Save mikesjewett/4261772 to your computer and use it in GitHub Desktop.
Save mikesjewett/4261772 to your computer and use it in GitHub Desktop.
Postgresql Troubleshooting - updating PATH variable

For anyone using a Mac (Lion) and running into issues with Postgres as your database (with Postgres.app):

If you are using Postgres.app and getting errors…

  1. Type into terminal: which psql

If the the result is /usr/bin/psql you are using the Mac's built in postgres (not the one you want)

  1. You will need to update your .bash_profile

To launch the bash_profile from terminal: touch ~/.bash_profile; open ~/.bash_profile

  1. Paste in the following: export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"

  2. Reload terminal or update from the current session using: source ~/.bash_profile

  3. Now type in: which psql

You should see: /Applications/Postgres.app/Contents/MacOS/bin/psql

  1. Next configure your database.yml

Postgres.app comes pre-configured with your local Mac username so you don't need to add or change it for everything to just work. You also don't need to specify it in database.yml. Development should work with the following: development: adapter: postgresql host: localhost encoding: unicode database: appname_development

Postgres.app will auto create the database that has been specified when you migrate the database for the first time. The name of your database is up to you but the convention is application_name + underscore +environment.

  1. You should be good to go.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment