久しぶりにローカルでSeleniumを使おうと思ったらchromedriverを新しいMacに入れてなかったのでこんなエラーが出た。

Selenium::WebDriver::Error::WebDriverError: Unable to find chromedriver. Please download the server from
https://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH.
More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver.
from /Users/ironsand/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/selenium-webdriver-3.142.7/lib/selenium/webdriver/common/service.rb:136:in `binary_path'

指示通りバイナリを落としてきてPathに追加しても良かったけど面倒くさいのでbrewで入れた。

brew cask install chromedriver

インストールは出来たけど、今度はCatalinaのセキュリティに引っかかったらしく起動しない。 普段は設定のSecurity & Privacyを見れば開けるんだけど、そこにすら上がってなかった。

“chromedriver” cannot be opened because the developer cannot be verified". “macOS cannot verify that this app is free from malware.

解決策

xattr コマンドでAppleさんに安全だと教えてあげれば使えるようになった。

 xattr -d com.apple.quarantine chromedriver

参考

https://stackoverflow.com/questions/60362018/macos-catalinav-10-15-3-error-chromedriver-cannot-be-opened-because-the-de