.bash_PROFILE:Mac终端中没有这样的文件或目录

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了.bash_PROFILE:Mac终端中没有这样的文件或目录相关的知识,希望对你有一定的参考价值。

当我打开终端时,我收到以下错误,无法输入新命令。关闭并重新启动我的Mac并没有解决问题。我怎样才能解决这个问题?

-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory
-bash: /Users/HabibAlejalil/.bash-PROFILE: No such file or directory

[Process completed]
答案

你需要找出,哪个文件试图访问.bash-PROFILE。当然你可以使用常见的嫌疑人(.profile,.bashrc,.bash_profile等),但这并不能保证它会出现。如果没有,您应该生成一些正在执行的内容:

我首先尝试打开一个bash子shell

bash -li

并查看错误消息是否再次出现。如果确实如此(可能,但不是肯定的话),请重复此测试

bash -lix

这将告诉你罪魁祸首。如果bash -li没有显示错误,我会在set -x和你的/etc/profile的开头放一个~/.bashrc并打开一个新的终端。

以上是关于.bash_PROFILE:Mac终端中没有这样的文件或目录的主要内容,如果未能解决你的问题,请参考以下文章

Mac系统终端命令行不执行命令 总出现command not found解决方法

Mac下配置.bash_profile(环境变量)

解决 MAC 终端上每次打开新窗口手动执行source ~/.bash_profile导出环境变量

Mac下终端设置

Mac系统终端命令行不执行命令解决方法(command not found)

mac 配置.bash_profile不生效问题