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 codelink - On Github click
Historybutton - 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 dotsand selectView file - Right-click
Rawbutton 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.
5 Comments
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's upgrade command as well as install.brew extract or brew create and brew tap-new to create a formula file in a tap on GitHub instead."The other answers are pretty heavy handed. Although the homebrew-cask-versions repo was deprecated in May 2024, casks pinned to a specific version are supported using the standard cask's token with a suffix of @ in the main homebrew cask repo.
To see if what version you're looking for is there, search for your cask with brew search --cask yourformula@ and look for @ signs in the displayed names.
For example, carbon-copy-cloner has multiple versions and displays as follows:
$ brew search --cask carbon-copy-cloner ==> Casks carbon-copy-cloner carbon-copy-cloner@5 carbon-copy-cloner@6 You can also go to https://formulae.brew.sh/cask/ and search for '@' using your in-browser search.
And if you don't find a cask that is pinned to the version you want, the Homebrew Cask Cookbook explains how to create a cask pinned to a specific version or a development channel such as @nightly. This isn't as hard as it looks - the cookbook and PR will mostly walk you though it :)
3 Comments
@ versions. Do I really have to write a custom formula to install an older version of the package? Isn't there a simple command line option that solves this?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
cee7983cd95fc92fdc250fc509f2379cefe647fein the example above.Git may give you instructions to view the file history locally - eg
git clone https://github.com/Homebrew/homebrew-cask.gitgit 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
1 Comment
wget followed by brew install --HEAD -s your-file.rb from here worked for me: dev.to/gjrdiesel/…