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?

  • 1
    What have you tried - have you tried creating a .bash_profile and .bashrc (note no _) – user151019 Nov 13 '15 at 17:00
  • No I haven't. My $PATH variable is set, though. Where is it getting those settings from? I need to remove something from it. – Dan Nov 13 '15 at 17:01
  • That is a different question - and has been asked many times – user151019 Nov 13 '15 at 17:03
  • @Mark link please? – Dan Nov 13 '15 at 17:04
  • 1
    @Dan, see gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files -- there are "global" config files that get sourced. – glenn jackman Nov 13 '15 at 17:56

.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.

|improve this answer|||||

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .