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…
- 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)
- You will need to update your .bash_profile
To launch the bash_profile from terminal: touch ~/.bash_profile; open ~/.bash_profile
-
Paste in the following: export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
-
Reload terminal or update from the current session using: source ~/.bash_profile
-
Now type in: which psql
You should see: /Applications/Postgres.app/Contents/MacOS/bin/psql
- 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.
- You should be good to go.