Tell me more ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

When I clicked on terminal.

It shows this:

Last login: Fri Apr 1 17:04:59 on ttys000 -bash: export: /opt/local/bin': not a valid identifier -bash: export::/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin:/usr/local/git/bin:/usr/X11/bin': not a valid identifier Josh@Macbook-Pro~$ export

I installed something yesterday and modified bash_profile. Now I cannot do anything in terminal. Even "ls". It returns - Need help. How can I fix it?

bash: ls: No such file or directory

share|improve this question
2  
We need to see what file was modified, and it'd be great if we knew what "something" was that you installed. You can use Secrets.prefpane to show hidden files in Finder, then open up ~/.bash_profile, or .profile, or .bashrc, or what have you in your favorite text editor, then copy/paste into here. – Jason Salaz Apr 1 '11 at 21:45
Don't cross post. Duplicate of superuser.com/questions/265513/… – Mark Szymanski Apr 1 '11 at 23:35

1 Answer

up vote 5 down vote accepted

Sounds like it's screwing up your PATH, so the shell can't find any of the usual commands. In this case, you can still use the commands by specifying their entire path (e.g. /bin/ls instead of just `ls), or just reset your PATH manually:

PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin:/usr/local/git/bin:/usr/X11/bin

(Note that that's based on the error you gave; there may be some directories missing.)

If .bash_profile is the only thing messed up, it's probably easiest to just disable it:

/bin/mv .bash_profile bash_profile_disabled

... and then open a new (clean) Terminal window, and then look through the file to see if you can undo the damage before renaming it back.

share|improve this answer
THANK YOU SOOOO MUCH! Mine was screwed up to and I have spent hours of research trying to fix it! Your advice worked! I can''t tell you how grateful I am right now!!!! – user22254 Apr 30 '12 at 12:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.