MacOS – Terminal returns not found for most commands Mac OSX

bashcommand linemacossudoterminal

I'm really new to Mac OSX and UNIX based systems. I wanted to run a few Windows games on my Mac Mini so I started installing Wine and MacPorts.

I think the installs are correct, but when I type sudo port install wine I see a not found error in my terminal. I tried other basic commands like say and clear and all of them return the same not found error.

My research shows that my PATH might be incorrectly set, but it lacks steps I can implement.

Specifically, I ran this command: echo $PATH and it returned:

/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin

I'm a complete newbie to mac and have no idea where .bash_profile or any of those files are. My skills let me install Xcode and the Command Line tools for Xcode and I sense I need to level up on path management.

At this point I need help managing my dot files and changing my path to fix these specific errors on Mountain Lion.

What are my next steps?

Best Answer

$PATH should contain these folders: /usr/bin:/usr/sbin:/bin:/sbin.

Try editing ~/.bash_profile, ~/.profile, or ~/.bash_login (with for example /usr/bin/open ~/.bash_profile -a TextEdit) and commenting out any lines that modify the path.

If that works, you can add a line like export PATH=/opt/local/bin:/opt/local/sbin:$PATH to ~/.bash_profile.