在Mac 终端中,添加环境变量的文件有两个
/users/xxx/.bash_profile
/users/xxx/.bashrc
例如我们加入alias ll=’ls -l’
如果在bashrc中加入,每次打开新的终端不能使用
如果加入bash_profile,每次打开都能使用
因此结论是每次新开启的终端会自动加载bash_profile,但是不会加载bashrc
所以解决办法有两个,
把配置写在bash_profile中
在bash_profile中加载bashrc
在Mac 终端中,添加环境变量的文件有两个
/users/xxx/.bash_profile
/users/xxx/.bashrc
例如我们加入alias ll=’ls -l’
如果在bashrc中加入,每次打开新的终端不能使用
如果加入bash_profile,每次打开都能使用
因此结论是每次新开启的终端会自动加载bash_profile,但是不会加载bashrc
所以解决办法有两个,
把配置写在bash_profile中
在bash_profile中加载bashrc