Path, / usr / bin / and / usr / local / bin /

I installed watchr on OS X (10.8.3) using gem install watchr . And it is installed in / usr / bin / watchr

 $ which watchr /usr/bin/watchr 

However, when I tried to call it $ watchr -v , the system could not find it.

 $ watchr -v -bash: /usr/local/bin/watchr: No such file or directory 

I think this is due to the way the path is configured on my machine. My questions:

  • What is the correct way to fix it?
  • In general, which programs should go to /usr/bin/ vs. /usr/local/bin/ ?
  • When I do this, for example. $ /usr/bin/watchr -e 'watch(./hello.txt) ...' , are we looking at hello.txt in the current directory or in / usr / bin / ie in the same directory as watchr?
+4
source share
3 answers

The path to your command has been cached with a bad value. Try updating the cached directory that bash saved for the path.

 hash -d watchr 

I found an answer here that shows ctags / usr / local / bin / ctags, but when I run ctags, it runs / usr / bin / ctags. How is this possible?

+10
source

Is / usr / local / bin / watchr a broken symlink? This would make which watchr not include it, but watchr would print this error:

 -bash: /usr/local/bin/watchr: No such file or directory 

I don’t know why the gem that comes with OS X installs programs in / usr / bin /, but usually / usr / bin / is for preinstalled programs, and package managers use something like / opt / local / bin / or / usr / local / bin /.

I also have / usr / local / bin / in front of other folders on the path, and I put most of the programs that I install or compile manually in / usr / local / bin /. I used to have a separate folder ~ / bin /, but it was easy to find programs other than Homebrew, with something like find /usr/local/bin ! -lname '../Cellar/*' find /usr/local/bin ! -lname '../Cellar/*' .

Related questions about / usr / local / bin / in general:

+2
source

create a file called .profile in your home directory and add the following line. export PATH = "/ usr / local / bin: / usr / local / sbin: / usr / bin: $ PATH"

0
source

All Articles