Search code examples
ruby-on-rails-3postgresqlosx-mountain-lion

Cannot get Postgres.app connection


I'm using Mountain Lion and want to switch my rails app from SQLIte to Postgres so I can deploy on Heroku. I have installed Postgres.app and it's working fine if I open it with the path suggested:

/Applications/Postgres.app/Contents/MacOS/bin/psql ; exit;

But whenever I run

which psql

I get:

/usr/bin/psql

which is the one that comes bundled with Mountain Lion and is not what I want. From reading around it is a Path issue but the documentation says to add:

PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"

to .bashrc, which I have done. That file looks like this:

export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

What am I doing wrong?


Solution

  • Did you run source ~/.bashrc in the Terminal window to use the new settings? Or close/open?

    You can check your current $PATH using echo $PATH as well, and see if the Postgres.app directory that you added is there.


    Update with the eventual solution: add the line to the ~/.bash_profile file, as that's the one that Mountain Lion automatically sources.