How can I tell which homebrew formulae are upgradable? - homebrew

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.

Related

Warnings when running meld on Mac OS X Sierra

I've installed homebrew on my machine. Using brew I've installed meld. When I run it with git I get the following error:
Couldn't bind the translation domain. Some translations won't work.
'module' object has no attribute 'bindtextdomain'
2016-10-20 10:14:08.422 Python[22212:158273] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
(meld:22212): Gdk-WARNING **: GdkQuartzDisplay does not implement the monitor vfuncs
I don't understand how exactly brew works. In fact I never dug into its code, used it only to (un)install the software.
Did some online searches but there doesn't seem to be a solution to this. Has anyone figured it out?
Homebrew is simply a a package manager for MacOS. Unlike Linux, Mac doesn't always have all the external libraries you may need for things like wget, pip, etc out of the box. Homebrew tries to bridge this gap.
As for troubleshooting your issue, following Homebrew's troubleshooting steps helped me... You are probably just stuck in dependency hell, since Homebrew integrates alot of its libraries with Xcode (for me it was needing to update Xcode to latest): https://github.com/Homebrew/brew/blob/master/docs/Troubleshooting.md#troubleshooting
It's really important to keep thing up-to-date with brew update and then running brew doctor and brew prune resolved alot of issues for me as well.
If all else fails, homebrew seemed to have moved the meld formulae from homebrew/core to caskroom/cask. So I recall having to run the following command after running brew doctor and updating Xcode:
$ brew uninstall meld
$ brew install meld
Error: No available formula with the name "meld"
It was migrated from homebrew/core to caskroom/cask.
You can access it again by running:
brew tap caskroom/cask
$ brew tap caskroom/cask
$ brew cask install meld
==> Downloading https://github.com/yousseb/meld/releases/download/osx-9/meldmerge.dmg
######################################################################## 100.0%
==> Verifying checksum for Cask meld
==> Moving App 'Meld.app' to '/Applications/Meld.app'.
==> Linking Binary 'Meld' to '/usr/local/bin/meld'.
🍺 meld was successfully installed!

Homebrew updates and app self updates

How does homebrew/cask's updates work if the app auto updates itself.
Example: Chrome or Firefox
These two apps auto update themselves.
But what happens when you run a brew update?
Does it detect that it is already updated or does it check an internal list of apps it installed (misses that it is already updated) and reupdates the app>
brew cask upgrade is possible as of version 1.3.9
The Homebrew Cask repository is technically a Homebrew Tap.
This means:
It will pull down the latest Casks every time you issue the Homebrew command brew update
You can check for outdated Casks with brew cask outdated and install the outdated Casks with brew cask upgrade
Most importantly for this question, applications that update themselves include auto_updates true. This means that these casks are ignored by brew cask outdated and brew cask upgrade. This can be overridden by adding --greedy to the command.
See the Firefox cask as an example:
url "https://download-installer.cdn.mozilla.net/pub/firefox/releases/#{version}/mac/#{language}/Firefox%20#{version}.dmg"
appcast 'https://www.macupdater.net/cgi-bin/check_urls/check_url_redirect.cgi?url=https://download.mozilla.org/%3Fproduct=firefox-latest-ssl%26os=osx'
name 'Mozilla Firefox'
homepage 'https://www.mozilla.org/firefox/'
auto_updates true
Further reference is here.
Homebrew doesn't follow a new version of cask apps automatically, and you can leave such apps to their own auto updates as Homebrew intends to leave it to their own upgrade systems and e.g.
brew upgrade google-chrome
does nothing even when google-chrome has got a new update.
N.B. Now with Homebrew 2.5.5, brew cask was deprecated and integrated to the normal brew.
If you want to do for cask explicitly, you may want --cask
brew upgrade --cask google-chrome
but all the same basically.
Should you want to follow the latest version on your Homebrew proper, you can run such a command as
brew upgrade --greedy google-chrome
Also you can check a diff between the latest and your local with
brew upgrade --greedy --dry-run google-chrome
This way however is mostly for cask apps without their own upgrade systems and you don't need these commands for those with the upgrade systems as long as you're not concerned about your version numbers on Homebrew.
No. There is no brew cask upgrade.

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

multiple side-by-side versions with Homebrew?

Is it possible to install multiple versions side-by-side with Homebrew?
I find myself in a situation needing sbt-0.7.x, sbt-0.10.x and sbt-0.11.0. I've installed both sbt-0.7.7 and sbt-0.10.1 manually at the moment to work around the issue (with sbt-0.11.0 being the latest 'sbt' from Homebrew).
Yeah. When you install a new version of a package, it keeps the old one. The symlinks in /usr/local/bin or wherever point to the latest version, but you can still call the binaries (or link to the libraries) in the older version.
brew list to see what's installed. You can look in package directories to see all the versions; or call brew list --versions to see all packages and all versions.
To easily switch between versions of formulae, you can use:
brew switch <formula> <version>
For example:
brew switch gradle 3.2.1
To list which versions you have installed try:
brew list --versions
or:
brew list <formula> --versions
If you want to get rid of older versions, just use:
brew cleanup
As of Homebrew 2.0.0, it would remove old packages automatically when brew upgrade is called. (https://brew.sh/2019/02/02/homebrew-2.0.0/). To opt-out of this behavior, set the environment variable: export HOMEBREW_NO_INSTALL_CLEANUP=1

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