Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

heroku pull postgresql on windows

I'm trying to pull a heroku database to my local Windows computer by using

heroku pg:pull HEROKU_POSTGRESQL_DATABASE mydatabase --app myapp

However, when I run this command I get the following error:

'env' is not recognized as an internal or external command, operable program or batch file. ! The local psql command could not be located ! For help installing psql, see PostgreSQL-local-setup

I do have psql in my path, and I can successfully call psql from my command line. I can even call heroku pg:info --app myapp successfully, and it shows the existence of my database.

Any suggestions?

like image 688
user3507926 Avatar asked Mar 19 '23 23:03

user3507926


2 Answers

I believe the answer given here is really inaccurate so I will answer:

See, when there is an error such as "'env' is not recognized as an internal or external command, operable program or batch file" it means that the system is trying to execute a command named env. This has nothing to do at all with setting up your environment variables.

Env is not a command in windows, but in unix. I understand that you have a windows machine though. What you can do is run "git bash". (You could get it by itself but it comes with Heroku's CLI).

This gives you a unix-like environment where the "env" command is supported, and then you can run the actual heroku pg:pull command :)

I hope this helps!

like image 118
Yoni Keren Avatar answered Mar 22 '23 23:03

Yoni Keren


I realize this is from months ago, but I'll answer in hopes of helping somebody else. You need to set your path variables. My Computer > Advanced system settings; Click on "Environment variables" and then look at "System variables". Scroll down to "Path" or "PATH", edit it, and go to the very end of the text box. Add ;C:\Program Files (x86)\PostgreSQL\9.3\bin and ;C:\Program Files (x86)\PostgreSQL\9.3\lib (or whatever your equivalent paths are for bin and lib). Restart your command prompt and it should work. :)

like image 24
Christina Masden Avatar answered Mar 23 '23 01:03

Christina Masden