Command line in OSX breaks when I edit bash_profile

1

Please help me, I am learning how to add sublime to command line from this link and when I created .bash_profile file, in the first line I typed export PATH= and saved it.

My command line is broken. I can't do anything with command (for example, I can't use ls, nano, mkdir, rm, etc.) and when I press Tab to view all commands, I see

img img

I tried echo $PATH but it returns " " (empty or null). Please suggest me how to solve this problem.

Thank you and sorry for my English.

Guzzilar

Posted 2013-04-06T21:53:26.770

Reputation: 11

2Well, don't set PATH to an empty string. I don't see the linked blog post suggesting that you should do it. – Lev Levitsky – 2013-04-06T21:56:46.890

oops! i misunderstand. – None – 2013-04-06T22:12:09.917

Answers

4

export PATH=

will set you PATH variable to blank and not enable the shell to find any commands. You should delete this line from your .bash_profile and your problem will be fixed.

I just checked the link referenced in your post and I think this is the line your having a problem with:

export PATH=/usr/local/bin:(...)

I think the author of the blog really meant to write this:

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

This will work correctly. Try adding that line to your .bash_profile. It will simply ensure that commands contained in /usr/local/bin are found first when the shell searches for them (which it does when you type 'rm' for example)

ennuikiller

Posted 2013-04-06T21:53:26.770

Reputation: 980

Oh! i error to reading hahaha// i tried to open .bash_profile for editing but permission denied and i can't use sudo command. how i open bash_file and edit it without sudo command?

Thank – None – 2013-04-06T22:07:56.473

The same way you added the line in the first place!! – ennuikiller – 2013-04-06T22:17:44.270

i used "sudo touch ~/.bash_profile" and "sudo nano ~/.bash_profile" but now i can't use both command. //sorry i newbie for command line – None – 2013-04-06T22:24:23.220

/usr/bin/sudo will get you the sudo command – ennuikiller – 2013-04-06T22:31:38.537

O.o wowww it's excellent!! command is come back to me hahaha

Thank you so much!! – None – 2013-04-06T22:40:51.780

your welcome! you can check this off as being the correct answer please – ennuikiller – 2013-04-06T22:47:21.033