How to allow executing Geckodriver and Chromedriver in Big Sur

Big Sur notification window for unsigned executables

In Big Sur macOS, Apple no longer allows executing binary files downloaded from the Internet without the correct signature. This leads to the following error in theselenium package:

selenium.common.exceptions.WebDriverException: Message: Service geckodriver unexpectedly exited. Status code was: -9

To make everything work as before. Run the following line in the terminal:

xattr -r -d /path/to/geckodriver

Don’t forget to add a symbolic link to the downloaded binary file:

ln -s /path/to/geckodriver /usr/local/bin/geckodriver

The same procedure works for Chromedriver