How to Install Chrome Driver on Mac

Hi, in this tutorial we will learn how to install chrome driver on Mac OS. It is very easy.

Step1: Download Chrome Driver

You need to go to the below address and download the chrome driver for Mac operating system based on (M1 or Intel chip versions).

Link: https://sites.google.com/a/chromium.org/chromedriver/downloads

chrome-driver-home-page

Download mac64_m1.zip if your mac has Apple Silicon M1 CPU otherwise select the mac64.zip version if your mac has Intel CPU.

select-chrome-driver-version

Step2: Move the driver to the /usr/local/bin folder

Now, we can move the driver to a path that is defined as a path in your system. You can check them with the below command and you will see that /usr/local/bin folder is defined as a global path on your system.

sudo nano /etc/paths

If you want you can add a specific path here and you can move the chromedriver to this folder but as you see, /usr/local/bin folder is defined as a path by default.

Now, go to your downloads folder, find the chromedriver_mac64.zip file, and unpack it. You will see the chromedriver executable file.

Now, we can run the below command and move the chromedriver file to the /usr/local/bin folder.

mv chromedriver /usr/local/bin

And now, you can define chrome driver as shown below in your tests and you can run your selenium tests by using Chrome driver.

WebDriver driver = new ChromeDriver();

If you face Error: “chromedriver” cannot be opened because the developer cannot be verified. Unable to launch the chrome browser, you need to go to usr/local/bin folder and right-click chromeDriver file and open it. After this step, re-run your tests, chrome driver will work.

Also, you can use Bonigarcia Webdriver Manager library in your project, for this you need to add its dependency in your project.

<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->  
<dependency>
  <groupId>io.github.bonigarcia</groupId>
  <artifactId>webdrivermanager</artifactId>
  <version>4.4.3</version>
</dependency>

Then you can simply use it as follows:

 WebDriverManager.chromedriver().setup();
 driver = new ChromeDriver();

For more complex usage please refer to the webdriver manager GitHub page and https://googlechromelabs.github.io/chrome-for-testing/

I hope this article helps you and thanks for reading. :) Please feel free to write your comments and questions. ;)

Thanks.
Onur

3 thoughts on “How to Install Chrome Driver on Mac”

  1. Hello. Don’t want to work with my mac os on M2 max, Sonoma.

    I have problem like:

    org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.
    (session not created: DevToolsActivePort file doesn’t exist)
    (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

    What should I do?

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.