The local psql command could not be located
Solution 1
I had same error even after installing Postgres locally. But after seeing this I saw that "pqsl" was not in the PATH so I then did
PATH=%PATH%;C:\Program Files\PostgreSQL\9.2\bin
which worked for me
Solution 2
I have since solved this myself. When I ran heroku pg:info
it says the version number is 9.1.8, I was locally running 9.2
installing 9.1.8 and ensuring Path pointed to the appropriate folder solved the problem.
Solution 3
After you change the path, make sure to restart the terminal!
Solution 4
Set the PATH. To find out the PATH of your psql script (on mac) open the sql shell script from your finder in Applications/Postgres installation. This will give you a hint as to where it is installed. That opened a window which told me it is located here: /Library/PostgreSQL/8.4/scripts/runpsql.sh
Then, I set the PATH variable from the terminal window by typing:
$ PATH="/Library/PostgreSQL/8.4/bin:$PATH"
(depends on the location of your PostgreSQL installation, find your bin path first, another exp: /usr/local/Cellar/[email protected]/9.6.8/bin)
OR.....
You can also connect to the shell by opening the shell directly from your postgres installation folder. Then enter the credentials. If you don't know the credentials, here is how to find them out:
$ heroku pg:info === HEROKU_POSTGRESQL_RED_URL (DATABASE_URL)
$ heroku pg:credentials HEROKU_POSTGRESQL_RED_URL
Solution 5
Top answer wouldn't work for me oddly, my system would not add the Path via cmd with administrator access (Not sure why).
So check this > Windows key > environment variables > system variables
And add the last line (your version may differ in the path)
Related videos on Youtube
TheMarron
Updated on July 09, 2022Comments
-
TheMarron almost 2 years
I'm following the instructions found here. When I try to run
$ heroku pg:psql
or$ heroku pg:psql HEROKU POSTGRESQL_BROWN
I recieve the following error message:! The local psql command could not be located ! For help installing psql, see local-postgresql
I can't find anything useful on the link it gives me (it just links to the instructions I was already using, but further down the page) nor can I find this error anywhere else.
If I've missed anything you need to know to answer this, just let me know. I'm rather new to all this and teaching myself as I go.
-
Robert H over 11 yearsDoes heroku pg:info output your database information?
-
TheMarron over 11 yearsYes it does. would that information help?
-
-
CodeDreamer68 almost 9 yearsNote: This worked for me too, but I had to close and re-open the PowerShell window and then I typed $Env:Path to see the path and confirm it was there. Then I typed heroku pg:psql at the prompt (within my node-js-getting-started folder) and it worked!
-
Linef4ult over 8 yearsOld question, but as its still not patched worth adding theres a bug in PSQL parsing paths still present: postgresql.org/message-id/…
-
Hanny Setiawan over 6 yearsNice, it save my day. Mine is 9.6 vs 10
-
Csa77 almost 6 yearsnice, this helped to solve my problem, I had 9.5 instead of 10.5