找不到 Mac 终端 -bash 命令?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29688932/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 21:56:20  来源:igfitidea点击:

Mac terminal -bash command not found?

macosbashpathterminal

提问by ayy

I'm completely new to using terminal, and while trying to use brewto install some stuff, I did something to PATH. Now if I tell it to do something it always returns

我对使用终端完全陌生,在尝试brew安装某些东西时,我对PATH. 现在,如果我告诉它做某事,它总是会返回

-bash: blah: command not found.

-bash: blah: 命令未找到。

Is there any way to reset something to fix this? What should I do?

有没有办法重置一些东西来解决这个问题?我该怎么办?

回答by James Grundner

Your path is usually set in either your .profile or .bashrc file. These are found in the root of your user's home directory.

您的路径通常在 .profile 或 .bashrc 文件中设置。这些位于用户主目录的根目录中。

You should be able to fix them by running these two commands in the terminal. They contain the default executable paths

您应该能够通过在终端中运行这两个命令来修复它们。它们包含默认的可执行路径

export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"

回答by mma7

You can set your paththis way:

你可以这样设置path

export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

and you can always add other directories if you want. Hope this helps.

如果需要,您可以随时添加其他目录。希望这可以帮助。