ChromeDriverがMacのセキュリティのせいで開けない時の対処
久しぶりにローカルで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