bash not finding program

Discussion in 'Mac Programming' started by dancks, Nov 20, 2013.

  1. dancks macrumors regular


    Nov 8, 2009
    I know that in order to find to program either the proper path or the path needs to be a part of the $PATH variable.

    I'm trying to set up homebrew. its in /usr/local/bin because it refuses to run in /usr/bin for some reason. Thing is unless I specify /usr/local/bin/brew it will give me:

    -bash: /usr/bin/brew: No such file or directory

    Why does this happen?

    Does the fact that I set it up (and then removed from) /usr/bin make a difference? why? if it doesn't look through every specified path in $PATH, then what is $PATH for?
  2. ratsg macrumors 6502

    Dec 6, 2010
    So is /usr/local/bin in your path?

    This seems pretty obvious, am I missing something here?
  3. dancks thread starter macrumors regular


    Nov 8, 2009
    Yes it is. Thats why I was confused.
  4. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    Please post the exact command you gave that elicited the message:
    -bash: /usr/bin/brew: No such file or directory
    Also post the exact value of PATH at the time you gave the command.

    If there used to be a command 'brew' located in /usr/bin, and you removed it, but haven't started a new shell, then bash probably thinks that /usr/bin/brew still exists, because bash hashes the directories listed in PATH. That is, bash scans the directories in PATH, builds an internal hashtable, then looks up command-names in the hashtable expecting to quickly discover which directory to run the command from.

    See here:
    then find the word hash on that page.

    You can tell bash to rehash the directories in PATH (see hash under SHELL BUILTIN COMMANDS at the above link).

    Enter this command, and post the complete output (if any):
    type -P brew ; type -a brew
  5. dancks thread starter macrumors regular


    Nov 8, 2009
    me:~me$ brew
    is what caused the output in question.

    the other stuff:

    me:~me$ type -P brew; type -a brew
    brew is /usr/local/bin/brew
    me:~me$ echo $PATH
    You were right about the shell hash thing. Thanks. Now if I could only find a way to update X11 library on 10.6 I'll be golden.

Share This Page