you can use
brew ls --versions myformula
to display installed versions of the corresponding formula. If the formula is not set, the output will be empty.
When using the latest versions of homebrew, which you can get with brew update , you can simply run this (thanks Slaven):
if brew ls --versions myformula > /dev/null; then
However, it is probably a good idea to check for a tool at all, and not just check the corresponding homebrew package (for example, by searching for an executable in $PATH ). People tend to install tools in a fairly large number of ways in practice, and homegrown is just one of them.
Holger Just Dec 27 '13 at 14:31 2013-12-27 14:31
source share