How do I modify a Homebrew formula?

CompilationImagemagickPackageHomebrew

Compilation Problem Overview


I installed ImageMagick via Homebrew.

However, due to a bug I have with my current configuration, I need to adjust the compile flags for the formula and reinstall it.

How can I accomplish this?

Compilation Solutions


Solution 1 - Compilation

Remove the existing version.

$ brew rm imagemagick

Edit the formula.

$ brew edit imagemagick

This will bring it up in an editor; make sure your $EDITOR variable is set to your preference (for me: TextMate)

Change it, save it, try re-installing it.

Because most installs use pouring/bottles to install a precompiled binary, you will likely see no change unless you "build from source":

$ brew reinstall --build-from-source [...]

You can use --formula /path/to/imagemagick.rb as an additional argument to the above command to ensure brew is installing the formula that was edited.

If you're comfortable with git, you may also want to make a branch first, and do your edits in a branch to guard against data loss.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmačekView Question on Stackoverflow
Solution 1 - CompilationAdam VandenbergView Answer on Stackoverflow