I don't have .bash_profile
or .bashrc
files and I am definitely using the bash shell. I am using Mac OS X 10.11.1 El Capitan.
How do I permanently modify my $PATH
to cut down the default values Apple ships?
I don't have .bash_profile
or .bashrc
files and I am definitely using the bash shell. I am using Mac OS X 10.11.1 El Capitan.
How do I permanently modify my $PATH
to cut down the default values Apple ships?
.bash_profile
and .bashrc
do not have to exist for $PATH
to work, they're for bash configuration. According to the bash docs,
When Bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file
/etc/profile
, if that file exists. After reading that file, it looks for~/.bash_profile
,~/.bash_login
, and~/.profile
, in that order, and reads and executes commands from the first one that exists and is readable.
To add a path to your $PATH
variable for a single terminal session, do so as follows: export PATH=$PATH:pathToYourDirectory
, for multiple directories export PATH=$PATH:pathToYourFirstDirectory:pathToYourSecondDirectory
...
To see what's in your $PATH
: echo $PATH
or cat /etc/paths
/etc/paths
is the file that holds your system path variables
Run man path_helper
for more information.
~/.profile
which I didn't know existed nor to look for. Most tutorials online asking to modify $PATH never mention this file, only the previous two. Thank you. – Dan Nov 13 '15 at 19:21