brew upgrade <package> does not update to the latest version - homebrew

I've noticed this happening a few times but this most recent instance is with wp-cli Running brew upgrade wp-cli does not download the latest version.
$ brew upgrade wp-cli
Error: homebrew/php/wp-cli 0.20.1 already installed
$ brew info wp-cli
homebrew/php/wp-cli: stable 0.20.1, HEAD
A set of command-line tools for managing WordPress installations.
http://wp-cli.org/
/usr/local/Cellar/wp-cli/0.20.1 (2635 files, 15M) *
Built from source
From: https://github.com/Homebrew/homebrew-php/blob/master/Formula/wp-cli.rb
Note the version is 0.20.1. When I check the formula repo, I see,
head "https://github.com/wp-cli/wp-cli.git"
When I check that repo, I see that the version in the master branch is 0.24.0. brew info and wp --version both return 0.20.1. Why isnt Homebrew grabbing the latest version? How do I force it to get the latest?

You'll need to run brew update first to force brew to update its list of formulae.

Related

Unable to Upgrade Dart SDK from 2.18.7 to 2.19.0 using Homebrew

I am trying to upgrade my Dart SDK from 2.18.7 to 2.19.0 using homebrew formula brew upgrade dart.
However, the command always returns the same result
Warning: dart-lang/dart/dart 2.18.7 already installed.
brew info dart command shows:
==> dart-lang/dart/dart: stable 2.18.7, HEAD
SDK
https://dart.dev
Conflicts with:
dart-beta (because dart-beta ships the same binaries)
/usr/local/Cellar/dart/2.18.7 (921 files, 497MB) *
Built from source on 2023-01-29 at 02:33:36
From: https://github.com/dart-lang/homebrew-dart/blob/HEAD/Formula/dart.rb
==> Options
--HEAD
Install HEAD version
==> Caveats
Please note the path to the Dart SDK:
/usr/local/opt/dart/libexec
I also have tried:
brew uinstall dart<br>
brew install dart<br>
brew upgrade dart
brew upgrade dart --devel --force
resulting `Error: invalid option: --devel`
Please, kindly suggest me any other solutions that could help.
The issue occurred as the homebrew formula for dart 2.18.7 is missing in the homebrew core formula commit history:
https://github.com/Homebrew/homebrew-core/commits/master/Formula/dart-sdk.rb
However, my dart version upgraded to 2.18.7 from 2.18.6 by an unintentional brew upgrade command resulting the issue.

how to upgrade dart to 2.10.2 in MacOS

Today(2020/10/27) I want to upgrade my dart to version 2.10.2, then I use this command:
~ ⌚ 9:58:16
$ brew upgrade dart
Warning: dart-lang/dart/dart 2.9.3 already installed
why could not upgrade to 2.10.2? must I install dart from sources?
You have to run the command brew update before you upgrade with brew upgrade. What the upgrade command does is refresh the list of packages, their versions, and where to download. In other words, it runs git pull for each tap you've tapped, and the core tap. It's also similar to sudo apt-get update on linux systems with apt. In short, just run brew update && brew upgrade dart and it should work. If that doesn't work for some people, it might be that you have to install from source to get this version, as the question pointed out.

Brew List and Install Specific Versions of Formula

I would like to install 2.6.X but cannot find documentation on how to specify a formula version. Brew is only installing the latest version of the formula.
I'm using the following versions of brew
Homebrew 1.8.6
Homebrew/homebrew-core (git revision 5ea559; last commit 2018-12-18)
Homebrew/homebrew-cask (git revision 4144b74; last commit 2018-12-18)
I'm upgrading from 2.2.1 and want to be pinned to 2.6.X
ls /usr/local/Cellar/ansible
2.2.1.0_2 2.3.1.0 2.7.5
brew search ansible
==> Formulae
ansible ✔ ansible-cmdb
ansible-lint ansible#1.9
ansible#2.0 terraform-provisioner-ansible
==> Casks
ansible-dk
brew install ansible
ansible --version
ansible 2.7.5
If someone could point me to the correct docs at https://docs.brew.sh/ to both list all available versions and to install specific versions that would be awesome.
Go to the directory containing formulas:
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
Look at the history of the ansible formula
git log -- ansible.rb
Select the commit where the version you are interested in is and checkout this formula:
git checkout f9466d14ee6e9fa7a -- ansible.rb
Install that formula:
HOMEBREW_NO_AUTO_UPDATE=1 brew install ansible
Check the installation of ansible:
ansible --version
Pin this version of the formula to avoid upgrade
brew pin ansible
That's it, an I'm not sure that this is in the documentation.

Homebrew does not upgrade pyenv

I'm trying to upgrade pyenv with homebrew for getting new Python releases.
Here is the problem:
$ brew upgrade pyenv
Error: pyenv 1.2.7 already installed
Is there a kind of update latency in homebrew package versioning? I am aware of the existence of other ways to install pyenv, but I'd like to use homebrew.
pyenv 1.2.8 is not yet officially released.
On the master branch the last tag is 1.2.7.
The commit you mentioned in your question is in preparation for release 1.2.8.
Version 1.2.7 is here https://github.com/pyenv/pyenv/tree/v1.2.7
Version 1.2.8 should be here https://github.com/pyenv/pyenv/tree/v1.2.8 but nothing is there (yet).
Verify which pyenv your system is using.
I thought I had this issue but then realized I had two different installs on my computer and my system was not actually using the brew installed pyenv --version.
Grepping my shell history, I saw that at some point I installed pyenv with curl using pyenv-installer for some reason. The command I found in my history was curl https://pyenv.run | bash. I followed the pyenv-installer directions to uninstall. Make sure to restart your shell once you uninstall!
I then reinstalled pyenv with brew. brew reinstall pyenv though I'm not sure if that's necessary.
I now see the newer versions of python available for install with pyenv install --list

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.

Resources