我echo $PATH
在命令行上键入并获取
/opt/local/bin:/opt/local/sbin:/Users/andrew/bin:/usr/local/bin:/usr/local/mysql/bin:/usr/local/pear/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin
我想知道这是在哪里设置的,因为我的.bash_login
文件为空。
我特别担心的是,在安装MacPorts之后,它在中安装了一堆垃圾/opt
。我认为该目录甚至不存在于正常的Mac OS X安装中。
更新:感谢jtimberman更正我的echo $PATH
陈述
/etc/paths.d
对安装脚本很有用。如果我想让我的安装脚本将已安装的程序添加到该路径中,则可以在中放置一个文件/etc/paths.d
。如果我想手动编辑路径,这/etc/paths
是一个更好的选择。
easiest solution when you want to make a site-wide path change (e.g. to include /usr/libexec or whatever) is to edit
/etc/paths
. While the new
/etc/paths.d/
thing is functional, it's actually more hassle than maintaining a single file. As others have hinted but not spelled out, if the path changes you want would be useful only for one user, it's best to make that change in the bash and/or tcsh config files in that user's home directory instead of system-wide.