Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I modify a Homebrew formula?

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?

like image 791
maček Avatar asked Oct 15 '10 05:10

maček


People also ask

Where are brew formulas stored?

Packages are installed according to their formulae, which live in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula .

What is a homebrew formula?

Homebrew Formulae is an online package browser for Homebrew – the macOS (and Linux) package manager. For more information on how to install and use Homebrew see our homepage.

What is brew cleanup?

If you want to take your tidy-up routine to the next level, you can also run brew cleanup . This command removes downloads for outdated formulas and casks. ~ brew help cleanup Remove stale lock files and outdated downloads for all formulae and casks, and remove old versions of installed formulae.


1 Answers

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.

like image 135
Adam Vandenberg Avatar answered Oct 13 '22 06:10

Adam Vandenberg