Is there a way to install a package and include all
--with* options instead of typing all of them individually at the CLI?
brew install ffmpeg --with-chromaprint --with-fdk-aac ...
Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.Visit Stack Exchange
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
Disclaimer: I'm not so familiar with grep. Smarter solutions are welcome.
You can list all options with this command.
brew options target_formula
And you can get all
--with-* options with this.
brew options target_formula | grep 'with-'
So you can install a formula with all
--with-* options by this.
brew install target_formula `brew options target_formula | grep 'with-'`
Note that some formula, especially in unofficial tap, can have old options not prefixed with
EDIT: If you want to exclude specific option, for example
--with-zimg, you can do that with this.
grep -v 'with-zimg' is fine, but
grep -v 'zimg' is shorter)
brew install target_formula `brew options target_formula | grep 'with-' | grep -v 'zimg'`
brew install ffmpeg "$(brew options ffmpeg | grep 'with-')", which threw a warning:
Warning: ffmpeg: this formula has no --with-chromaprint, followed by all of the remaining with- options, each on a new line. The last line read:
--with-zimg option so it will be ignored. ffmpeg was then installed without any of the with- options.
zimg: macOS El Capitan or newer is required. Error: An unsatisfied requirement failed this build.I then tried once more using "$()" and the same result as the first installation attempt occurred.
" ". This will squash all option into one option
--with-chromaprint --with-fdk-aac ..., which brew can't recognize properly.
--with-zimg. See the edited answer.
There is no wildcard-expansion mechanism for arguments in Homebrew, so the possibility to select all options, would depend on the implementation of each formula.
Looking at the
ffmpeg formula code, each option is handled individually, so it is not possible using the current version.
You would have to modify the formula removing the conditionals in lines like:
args << "--enable-chromaprint" if build.with? "chromaprint"
Or add a global switch for all arguments; or change the logic to install all by default and make the switches for disabling options.