Reputation: 130
I have a RoR application hosted on Heroku using a Postgresql database and have been using the PG Backups tool to backup the database from my application on to my local machine. Since the application is still in development, it helps me from a programming standpoint to bring down the changes my colleagues are making to the database. I have been successfully using PG Backups to capture and restore for months but lately, when I run my typical commands as seen here:
$curl -o latest.dump `heroku pgbackups:url --app XXXXX`
$pg_restore --verbose --clean --no-acl --no-owner -h localhost -U XXXXX -d XXXXX_development latest.dump
I am getting this error after the curl command goes through:
-bash: pg_restore: command not found
Any ideas on why this is happening? Obviously the problem is that I can't restore the downloaded backup.
Upvotes: 7
Views: 23638
Reputation: 13306
Sounds like something changed in your local environment, and now pg_restore
, a client command tool bundled with postgres alongside pg_dump and psql, is not available.
Sounds like you need to set your PATH correctly.
Try finding the correct pg_restore
in your system with maybe sudo find / -name pg_restore
, and after you do add it's directory to PATH.
Finally, what you're doing could possibly be accomplished with a simpler heroku pg:pull
, which takes a backup from your heroku database and restores it locally all in one command (but also uses pg_dump/pg_restore, so those need to be available as well.
Upvotes: 13