How to update chromedriver to the latest version on MacOS using homebrew?

Viewed 32997

My current version is 81.0.4044.69 and I want to update to the latest version 83.0.4103.39

When I open Terminal and I do: brew cask install chromedriver

It says: Warning: Cask 'chromedriver' is already installed.

How can I update to the latest version 83.0.4103.39?

6 Answers

UPDATE: Now you can also do:

brew update
brew upgrade chromedriver

or

brew update
brew upgrade --cask chromedriver

Also be aware that after each upgrade you will get again a system warning when using the chromedriver for the first time so you need to click Cancel in the warning and then go to "Preferences => Security & Privacy" and click "Allow Anyway" to accept the risk. Then on the next run, you'll have to click "Open" once.


Note: The answer below was given for an older version and may not work anymore


I found out that I should do:

brew update
brew cask upgrade chromedriver

Another option is to uninstall and install it again like this:

brew cask uninstall chromedriver
==> Uninstalling Cask chromedriver
==> Unlinking Binary '/usr/local/bin/chromedriver'.
==> Purging files for version 81.0.4044.69 of Cask chromedriver

brew cask install chromedriver
==> Downloading https://chromedriver.storage.googleapis.com/83.0.4103.39/chromedriver_mac64.zip
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'chromedriver'.
==> Installing Cask chromedriver
==> Linking Binary 'chromedriver' to '/usr/local/bin/chromedriver'.
  chromedriver was successfully installed!

Now:

chromedriver --version
ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416})

I would recommend start using webdriver-manager:

pip install webdriver-manager

what I prefer mostly and use it like:

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())

with that package you should not worry about version of chromedriver, even though, you can even choose particular chrome driver version:

driver = webdriver.Chrome(ChromeDriverManager(version='86.0.4240.22').install())

it is not the solution of the ticket, but it makes live easier working with chromedriver

Now its just brew upgrade chromedriver no longer cask

Uninstalling & installing the chromedriver worked -

brew uninstall chromedriver
brew install --cask chromedriver

When I initially ran the following commands,

brew upgrade chromedriver 
brew upgrade --cask chromedriver 
brew uninstall chromedriver

I got the error below.

Error: Cask 'chromedriver' is not installed.

So I had to remove the chromedriver not managed by Homebrew first.

rm `which chromedriver` 

After that, brew install chromedriver successfully installed the latest version.

I have recently have issues where I would receive a warning about chromedriver's developer not being trusted. To resolve this I use brew info chromedriver which gives the directory for chromedriver. Change into that directory and type ls -l and if the code like drwxr-xr-x has an @ at the end, that means your mac has quarantined that file. To pull it out of quarantine, type xattr -d com.apple.quarantine chromedriver. Then you should be good to go.

Related