PATH 环境变量

Mac下面的环境变量设置和Linux差不多,为下列这几个文件(按照从左向右的顺序加载):

/etc/profile
/etc/paths
~/.bash_profile
~/.bash_login
~/.profile
~/.bashrc

/etc/profile/etc/paths是系统级别的,系统启动就会加载,后面几个是当前用户级的环境变量。

PATH的路径用 :(冒号)分割。

查看当前配置的 PATH 值,在终端中输入如下命令:

$ echo $PATH

设置PATH的方法:

$ sudo vi ~/.bash_profile

#在文件中添加一行
export PATH=$PATH:/your-path

#保存文件后需要重新开启终端,使配置生效

results matching ""

    No results matching ""