Take the 2-minute tour ×

I installed Git with the Git installer for OS X and restarted terminal, but I got a "command not found" error. I also installed Meteor (a web development framework) and ran it – I also get a "command not found".

They were working earlier.

The output of /bin/echo $PATH is


This is a fresh install of OS X. Other commands are working though: I think I can cd around and rm and create files.

share|improve this question
How did you install git? What, precisely, did you enter before it didn't work anymore? What commands don't work? Just git, or all? What's the output of /bin/echo $PATH? –  slhck Feb 17 '13 at 16:26
I added the info above, could you give me some other commands I could test? –  Anders Feb 17 '13 at 17:23
Run PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin as a temporary fix. If this happens with all Terminal windows you open, you broke one of your shell initialization files (e.g. .bash_profile). Look for lines containing PATH and edit or remove them. –  Daniel Beck Feb 17 '13 at 17:30
By the way, recent versions of OS X comes with git out of the box. –  Daniel Beck Feb 17 '13 at 17:39
That didnt work, I cant even run open ~/.bash_profile I think I might just reinstall. –  Anders Feb 17 '13 at 18:22
add comment

1 Answer

up vote 2 down vote accepted

Fixing your PATH, temporarily

If your path is screwed up, as a temporary fix you can run the following to reset it, like Daniel Beck said:


Now, all commands in your current shell should run as usual. If not, try hash -r (in Bash) to rehash the contents of your PATH directories.

Finding the problem's cause

You can then try to trace down the error. Since the Git installer only adds its path to /etc/paths.d, it's not likely that this caused your shell to malfunction. It's probably a line with PATH= in one of your shell's configuration file.

For Bash on OS X, the config files are typically one of the following:

  • ~/.bash_profile
  • ~/.profile

You can edit these files with open -e ~/.bash_profile, for example. If open still isn't recognized, run it with its full path, i.e. /usr/bin/open -e ~/.bash_profile. Look for a line that assigns the PATH, and remove it. Save the file, and open a new shell to see if it worked.

Since a login shell is started with the Terminal in OS X (instead of a non-login shell like in many other Linux/Unix variants), it's unlikely that ~/.bashrc is compromised.

share|improve this answer
Thanks for the answer, I ended up restoring the machine before I got this answer. –  Anders Feb 18 '13 at 1:27
add comment

Your Answer


