It would be helpful if there was some easy way to remove flags when doing brew reinstall. One option could be done with negations, ie. if a formula was originally installed with --with-libfoo, then reinstalling --without-libfoo would remove that flag. A simpler option perhaps could be a --clear-flags argument for brew reinstall that would not carry over any flags from the previous build.
The motivation is pretty clear, a user may install a formula with flags, but later decide they no longer want some or all of the flags they initially used. brew uninstall --ignore-dependencies + brew install could be used as a workaround, but if that was good enough then why is there reinstall command?
Implementing the --clear-flags solution should just be as simple as adding the flag and an if statement somewhere around here by the looks of it. I'd do it myself but I don't know Ruby 馃槩
brew uninstall; brew install is the supported way of doing this. brew reinstall intentionally preserves flags.
Why bother creating and maintaining brew reinstall if you're just going to tell people to use brew uninstall; brew install? What if there are dependencies? What if uninstall succeeds but install fails?
I get that the flags are intentionally preserved, and that's fine, but being able to add but not remove flags seems like an incomplete feature to me.
Why bother creating and maintaining
brew reinstallif you're just going to tell people to usebrew uninstall; brew install?
Because most usage of brew reinstall does not require changing options.
What if there are dependencies?
They will be installed.
I get that the flags are intentionally preserved, and that's fine, but being able to add but not remove flags seems like an incomplete feature to me.
That's not documented behaviour so can be considered an implementation detail.
You can't add flags either AFAIK. And yes, I needed that too: brew reinstall --with-ghostscript imagemagick.
@revolter Last time I check that was possible. Perhaps it would work with this order: brew reinstall imagemagick --with-ghostscript?
@revolter brew reinstall was accepting those options (ex: --with-ghostscript) because it had no Option Parser in place. Since we added an Option Parser to reinstall via https://github.com/Homebrew/brew/pull/5274 , it will no-longer accept formula's options as it was not a documented feature.
@scribblemaniac Order of options doesn't matter.
@GauthamGoli, It wasn't documented, but it makes the most sense in the world. If you brew install --with-feature package, why wouldn't brew reinstall --with-feature package, that has 2 extra letters, work too? Why couldn't brew reinstall package uninstall and then install the package with the same options (representing a default/fallback behavior) and brew reinstall --with-feature package uninstall and then install the package with the specified options (representing an explicit intention)?
@revolter We'll agree to disagree.