How to prevent homebrew from upgrading a package? - homebrew

I'm wondering if there's any means to prevent Homebrew from upgrading a particular package ? Yesterday I went for a brew upgrade which updated the lua package from 5.1 to 5.2. It broke one of the projects I'm working on those days so I had to downgrade the lua package today when I noticed it.
I'd like this not to happen again, and I guess Homebrew must provide this kind of feature, but I didn't find anything about it in the documentation. Do you have any clue ?

brew pin someformula.
There is also a lua51 formula now.

brew pin formula works well, but it's not possible to pin casks.
I need to prevent upgrade of a particular cask, so I use a filter to ignore that cask when upgrading:
brew update
brew upgrade --cask `brew outdated --cask | awk '{print $1}' | grep -v cask-to-skip`

To complete the story, for my case using opencv as an example, it means that
brew -v edit opencv3
brew -v fetch --deps opencv3
brew -v install --build-from-source opencv3
brew pin opencv3

Related

Why can't brew find a specific known formula?

I'm trying to install bazel on my mac (10.11.5).
I can see that it is available through brew:
http://braumeister.org/formula/bazel
But when I run "brew install bazel", I get this:
Error: No available formula for bazel
Searching formulae...
Searching taps...
Why is this?
In my case, Homebrew was already up-to-date after running brew update and I still received the same error messages as the OP when trying to install xdebug:
$ brew update
Already up-to-date.
$ brew install php70-xdebug
Error: No available formula with the name "php70-xdebug"
Using Mark's suggestion from the comments on OP solved the problem:
$ brew search xdebug
homebrew/php/xdebug-osx homebrew/php/php70-xdebug
So now, running $ brew install homebrew/php/php70-xdebug, Homebrew found and installed the package.
You should update your brews, because it is indeed available. Run
brew update
brew install bazel
and then it should work.

Error installing CouchDB with homebrew osx 10.8 - skip dependency?

So I tried to install it according to the directions on couchdb wiki. and I get the following issue
Installing couchdb dependency: erlang-r15
==> Downloading https://github.com/erlang/otp/archive/OTP_R15B03-1.tar.gz
Already downloaded: /Library/Caches/Homebrew/erlang-r15-R15B03-1.tar.gz
Error: SHA1 mismatch
Expected: 5ba866722de79956b06966c232490d32bb7ba0a6
Actual: 7843070f5d325f95ef13022fc416b22b6b14120d
Archive: /Library/Caches/Homebrew/erlang-r15-R15B03-1.tar.gz
Is there anyway to tell brew to skip this dependency since I have already installed the correct version of erlang, and it can't see it?
Did you try brew uninstall couchdb and re install after?
I had the same issue, it fixed it for me
So to get this working I followed the instruction on the couchdb until the install couchdb command:
brew remove --force openssl erlang couchdb icu4c spidermonkey nspr
brew update
brew outdated
brew rm --force erlang
cd /usr/local
git checkout 168742f Library/Formula/erlang.rb
brew install erlang
since I knew I had the right erlang installed I altered the Bew formula to make it work correctly.
So I headed over to the formula at
vim /usr/local/Library/Formula/couchdb.rb
And altered the dependency line
depends_on 'erlang-15'
to
depends_on 'erlang'
and works great now!!
None of the solutions here worked for me, but the below did. Note, I had to build with unixodbc.
brew remove --force openssl erlang couchdb icu4c spidermonkey
brew update
brew install unixodbc
brew install homebrew/versions/erlang-r15 --with-unixodbc
# edit /usr/local/Library/Formula/couchdb.rb to change depends_on to 'erlang-r15'
brew install couchdb
You may want to first try force removing only erlang and couchdb -- as someone in this thread mentioned that force removing packages messed up his system (though I did not encounter this problem when running the above instructions).

How can I tell which homebrew formulae are upgradable?

I know when I brew update, it lists all ==> Updated Formulae, but when I've updated several times without running brew upgrade, how do I get a list of all apps that could be upgraded?
Per homebrew code on github, this shows all apps that can be updated:
brew outdated
brew help does not list the command, but it is documented in man brew.
Since Homebrew 2.6.0 released in 2020.12.01, brew outdated behaves a little differently.
# update package repo
brew update
# list outdated pkgs, both formula and cask
brew outdated
# list formula only, the old behavior of
# `brew outdated` before brew 2.6.0
brew outdated --formula
# list cask only
brew outdated --cask
In Homebrew's jargon, a package is called a "Formula". Homebrew is not only manages TUI apps, it's also capable of managing GUI apps. A package for a GUI app is known as "Cask".
Before Homebrew 2.6.0, brew outdated only list formulae. Since 2.6.0 brew outdated both of formulae and casks.

Ignore formula on brew upgrade

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?
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.
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

How do I update a formula with Homebrew?

How do I update a formula?
I ran brew update. However, mongodb is still outdated according to brew outdated:
mongodb (1.4.3-x86_64 < 1.6.5-x86_64)
First, update brew's internal list of formulae to the latest:
brew update
To upgrade only the mongodb formula, use install:
brew install mongodb
To upgrade all outdated formulae:
brew upgrade
You can update all outdated packages like so:
brew install `brew outdated`
or
brew outdated | xargs brew install
or
brew upgrade
This is from the brew site..
for upgrading individual formula:
brew install formula-name && brew cleanup formula-name
You will first need to update the local formulas by doing
brew update
and then upgrade the package by doing
brew upgrade formula-name
An example would be if i wanted to upgrade mongodb, i would do something like this, assuming mongodb was already installed :
brew update && brew upgrade mongodb && brew cleanup mongodb
Well, I just did
brew install mongodb
and followed the instructions that were output to the STDOUT after it finished installing, and that seems to have worked just fine. I guess it kinda works just like make install and overwrites (upgrades) a previous install.
You can't use brew install to upgrade an installed formula. If you want upgrade all of outdated formulas, you can use the command below.
brew outdated | xargs brew upgrade
I prefer to upgrade all homebrew formulae and homebrew cask formulae.
I added a Bourne shell function to my environment for this one (I load a .bashrc)
function updatebrew() {
set -x;
brew update;
brew cleanup;
brew cask upgrade --greedy
)
}
set -x for transparency: So that the terminal outputs whatever Homebrew is doing in the background.
brew update to update homebrew formulas
brew cleanup to remove any change left over after installations
brew cask upgrade --greedy will install all casks; both those with versioning information and those without

Resources