psql:找不到命令Mac [英] psql: command not found Mac

查看:500
本文介绍了psql:找不到命令Mac的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过图形安装在 http://www.postgresql.org/download/macosx上安装了PostgreSQL /

我在我的应用程序中看到它,并且在我的应用程序中也有psql终端。我需要psql在常规终端中运行另一个我正在为应用程序运行的bash脚本。

I see it in my applications and also have the psql terminal in my applications. I need psql to work in the regular terminal for another bash script I'm running for an app.

由于某种原因,当我运行

For some reason, when I run

psql

在Mac中终端,我的输出是

in the Mac terminal, my output is

-bash: psql: command not found

我在终端中运行以下命令:

I ran the following in the terminal:

locate psql | grep /bin

,输出为

/Library/PostgreSQL/9.5/bin/psql

I然后编辑我的〜/ .bash_profile并将其添加到路径中,如下所示:

I then edited my ~/.bash_profile and added it to the path like so:

export PATH = /Library/PostgreSQL/9.5/bin/psql:$PATH

〜/ .bash_profile中唯一的另一件事是SDK man,它位于脚本的底部,如其应有的那样。我也尝试将浴池设置为/Library/PostgreSQL/9.5/bin/。我也重新启动了终端。

The only other thing in ~/.bash_profile is SDK man and it's at the bottom of the script as it says it should be. I've tried setting the bath to just the /Library/PostgreSQL/9.5/bin/ as well. I've restarted my terminal also.

如何使psql正常工作?

How can I get psql to work?

编辑
添加到.bashrc后,当我打开终端时返回此输出

EDIT After adding to .bashrc, this output is returned when I open terminal

-bash: export: `/Library/PostgreSQL/9.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin': not a valid identifier


推荐答案

路径略有错误。您需要包含目录 的PATH,而不是实际的可执行文件本身。

You have got the PATH slightly wrong. You need the PATH to "the containing directory", not the actual executable itself.

您的路径应设置为:

export PATH=/Library/PostgreSQL/9.5/bin:$PATH

没有额外的 sql 部分。另外,您必须删除等号周围的空格。

without the extra sql part in it. Also, you must remove the spaces around the equals sign.

关键字:Postgresql,PATH,macOS,OSX,psql

Keywords: Postgresql, PATH, macOS, OSX, psql

这篇关于psql:找不到命令Mac的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆