The accepted answer was the first step, but more was needed for my formula edit to work in February 2023.
If you edit formula foo, but your change is ignored by brew reinstall --build-from-source foo then, add export HOMEBREW_NO_INSTALL_FROM_API=1 to your shell config. It makes Homebrew actually use your revised formula.
发布评论
评论(2)
删除现有版本。
编辑公式。
这将在编辑器中显示它;确保您的
$EDITOR
变量设置为您的首选项(对我来说:TextMate)更改它,保存它,尝试重新安装它。
因为大多数安装使用 pouring/bottles 来安装预编译的二进制文件,所以除非“从源代码构建”,否则您可能不会看到任何变化:
您可以使用
--formula /path/to/imagemagick.rb
作为上述命令的附加参数,以确保brew
正在安装已编辑的公式。如果您熟悉 git,您可能还想先创建一个分支,并在分支中进行编辑以防止数据丢失。
Remove the existing version.
Edit the formula.
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":
You can use
--formula /path/to/imagemagick.rb
as an additional argument to the above command to ensurebrew
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.
接受的答案是第一步,但我的公式编辑需要更多才能在 2023 年 2 月发挥作用。
如果您编辑公式 foo,但您的更改被
brew reinstall --build-from-source foo
忽略,则添加export HOMEBREW_NO_INSTALL_FROM_API=1
到你的 shell 配置。它使Homebrew真正使用您修改后的公式。详细信息: Homebrew 常见问题解答:编辑公式
另外,如果您想要修改后的公式保持不变,然后运行
brew pin foo
详细信息:Homebrew 常见问题解答:防止公式更新/升级
The accepted answer was the first step, but more was needed for my formula edit to work in February 2023.
If you edit formula foo, but your change is ignored by
brew reinstall --build-from-source foo
then, addexport HOMEBREW_NO_INSTALL_FROM_API=1
to your shell config. It makes Homebrew actually use your revised formula.Details: Homebrew FAQ: Edit Formula
Also, if you want your revised formula to persist, then run
brew pin foo
Details: Homebrew FAQ: Prevent Formula Update/Upgrade