Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

"command not found" for ls, which, open, etc.

I was trying to get git to work. After instaling it, doing "which git" gave an errmsg like "~bash: command not found" or something similar. Then I followed instructions found here http://www.jaredeasterday.com/524/issues-with-git-path-git-command-not-found/. I went to the root directory by "cd ~/" and did a "find .bash_profile" but no such file was found. So I created it per instructions on that website with just this line in it "export PATH=/usr/local/git/bin".


Having done that, "which git" now says "which: command not found". I tried to do "ls" on any directory, it says "ls: command not found". I can't even do "open -e .bash_profile" since "open: command not found".


It seems I need to find a way to edit my $PATH variable but most of the unix commands are not accessible (except cd). Can someone please help me get out of this hole I dug myself? Thanks a lot.

MacBook Pro, Mac OS X (10.7)

Posted on Nov 23, 2012 6:49 AM

Reply
4 replies

Nov 23, 2012 11:10 AM in response to quatrieme

export PATH="$PATH:/usr/local/git/bin"


will add the git bin directory to your PATH. What you did was replace your PATH with ONLY git


You can edit your .bash_profile using:


/usr/bin/nano .bash_profile


Then exit the Terminal session and restart an new Terminal session, and now you should have a working PATH for all normal commands as well as git.

"command not found" for ls, which, open, etc.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.