Brew path didn’t cover sbin

homebrewpath

I have problem when I used brew to install aircrack-ng. I found out that it cover path

/usr/local/Cellar/aircrack-ng/1.1/bin

but it couldn't find commands after I tried tab-completion in path

/usr/local/Cellar/aircrack-ng/1.1/sbin

What should I do? Do I need to add another path?

Best Answer

The sbin directory, which some admin tools like dsniff and aircrack install to, is not on the path by default, and it's not in Homebrew's initial setup instructions, which tell you to get /usr/local/bin on your path. This is because, traditionally, sbin/ is for administrative tools that only root would expect to run.

Tab completion is picking up the files in /usr/local/Cellar/aircrack-ng/1.1/bin because they are symlinked in to /usr/local/bin, which is on your PATH. It does not find the files in /usr/local/Cellar/aircrack-ng/1.1/sbin, because they are symlinked in to /usr/local/sbin, which is not on your PATH. Your current working directory does not matter for tab-completion, because . (the current directory) is not on the PATH.

If you want to see those other programs on your path, where tab-completion can pick them up, add /usr/local/sbin to your PATH in the same place you added /usr/local/bin - probably your ~/.bashrc file.

In general, if you want to use tab-completion on programs in the current directory, you need to call them with a ./ prefix. For example, cd /usr/local/sbin and then type ./air and hit tab, and you'll get some choices.