天天看點

關于Mac中PATH環境變量可能會被修改的幾個地方

    一個是全局的profile檔案,位置在/etc/profile中;另一個和使用者無關的全局位置在/etc/paths.d目錄中:

apple@kissair: paths.d$pwd

/etc/paths.d

apple@kissair: paths.d$ls -lh

total 16

-rw-r--r--  1 root  wheel    13b  8 12 05:27 40-xquartz

-rw-r--r--  1 root  wheel    19b 12 26 15:27 git

其中的每一個檔案中放置一行路徑,shell登入時會周遊paths.d目錄下的所有檔案中的路徑,依次将其添加到path的末尾。

    和使用者相關的配置大家就很清楚了:~/.bash_profile,~/.profile,~/bashrc(nonlogin)