终端似乎无法自动获取.profile文件。

14

最近我添加了一些别名和.bash_profile函数。但是我注意到我的Mac终端没有自动加载.profile文件,因此别名无法正常工作。

我已经重新启动了终端和Mac本身。

我可以通过这样做让它工作,但这是一个糟糕的解决方法:

. .profile

有没有人遇到过这种情况/知道我如何修复它。

我的.profile文件包含以下内容:

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

alias testsite="cd /Applications/MAMP/htdocs/testsite/"
alias mamp="cd /Applications/MAMP/"
alias htdocs="cd /Applications/MAMP/htdocs/"
alias deploy="git push"
alias deploymaster="git push parent master"
alias pullmaster="git pulll parent master"

6
你是否同时拥有 .bash_profile.profile ?如果前者存在,则后者将不会被加载。 (注:.bash_profile.profile 是在 Unix-like 系统中用于配置用户环境变量和执行用户特定操作的文件,两者都位于用户主目录下,但当两个文件都存在时,只有 .bash_profile 会被加载。) - LaC
确实是这样,我想那就是问题所在。 - David
1个回答

18

.bash_profile覆盖了.profile,因此我添加的内容必须添加到.bash_profile中,这样做可以完美地运行。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接