I installed watchr on OS X (10.8.3) using gem install watchr
. And it's installed in /usr/bin/watchr
$ which watchr
/usr/bin/watchr
However, when I tried to call it $ watchr -v
, the system couldn't find it.
$ watchr -v
-bash: /usr/local/bin/watchr: No such file or directory
I think this is related to how the path is set up on my machine. My questions:
/usr/bin/
vs. /usr/local/bin/
?$ /usr/bin/watchr -e 'watch(./hello.txt) ...'
, are we looking at the hello.txt in the current directory or in /usr/bin/ i.e. the same directory as watchr?-- /usr/bin This is the primary directory for executable programs. Most programs executed by normal users which are not needed for booting or for repairing the system and which are not installed locally should be -- /usr/local/bin Binaries for programs local to the site.
/bin contains executable files that are part of the core operating system. These files need to be accessible before /usr gets mounted. (for instance, the mount command is in /bin/mount ). /usr/bin contains executable files that are not part of the core operating system.
In distributions like Ubuntu, /usr is where packages are supposed to install stuff and /usr/local is where the system administrator can install stuff outside the packaging system. From the Filesystem Hierarchy Standard: The /usr/local hierarchy is for use by the system administrator when installing software locally.
It's an abbreviation of “user related” and contains various read-only data, libraries, documentation, binaries, and other read-only software — all the things that apps on your Mac need to operate smoothly, but that users don't really ever need to see.
The path to your command was cached with a bad value. Try to update the cached directory that bash has stored for the path.
hash -d watchr
I found the answer over here which ctags shows /usr/local/bin/ctags but when I run ctags it runs /usr/bin/ctags. How is this possible?
Is /usr/local/bin/watchr a broken symlink? That 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 generally /usr/bin/ is meant for preinstalled programs, and package managers use something like /opt/local/bin/ or /usr/local/bin/.
I also have /usr/local/bin/ before other folders on the path, and I put most programs that I install or compile manually to /usr/local/bin/. I used to have a separate ~/bin/ folder, but it's easy to find non-Homebrew programs with something like find /usr/local/bin ! -lname '../Cellar/*'
.
Related questions about /usr/local/bin/ in general:
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”
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With