简体   繁体   English

终端中的永久源 (Mac OS)

[英]permanently source in terminal (Mac OS)

this is probably a very basic question.这可能是一个非常基本的问题。 I am using the bash shell still (Catalina).我仍在使用 bash shell (Catalina)。 And I downloaded gromacs.我下载了 gromacs。 Every time I open a new terminal window I first have to put每次我打开一个新的终端窗口时,我首先要输入

source /usr/local/gromacs/bin/GMXRC

in first, otherwise I will just get command not found.首先,否则我只会得到找不到命令。

How can I permanently source this so that I don't have to reenter it all the time?我怎样才能永久地获取它,这样我就不必一直重新输入它了?

I tried editing the /etc/paths file but that didn't work.我尝试编辑 /etc/paths 文件,但没有用。

If you are still using the bash shell on macOS , all you have to do is:如果您仍在使用macOS上的bash shell,您只需:

Put the line:放行:

source /usr/local/gromacs/bin/GMXRC

at the end in .bash_profile .最后在.bash_profile中。

.bash_profile is in home directory, so you can open it like: .bash_profile位于主目录中,因此您可以像这样打开它:

open ~/.bash_profile

Why.bash_profile?为什么是.bash_profile?

.bash_profile is executed whenever a login interactive shell starts and on mac, every interactive shell is a login shell by default. .bash_profile在登录交互式 shell 启动时执行,在 mac 上,默认情况下每个交互式 shell 都是登录 shell。

If in case you switch to zsh , instead of .bash_profile , I think .zlogin should be used.如果万一您切换到zsh而不是.bash_profile ,我认为应该使用.zlogin

But that would depend entirely on your need.但这完全取决于您的需要。 Read about zsh configuration files in case you ever need that.阅读zsh 配置文件以备不时之需。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM