终端中的永久源 (Mac OS)

permanently source in terminal (Mac OS)

这可能是一个非常基本的问题。我还在使用 bash shell (Catalina)。我下载了 gromacs。每次我打开一个新终端 window 我首先要输入

source /usr/local/gromacs/bin/GMXRC

首先,否则我只会得到 command not found。

我怎样才能永久获取它,这样我就不必一直重新输入它了?

我尝试编辑 /etc/paths 文件,但没有成功。

如果您还在 macOS 上使用 bash shell,您只需:

放行:

source /usr/local/gromacs/bin/GMXRC

最后在 .bash_profile

.bash_profile 位于主目录中,因此您可以像这样打开它:

open ~/.bash_profile

为什么.bash_profile?

.bash_profile 在登录交互 shell 开始时执行,在 mac 上,每个交互 shell 默认都是登录 shell。

如果你切换到 zsh 而不是 .bash_profile,我认为应该使用 .zlogin

但这完全取决于您的需要。阅读 zsh configuration files 以备不时之需。