升级啤酒时忽略公式

我想做一个 brew upgrade和告诉自制不升级的 erlang公式,因为最新的一个不工作在我的系统。

有没有可能做一些像 homebrew upgrade --skip erlang这样的事情?

16478 次浏览

You could upgrade erlang to the latest version but keep using the older working version with the brew commands versions and switch.

To list available versions use:

brew versions erlang

To switch between two installed versions (I'll presume you wanted erlang R14):

brew switch erlang R14B04

i had a similar 'problem'. i installed libfreenect (unstable) directly on my system. and now i dont want homebrew to upgrade it. i solved it by deleting following file:

/usr/local/Library/Formula/libfreenect.rb

analogous it would be /usr/local/Library/Formula/erlang.rb for you

I finally found an answer: since commit 85eb73ce there is a pin subcommand available. So ignoring a formula on brew upgrade is as simple as pinning it via brew pin <formula>. To un-pin it, simply invoke brew unpin <formula>.

It is worth noting that brew upgrade <formula> will still update the formula regardless of whether or not it is pinned.

Caveat: This answer is no longer valid for recent versions of Homebrew, since brew pin has been removed.

brew pin is the way to go. It will pin the formula to the current version

brew pin <formula>

brew unpin can be used to reset this

brew unpin <formula>

To view all pinned formulae

brew list --pinned

Note: brew upgrade will not upgrade pinned formulae.