Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I add PostgreSQL to my path?

After I upgraded to Mavericks, PostgreSQL started playing up, giving this error message whenever I call pg_restore without calling the full path:

pg_restore: command not found

If I specify the full path it works, but that's obvious not optimal:

/Applications/Postgres93.app/Contents/MacOS/bin/pg_restore --verbose --clean --no-acl --no-owner -h localhost -U steven -d db/testivate_development $file_path

To fix this problem, I have tried removing all versions of PostgreSQL (with Homebrew) and then installed Postgres.app. You can confirm this has worked like this:

$ sudo find / -name pg_restore
/Applications/Postgres93.app/Contents/MacOS/bin/pg_restore
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory

To add PostgreSQL to my path, I've tried adding each of the following lines to ~/.bash_profile, ~/bashrc and ~/.zshrc, restarting after each attempt:

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

...as per the postgresapp.com documentation, and then...

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

...as per the comments below.

None of this has solved my problem.

like image 328
steven_noble Avatar asked Nov 17 '13 04:11

steven_noble


People also ask

How do I find PostgreSQL path?

You can find postgresql. conf and look at param data_directory . If it is commented then database directory is the same as this config file directory. It will be depending on the distribution, they all do it slightly differently.

How do I know if Postgres is installed on Windows?

The quick way to verify the installation is through the psql program. First, click the psql application to launch it. The psql command-line program will display. Second, enter all the necessary information such as the server, database, port, username, and password.


1 Answers

Try adding this line to your .bash_profile:

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

and remove or comment out the previous reference.

like image 176
l'L'l Avatar answered Sep 20 '22 12:09

l'L'l