I, like an idiot, decided to export PATH=/usr/local/sbin/.

After some googling I was informed that one should use a .bash_profile file in the root directory of your user which you can use to append paths to the initial $PATH . However the .bash_profile file did not exist prior to me creating one so I'm unsure how to prompt my Mac to actually use this file as part of it's PATH configuration. Every site I've visited simply tells you to make edits to said file but does not explain how to get the OS to use it.

How do I get my Mac to read from .bash_profile to add custom paths?

  • This file is normally in your home folder and it's read automatically; try cat ~/.bash_profile to see if the file exists: it is invisible in finder. Or, alternatively, run ls -lah in your home folder to see if it exists. – egwene sedai Dec 11 '15 at 12:11

The bash shell actually defaults to look for ~/.bash_profile even though it may not initially exist.

After creating this file in the root directory of your user, just enter source ~/.bash_profile . This forces the bash shell to read immediately from the file and will run it's contents straight away.

As long as you have a line that looks like export PATH=<directories> in the file, your PATH will be set by this every time. This helped.

| improve this answer | |


cd ~
echo 'export PATH="$PATH:(insert other path here)"' > .bash_profile


cd ~
touch .bash_profile
nano .bash_profile

This file is read automatically.

| improve this answer | |

You must log in to answer this question.

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