Mac中如何添加环境变量

转载自:http://neekey.net/wiki/doku.php?id=mac:如何添加环境变量&rev=1317217516&do=diff

======Mac中如何添加环境变量======


=====方法一=====
sudo vi /etc/paths
来编辑Paths,将环境变量添加到paths中。 VIM 是一个编辑器,另外还有几个,如:Pico,Emacs.
Hint:输入环境变量时,不用一个一个的输入,只要拖动文件夹到Terminal里就可以了。


=====方法二=====
- Create the file /etc/paths.d/mysql like this: \\ sudo touch /etc/paths.d/mysql
- Edit the file: \\ sudo vim /etc/paths.d/mysql
- Put the path inside the file: \\ /usr/local/mysql/bin


出处:http://www.sweeting.org/mark/blog/2008/05/26/mac-os-x-tip-setting-path-environment-variables
据说,这样可以自己生成新的文件,不用把变量全都放到Paths一个文件里,方便管理。我试验过了,两个都可以。

posted on 2012-02-11 03:01  yang3wei  阅读(170)  评论(0编辑  收藏  举报