Reputation:
I'm a newbie to programming, and I've recently started learning basic Terminal commands on my Mac OSX 10.8. One exercise involved changing the PATH variable by entering this into the console:
touch ~/.bash_profile; open ~/.bash_profile
After the Text editor opened, the tutorial prompted me to change the PATH by entering this line at the bottom of the file:
export PATH="$HOME/Users/myuser/desktop:$PATH"
Where "myuser" is my computer's username.
I did so, and now the Terminal won't accept most commands I attempt to input - e.g. cd, ls, clear, raising the error:
-bash: clear: command not found
I've tried using the touch command as well to get back into the bash_profile, but that won't work either. When I echo the PATH, I get this output:
/Users/myuser/Users/myuser/desktop:#PATH
Anyone know how I can fix this?
Upvotes: 0
Views: 1479
Reputation: 649
mipadi is right #PATH has to be change by $PATH but your command is still not correct :
export PATH="$HOME/Users/myuser/desktop:$PATH" $HOME value is "/Users/myuser", so this is equivalent to PATH="/Users/myuser/Users/myuser/desktop:$PATH"
You have to choose go for ONE of those lines (they are all the same) :
export PATH="$HOME/Desktop:$PATH"
export PATH="~/Desktop:$PATH"
export PATH="/Users/myuser/Desktop:$PATH"
Note the capital D at "Desktop", this is case-sensitive. I do not want to question you, but adding the ~/Desktop as part of the environment variables is not common (likely not a good practice).
Regards, Florian
Upvotes: 1
Reputation: 411222
You put in #PATH
instead of $PATH
.
You'll have to edit ~/.bash_profile
to fix that. To open it, open a terminal and enter:
$ /usr/bin/open ~/.bash_profile
Then edit it to use $PATH
instead of #PATH
, save, and open a new terminal; your $PATH
should work again.
Upvotes: 1