iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🍺

How to install a specific version with Homebrew Cask

に公開

Let's consider an example where we want to install Vagrant 2.2.13.

First, access the following link:

https://github.com/Homebrew/homebrew-cask/commits/master/Casks/${APP_NAME}.rb

For this specific case, it would be:

https://github.com/Homebrew/homebrew-cask/commits/master/Casks/vagrant.rb

Once you find the commit for the corresponding update, click the button on the right to copy the hash.

Replace the ${HASH} part of the following link with the hash you just copied:

https://raw.githubusercontent.com/Homebrew/homebrew-cask/${HASH}/Casks/${APP_NAME}.rb

In this example, it is:

https://raw.githubusercontent.com/Homebrew/homebrew-cask/eb82c58133c25fcd108c3c5d541606b4873db69b/Casks/vagrant.rb

This URL points to the actual file required to install the specific version.

For Homebrew versions prior to 2.6, you can install it using:

brew cask install [URL_FROM_ABOVE]

For Homebrew 2.7 or later, since the cask option has been deprecated, you need to download it locally first as follows:

curl -L [URL_FROM_ABOVE] > tmp.rb
brew install tmp.rb
rm tmp.rb

you need to download it locally once, like this:

Discussion