106

I want to do a brew upgrade and tell homebrew do not upgrade the erlang formula since the latest one does not work on my system.

Is it possible do do something like homebrew upgrade --skip erlang?

1

4 Answers 4

188

I finally found an answer: since commit [85eb73ce][1] 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.

5
  • 33
    If you ask yourself one day what formulas you pinned: brew list --pinned
    – n1000
    Sep 29, 2016 at 17:49
  • 2
    Euh, what is the point of pinning if brew upgrade will still update the formula...? Mar 5, 2018 at 8:42
  • 2
    @SanderW.vanderLaan, if I understand correct, it excludes pinned formulas from cumulative upgrade in a group.
    – özüm
    Aug 7, 2018 at 6:43
  • 1
    This does not work for casks. Is there any alternative that would be analogous to brew pin caskName?
    – Mark Meuer
    Oct 22, 2021 at 18:27
  • 3
    The caveat in the answer is invalid. brew pin is a valid command.
    – Samwar
    Oct 14, 2022 at 1:30
51

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.

1
  • 4
    FWIW pin and unpin work in the current Homebrew version, 3.3.13.
    – ejain
    Feb 2, 2022 at 4:44
7

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
0
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.