Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just added a few paths to /Users/userA/.bash_profile and sourced it.

It seemed to work, I could access more programs. Now I can't even access ls.
Only cd and source are still working.

What do I need to do to restore my settings?
I removed the changes to .bash_profile using TextEdit, and sourced again but still no luck using ls or cd.

Update: For users reading this the cause of this problem was in my case failing to ad $PATH to the end of profile entries for example:

 PATH=$HOME/downloads/atlassian-jira-5.1-standalone:$PATH

If you leave out :$PATH at the end and save you can have this problem.

share|improve this question
    
I wonder if you've identified the correct root cause: 'cd' is a shell built-in, so if that's failing then your problem is unlikely to be an issue with your path. What exactly happens when you try to 'cd' into a known-good directory? – Jon Lasser Apr 10 '12 at 23:09
    
Ok. When I opened a new window after sourcing the modified file using TextEdit it seemed to work. just forgot to add $PATH to the end of my last entry in the file! – Code Droid Apr 10 '12 at 23:19
    
Feel free to answer your question yourself. Answers are best posted as an actual answer, and not as part of the question. – Daniel Beck Jul 23 '12 at 20:36
up vote 2 down vote accepted

Presuming that the issue really is a path problem, the default Mac OS X path (on 10.7) appears to be:

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

So you can set this by running

export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
share|improve this answer
    
Thanks. I actually ran into this problem a second time. – Code Droid Jul 23 '12 at 20:28
    
For users reading this, its very easy to have this problem when you edit .bash_profile by FAILING to add $PATH at the end of your entries export PATH=$HOME/downloads/atlassian-jira-5.1-standalone:$PATH – Code Droid Jul 23 '12 at 20:32
    
good thing export is still working... – Code Droid Jul 23 '12 at 20:36

export PATH=/usr/bin:/bin. Then be more careful adding stuff to $PATH in the future; as you've just discovered, the wrong change makes external commands difficult to access.

(You can still get to them by full pathname, by the way; most are in /usr/bin.)

share|improve this answer

You must log in to answer this question.

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