Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dancks

macrumors regular
Original poster
Nov 8, 2009
100
0
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?
 

ratsg

macrumors 6502
Dec 6, 2010
382
29
So is /usr/local/bin in your path?

This seems pretty obvious, am I missing something here?
 

chown33

Moderator
Staff member
Aug 9, 2009
10,747
8,420
A sea of green
Please post the exact command you gave that elicited the message:
Code:
-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:
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/bash.1.html
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):
Code:
type -P brew ; type -a brew
 

dancks

macrumors regular
Original poster
Nov 8, 2009
100
0
Code:
me:~me$ brew

is what caused the output in question.

the other stuff:

Code:
me:~me$ type -P brew; type -a brew
/usr/local/bin/brew
brew is /usr/local/bin/brew

Code:
me:~me$ echo $PATH
/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin:/usr/X11/bin
me:~me$

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.