Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get Rails db console working with psql

I have a Rails 3.0.7 running on Mac OSX Snow Leapard.

The database works and the site is up and running.

I went to try out the new rails db console and it produced the following error:

Couldn't find database client: psql. Check your $PATH and try again.

When I try:

$ which psql

it returns nothing.

Here is my .profile bash file:

export PATH="$HOME/ImageMagick-6.6.9/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin::$PATH"
export SQL_PATH=$HOME/Library/PostgreSQL/9.1
export MAGICK_HOME="$HOME/ImageMagick-6.6.9"
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"
 # Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

I am exporing the path for Postgres.

How can I get the Rails db to find my psql?

like image 277
chell Avatar asked Jan 20 '12 07:01

chell


2 Answers

To your .profile bash file, add the following:

PATH=$PATH:/usr/lib/pgsql/bin

Replace the path /usr/lib/pgsql/bin with the path to your pgsql bin.

like image 116
Jatin Ganhotra Avatar answered Oct 04 '22 23:10

Jatin Ganhotra


I'm on Mac, with Postgres.app.

I updated my .bash_profile like this

open ~/.bash_profile

adding

PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin
  • Check where your Postgress.app is
like image 44
Olaia Avatar answered Oct 04 '22 23:10

Olaia