mac修改环境变量的两种方式
vim ~/.bash_profile
vim ~/.zshrc
vi /etc/profile
方式一:
修改
vim ~/.bash_profile
使环境变量生效
source ~/.bash_profile
方式二:
只对当前终端有效,新开或者关闭终端就不好使了(不好用啊,这个)
vi /etc/profile
问题处理:
我mac电脑,像这样配置了环境变量,但是下次重启电脑之后,jmeter的环境变量就失效了。
因为:
我的电脑shell解释器,是zsh
使用可查看当前设备的shell解析器。
zhaohui@zhaohuideMacBook-Pro ~ % echo $SHELL
/bin/zsh
而.bash_profile文件是bash解释器的环境变量配置文件。
解决办法
方法1、如果设备是zsh 解释器的话,直接编辑~/.zshrc文件
vim ~/.zshrc
source ~/.zshrc
方法2、
编辑 ~/.zshrc文件,在里面添加source ~/.bash_profile,然后再source ~/.zshrc
1、编辑
vim ~/.zshrc
2、添加
在里面添加source ~/.bash_profile
3、使环境变量生效
source ~/.zshrc