Mac 下的环境变量配置,不像windows下的那么简单明了

1.Mac 下的环境变量也是分级别的

① 系统级别 /etc/profile 和 /etc/paths 系统启动就会加载

② 用户级别 ~/.bash_profile、 ~/.bash_login、 ~/.profile 和 ~/.bashrc

加载顺序依次是
/etc/profile - - > /etc/paths - - > ~/.bash_profile - - > ~/.profile - - > ~/.bashrc

2. 以配置用户级别的~/.bash_profile为例,进行说明
① 打开终端
Mac 下配置环境变量(Mysql为例)

② 输入命令:touch ~/.bash_profile
Mac 下配置环境变量(Mysql为例)

③ 打开文件:方式有两种
第一种如下
Mac 下配置环境变量(Mysql为例)
配置环境变量
Mac 下配置环境变量(Mysql为例)

第二种打开方式:vim ~/.bash_profile
Mac 下配置环境变量(Mysql为例)
Mac 下配置环境变量(Mysql为例)

我配置的是mysql的路径,查看环境配置是否生效
Mac 下配置环境变量(Mysql为例)

相关文章:

  • 2021-09-17
  • 2021-04-25
  • 2021-07-29
  • 2022-02-15
  • 2022-01-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-18
  • 2021-12-31
  • 2021-08-13
  • 2021-08-26
  • 2021-11-27
相关资源
相似解决方案