在我升级到 Mavericks 后,PostgreSQL 开始运行,每当我调用 pg_restore
而不调用完整路径时都会给出此错误消息:
pg_restore: command not found
如果我指定完整路径,它会起作用,但这显然不是最优的:
/Applications/Postgres93.app/Contents/MacOS/bin/pg_restore --verbose --clean --no-acl --no-owner -h localhost -U steven -d db/testivate_development $file_path
为了解决这个问题,我尝试删除所有版本的 PostgreSQL(使用 Homebrew),然后安装 Postgres.app。您可以确认它是这样工作的:
$ 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
为了将 PostgreSQL 添加到我的路径中,我尝试将以下每一行添加到 ~/.bash_profile
、~/bashrc
和 ~/。 zshrc
,每次尝试后重新启动:
export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
...根据 postgresapp.com 文档,然后...
export PATH="/Applications/Postgres93.app/Contents/MacOS/bin:$PATH"
...根据下面的评论。
这些都没有解决我的问题。
最佳答案
尝试将此行添加到您的 .bash_profile 中:
export PATH="/Applications/Postgres93.app/Contents/MacOS/bin:$PATH"
并删除或注释掉之前的引用。
关于macos - 为什么我不能将 PostgreSQL 添加到我的路径中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20027374/