4

I want to install chromedriver version 79.0.3945.36 with brew. When I try to run

 brew cask install chromedriver@79.0.3945.36

It fails saying chromedriver@79.0.3945.36 is unavailable: No Cask with this name exists.

Tim Givois
  • 1,926
  • 2
  • 19
  • 36

4 Answers4

8

I did a quick check, did not find cask formula has versioned ones.

The hack way of installing a old version of cask formula would be:

  • cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask, go the place where cask is referenced
  • git reset --hard c3c1b84b7a, this would effective set chromedriver to v79.0.3945.36
  • git checkout -b temp, checkout a new branch, which prevents brew auto-refresh your local master
  • brew install --cask chromedriver, this would install your desired version.

After that you can always do git checkout master and brew up to keep in sync with the latest master of homebrew-cask.

here is my installation log

==> Downloading https://chromedriver.storage.googleapis.com/79.0.3945.36/chromedriver_mac64.zip
Already downloaded: /Users/rchen/Library/Caches/Homebrew/downloads/2712e559b7e0712e196b123a7581adecc2cfdc8d8d728b01fd875b3d371e5d29--chromedriver_mac64.zip
==> Verifying SHA-256 checksum for Cask 'chromedriver'.
==> Installing Cask chromedriver
==> Linking Binary 'chromedriver' to '/usr/local/bin/chromedriver'.
  chromedriver was successfully installed!

test log:

$ chromedriver --version
ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945@{#614})
gkiely
  • 2,987
  • 1
  • 23
  • 37
chenrui
  • 8,910
  • 3
  • 33
  • 43
7

To build on @chenrui's answer, this is how I did it on an M1 mac (downgrade from 93 to 92). This should work on Intel too (via brew --prefix).

# Get commit which upgraded
cd "$(brew --prefix)/Library/Taps/homebrew/homebrew-cask/Casks"
git log chromedriver.rb

# Revert commit(s) which upgraded, eg ed35867f216512c9840756dce57e61f8eac26bb6
git revert ed35867f216512c9840756dce57e61f8eac26bb6

# Reinstall
brew reinstall chromedriver

# Pin version
brew pin chromedriver

# Resolve error: "chromedriver" cannot be opened because the developer cannot be verified.
xattr -d com.apple.quarantine "$(which chromedriver)"

# Later, when version no longer needs to be pinned
brew unpin chromedriver
Zubin
  • 9,422
  • 7
  • 48
  • 52
  • I believe due to a recent change, there is no longer a `$(brew --prefix)/Library/Taps/homebrew/homebrew-cask/Casks` folder. Does anyone know where it has moved to? – MivaScott Aug 07 '23 at 09:59
3

I tried below and it worked!

  1. Go to /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks and edit the file named chromedriver.rb\
  2. Update the required version of chromedriver in the 2nd line

(see - https://sites.google.com/chromium.org/driver/downloads for required version number)

  1. From your terminal, run brew reinstall chromedriver
  2. You will get error message stating the SHA is mismatching with expected and actual values. Copy the actual value from your terminal and replace it in chromedriver.rb file

(Note: you may need to delete the downloaded chromedriver.zip file, follow the instruction/path location mentioned in the error message of your terminal to delete the file and then proceed to next step)

  1. Run again brew reinstall chromedriver
Bhuvanesh Mani
  • 1,394
  • 14
  • 23
0

To add to @chenrui's and @zubin's solution, remember to

export HOMEBREW_NO_INSTALL_FROM_API=1

or brew will default to taking the latest chromedriver from the API.

SigmaGamma
  • 19
  • 5