Server Fault is a question and answer site for system and network administrators. 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 am on Mac OSX Lion, and somehow in installing mysql and postgres the export PATH line on my .bash_profile got messed up or removed.

So I added in this in an empty .bash_profile:

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

But I can't get any bash commands to execute:

 /usr/bin $ ls
-bash: ls: command not found

 /usr/bin $ /bin/echo $PATH

My .bashrc is probably but not relevant, but in case:

[[ -s "/Users/jer/.rvm/scripts/rvm" ]] && source "/Users/jer/.rvm/scripts/rvm"

function _git_prompt() {
    local git_status="`git status -unormal 2>&1`"
    if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then
        if [[ "$git_status" =~ nothing\ to\ commit ]]; then
            local ansi=42
        elif [[ "$git_status" =~ nothing\ added\ to\ commit\ but\ untracked\ files\ present ]]; then
            local ansi=43
            local ansi=45
        if [[ "$git_status" =~ On\ branch\ ([^[:space:]]+) ]]; then
            test "$branch" != master || branch=' '
            # Detached HEAD.  (branch=HEAD is a faster alternative.)
            branch="(`git describe --all --contains --abbrev=4 HEAD 2> /dev/null ||
                echo HEAD`)"
        echo -n '\[\e[0;37;' "$ansi"';1m\]'"$branch"'\[\e[0m\] '
function _prompt_command() {
    PS1="\n `_git_prompt`"'\n \[\e[1;34m\]\w \$\[\e[0m\] '
#export PS1='\n\[\033[1;33m\]\w\n\[\033[0m\]$(parse_git_branch)$ '
share|improve this question
up vote 7 down vote accepted

You're missing /bin also possibly /sbin.

user@host ~ $ which ls
share|improve this answer
To elaborate a bit more, your PATH should normally contain: /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin, followed by any other places you want searched. (The order listed is my preferred order. I've also seen all the bin paths listed before the sbin paths, which I don't mind either.) – voretaq7 Feb 14 '12 at 18:37
And to elaborate further, this is the default PATH on Lion: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin – James O'Gorman Feb 14 '12 at 19:01

Your Answer


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.