1

I've got a fairly simple question I guess. I'm working on a Ruby on Rails app. I'm trying to switch to PostgreSQL thanks to Heroku.

In my database.yml file it states:

  Install PostgreSQL and put its /bin directory on your path.

My question is how do I put PostgreSQL's /bin directory on my path? Exactly which file do I modify and how?

I imagine this is my issue since when I run the "rails db" command i get:

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

Thanks everyone! Robin.

user1648507
  • 11
  • 1
  • 1
  • 2
  • Are you on Windows, Mac or Linux? The system is telling you to alter an environment variable (called "PATH") which is a setting that is stored on your local computer. There are several ways this can be done, depending on your operating system you use... so if you can tell us, we can then help you. – Taryn East Sep 06 '12 at 04:04

4 Answers4

4

Append the directory to system PATH (not user PATH) by Environment Variables, using a semicolon to separate it from the previous entry.

You can find it from control pannel -> system -> Advanced -> Environment Variables

Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
Hans Chen
  • 191
  • 6
1

Ran into the same issue and tried the solution mentioned here

[user@host user]$ 
psql

bash: psql: command not found
[user@host user]$ 
echo $PATH

/bin:/usr/bin:/usr/local/bin:/usr/bin/X11:/usr/X11R6/bin
[user@host user]$ 
export PATH=$PATH:/usr/local/pgsql/bin

[user@host user]$ 
psql testdb

Should do the trick.

Nawshine
  • 83
  • 5
0

You need to install Postgres first then add the path to system properties > environment variables > in system variables section you will see PATH variable

Rubyman
  • 874
  • 6
  • 15
0

This is my preferred way of adding a new location to the PATH environment variable (on modern Red-Hat-based systems):

echo 'export PATH="/usr/pgsql-9.3/bin:$PATH"' | sudo tee /etc/profile.d/pgsql.sh
  • PATH is a colon : separated list of directories that are search, in order, for a called program.
  • Profile configurations under /etc are persistent for all users (but require the active shell to source them to take effect).
  • The version number is tacked on to the PostgreSQL directory when it is installed from their repository.
Kevin
  • 2,234
  • 2
  • 21
  • 26