To be concise and clear about what each file is intended for
~/.profile
is sourced every time Terminal.app is launched~/.bashrc
is where "traditionally" all the export statements for Bash environment are set/etc/paths
is the main file in Mac OS that contains the list of default paths for building the PATH environment variable for all users/etc/paths.d/
contains files that hold additional search pathsNon-terminal programs don't inherit the system wide PATH and MANPATH variables that your terminal does! To set environment for all processes launched by a specific user, thus making environment variables available to Mac OS X GUI applications, those variables must be defined in your ~/.MacOSX/environment.plist
(Apple Technical Q&A QA1067)
Use the following command line to synchronize your environment.plist
with /etc/paths
:
defaults write $HOME/.MacOSX/environment PATH "$(tr '\n' ':' </etc/paths)"