Apple - Determine flags that were given for packages installed with homebrew

When a package is built from source the flags that were used to build are shown when you do brew info <package>.

In this case: brew info emacs | grep "Built from source"


There is a file in /usr/local/Cellar underneath each package that is called INSTALL_RECEIPT.json, e.g. for gawk:

/usr/local/Cellar/gawk/4.1.3/INSTALL_RECEIPT.json

that defines how the package was installed. I think the correct way to access it is with

brew info --json=v1 <packagename>

e.g.

brew info --json=v1 gnuplot

That spews out loads of stuff, but if you send it through jq (JSON Processor - handily available via homebrew) you can select out the options you used to install the package like this (checking the gnuplot package):

brew info --json=v1 gnuplot | jq '.[].installed[0].used_options'
[
    "--with-qt"
]

which tells me I installed gnuplot using:

brew install --with-qt gnuplot 

Another useful tool is homebrew-bundler. Once installed via brew tap Homebrew/bundle, you can run brew bundle dump and it will create a Brewfile file that lists all of the packages you have installed along with any additional args used to install them.

Tags:

Homebrew