macos - 为什么我不能将 PostgreSQL 添加到我的路径中?

标签 macos postgresql

在我升级到 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/

相关文章:

postgresql - 从继承的角色中撤销 SELECT

MySQL 错误,我已尽我所能

objective-c - 与 mac osx 10.10 不兼容的 ARC SDK

macos - 在 Mac OS 上虚拟化服务器

iphone - _myObject 与 self.myObject

django - 如何根据 ManyToManyField 中的多个值来订购模型?

macos - 如何在 OSX 上检测当前系统光标?

将数据从 postgresql 数据库读取到 R 中而不将列转换为因子

ruby-on-rails - Postgres 随机停止工作(Rails,PGSQL.5432)

sql - Postgresql错误: function "json_to_recordset(text) doesn' t exist"