Using Homebrew

Posted by Thoughts and Ramblings on Saturday, July 12, 2014

I’ve been using the mac long enough that I’ve gone through several of the package management systems for installing additional open source tools. I started off with Fink which I really liked since it was based on dpkg. Then it became clear that the community had switched to using Mac Ports (formerly Darwin Ports). I was a bit disappointed with this because the package management wasn’t as good as it was with Fink, but it kept pace with the newer OSs better than Fink. Now the community has shifted again, this time to Homebrew. Homebrew seems to have learned a lot of lessons from the previous. The most notable is that most of the Formulas are in binaries and they use git for the formula list rather than rsync for the port list. Also anyone wanting to make a formula would fork the repo on github, commit their formula, and initiate a pull request. Given this adds simplicity on the developers, hopefully homebrew will last longer than the others.

There is one thing that was severely annoying me which prompted me to write this post. I had installed the bash formula, which upgrades bash to 4.3 and also installed bash-completion. When using the newer bash, I discovered the tab completion was not working correctly. For example, if I typed cd Libr<TAB>ap<TAB> it would complete to Library/Application\ S, but would be entirely incapable of completing anything following the space. Even if I finished the directory name manually, it would never complete anything beyond that point. This behavior seemed to be limited mostly to cd, but it was still annoying. Anyway, there is a solution:

brew tap homebrew/versions
brew uninstall bash-completion
brew install bash-completion2

Basically, bash-completion2 is for bash 4, where as 1 is for bash 3. Be sure to follow the instructions at the end of the install otherwise it won’t work at all.

P.S. I had previously run the following to gain case-insensitive tab completion in bash:

echo "set completion-ignore-case on" >> ~/.inputrc

Legacy Comments:

Graham Booker - Aug 2, 2014

Update. It seems that bash-completion2 and the bash 4 that comes with homebrew are broken in the manner described in the post. My only solution thus far is to use bash-completion and use the bash that comes with the OS.