user1648507
user1648507

Reputation: 11

How do I put PostgreSQL /bin directory on my path in Windows?

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.

Upvotes: 1

Views: 22884

Answers (4)

Kevin
Kevin

Reputation: 2736

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.

Upvotes: 0

Nawshine
Nawshine

Reputation: 83

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.

Upvotes: 1

Hans Chen
Hans Chen

Reputation: 191

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

Upvotes: 4

Rubyman
Rubyman

Reputation: 874

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

Upvotes: 0

Related Questions