Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
/usr/local/bin:/usr/sbin:/usr/local/sbin:/usr/bin

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
        else
            local ansi=45
        fi
        if [[ "$git_status" =~ On\ branch\ ([^[:space:]]+) ]]; then
            branch=${BASH_REMATCH[1]}
            test "$branch" != master || branch=' '
        else
            # Detached HEAD.  (branch=HEAD is a faster alternative.)
            branch="(`git describe --all --contains --abbrev=4 HEAD 2> /dev/null ||
                echo HEAD`)"
        fi
        echo -n '\[\e[0;37;' "$ansi"';1m\]'"$branch"'\[\e[0m\] '
    fi
}
function _prompt_command() {
    PS1="\n `_git_prompt`"'\n \[\e[1;34m\]\w \$\[\e[0m\] '
}
PROMPT_COMMAND=_prompt_command
#export PS1='\n\[\033[1;33m\]\w\n\[\033[0m\]$(parse_git_branch)$ '
share|improve this question
add comment

1 Answer 1

up vote 7 down vote accepted

You're missing /bin also possibly /sbin.

user@host ~ $ which ls
/bin/ls
share|improve this answer
2  
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
2  
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
add comment

Your Answer

 
discard

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.