For some reason when I run echo $PATHI get the following directory: /Users/<home>/Library/Applications/.

How do I set it back to its default location so that I don't have to run this command, export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin each time I want to run commands in Terminal?

Thanks for the consideration

  • What is in your ~/.profile or ~/.bash_profile – mmmmmm Jan 29 '14 at 19:42

First, check the contents of your ~/.profile and ~/.bash_profile for any lines involving writing paths to $PATH.

If this doesn't help, check the contents of /etc/paths and /etc/paths.d/ for any path that you don't want to be included in your $PATH.

Furthermore, you can show what code is being run by bash by adding the following to the top of /etc/profile:

set -x

Save the file, then open a new Terminal window. This should show when and how the $PATH variable is being overwritten.

| improve this answer | |

Check to see if you have this file: ~/.MacOSX/environment.plist That file can be used to set environment variables for OS X applications, not just shell commands. If the PATH variable is being set in that file you will get all kinds of wonky behavior. This Apple Technical Q&A document leads me to believe the environment.plist file has been deprecated. In nearly every case you do not want this file anyways so if you have consider deleting it.

| improve this answer | |

You must log in to answer this question.

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