How do I specify a version number when installing something with brew cask install
?
4 Answers
For recent versions of Homebrew, Jethro' instructions below may not work work, because we will get an error like:
Invalid usage: Non-checksummed download of <FORMULA_NAME> formula file from an arbitrary URL is unsupported.
I found a workaround:
- Go to the Homebrew Cask search page: https://formulae.brew.sh/cask/
- Type and find the application you are looking for
- Click
Cask code
link - On Github click
History
button - Find the version you need by reading the commit messages and view the raw file. Confirm the version variable (normally on line 2) is the version you need.
- Click on the
name of the commit
, thenthree dots
and selectView file
- Right-click
Raw
button andSave Link As...
to download the file locally - When downloaded, go to download directory
cd Downloads/
- Finally run
brew install --cask <FORMULA_NAME>.rb
- Voilà 😄
If you need some visual assistance check the screenshots here.
-
I was going to suggest using the file's URL instead of downloading it. Then I realized it was basically the same thing as @jethro's solution, which is apparently problematic for some people. It worked for me, though. I was able to install dbeaver-community v. 22.3.5, using the command:
brew install --cask https://raw.githubusercontent.com/Homebrew/homebrew-cask/26c51fdcd344f1b08b56aed88dafdac660236df8/Casks/dbeaver-community.rb
. Note that getting specific versions of casks works with Homebrew'supgrade
command as well asinstall
. 3 hours ago
You can manually point brew at the ruby file for a specific version of a cask, using a git hash. This lets you control which version is installed.
For example:
- Find the cask .rb file on the homebrew-cask git repo that you want.
Get the commit hash, eg
cee7983cd95fc92fdc250fc509f2379cefe647fe
in the example above.Git may give you instructions to view the file history locally - eg
git clone https://github.com/Homebrew/homebrew-cask.git
git log master -- Casks/CASK_NAME.rb
- Point brew at the file using the hash:
brew cask install https://raw.githubusercontent.com/caskroom/homebrew-cask/cee7983cd95fc92fdc250fc509f2379cefe647fe/Casks/minikube.rb
-
4Trying the above, I get "Error: Calling Non-checksummed download of curl formula file from an arbitrary URL is disabled!". The suggestion to use
wget
followed bybrew install --HEAD -s your-file.rb
from here worked for me: dev.to/gjrdiesel/…– Peter WDec 30, 2021 at 21:32
The other answers are pretty heavy handed, an alternative is to use the homebrew/cask-versions tap which contains a list of the old (major) versions of casks.
To use them tap it with brew tap homebrew/cask-versions
and then you can search for your cask again like brew search --cask yourformula
and see if what you're looking for is there.
Or you can see the complete list of casks by clicking on Casks folder at https://github.com/Homebrew/homebrew-cask-versions .
If you run
brew edit [formula]
you can change the version that matches your operating system. If you know the checksum, enter that too. If not, just comment that line out with #
and it will skip the check. Then run
HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall [formula]