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 need to start using GIT for my projects from now on and I need to use some UNIX commands. but no matter what I do, I always receive "command not found" error.

I installed MacPorts, but still cant run any UNIX command :/

When I try $ ls, I get the error below, same for sudo, or any other command:

-bash: ls: command not found

and when I try $PATH, I get the lines below:

hakan-yilmaz-MacBook-Pro:~ hakanyilmaz$ **$PATH**

-bash: /opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/subversion/bin/:PATH: No such file or directory

I'm on Mac OS X 10.6.6

I spent 2-3 days and kept Googling and trying everything I found at forums, but no success.


I opened .bash_profile and removed everything else than

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

Then, I reboot that Mac, and it works!

share|improve this question
Consider copying your solution from your question and adding it as an answer (or accepting an existing answer) so other people know how you fixed your problem. – squircle Jan 25 '11 at 3:23
If you wish, instead of using textwrangler and navigate to the hidden files on finder, you may also use the absolute path of pico for example, by doing, inside your profile file directory, the following: $~ /usr/bin/pico .bash_profile. – MEM Oct 26 '13 at 13:33

Your $PATH was overwritten by MacPorts in error. This is my $PATH with MacPorts installed, you should edit it accordingly and set it in your ~/.bash_profile or ~/.profile.

blackcomb:~ tyson$ echo $PATH

Specifically, you are missing /bin, /usr/bin, /usr/sbin, /sbin, /usr/local/bin and /usr/X11/bin.

share|improve this answer

You must log in to answer this question.

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