I use Selenium in Python, I tried to run the webdriver function:

default_browser = webdriver.Firefox()

This Exception:

WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

geckodriver in this site: https://github.com/mozilla/geckodriver

But how to install in Ubuntu 16.04 and can I fix this?

  • 2
    download , extract and add it to $PATH Jan 11, 2017 at 17:42
  • 2
    sudo apt-get install firefox-geckodriver Dec 6, 2019 at 14:02
  • 1
    @MisterVerleg You should add it as an answer. Ubuntu has a package unlike Debian.
    – baptx
    Nov 28, 2022 at 16:36
  • 1
    The firefox-geckodriver Ubuntu package no longer seems to be available as of Ubuntu 22.04: packages.ubuntu.com/impish/web/firefox-geckodriver Nov 29, 2022 at 0:52
  • 1
    @baptx I will thank you! Nov 29, 2022 at 8:29

6 Answers 6


Here are the steps:

  1. Go to the geckodriver releases page. Find the latest version of the driver for your platform and download it. For example:

    wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
  2. Extract the file with:

    tar -xvzf geckodriver*
  3. Make it executable:

    chmod +x geckodriver
  4. Add the driver to your PATH so other tools can find it:

    export PATH=$PATH:/path-to-extracted-file/.

There are many ways to do this that will work. The above works for me on Ubuntu 16.10 64-bit.

  • 104
    Step 4 can be changed to sudo mv geckodriver /usr/local/bin/ Jun 3, 2017 at 17:29
  • 3
    Thanks @TulioCasagrande. Step 4 did not work for me but your command did. Jun 5, 2017 at 19:10
  • 1
    There is firefoxdriver 3.8.0 package in Ubuntu Bionic, but it doesn't contain geckodriver, so doesn't work yet. The 2.x versions of these packages were able to launch Firefox, but weren't able to do anything.
    – Velkan
    Feb 8, 2018 at 13:00
  • 1
    I have done everything right but forgot to install Firefox :-) If that is the case just run: sudo apt-get install firefox Oct 12, 2018 at 22:46
  • 1
    Step 3 is redundant, we're downloading a gunzip not a zip file
    – lamino
    Dec 27, 2018 at 0:09

Manual steps to install geckodriver on Ubuntu:

  • visit https://github.com/mozilla/geckodriver/releases
  • download the latest version of "geckodriver-vX.XX.X-linux64.tar.gz"
  • unarchive the tarball (tar -xvzf geckodriver-vX.XX.X-linux64.tar.gz)
  • give executable permissions to geckodriver (chmod +x geckodriver)
  • move the geckodriver binary to /usr/local/bin or any location on your system PATH.

Script to install geckodriver on Ubuntu:



json=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest)
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("linux64") and endswith("gz"))')
curl -s -L "$url" | tar -xz
chmod +x geckodriver
sudo mv geckodriver "$INSTALL_DIR"
echo "installed geckodriver binary in $INSTALL_DIR"
  • 6
    I didn't go through - had my own script - but this kind of serious scripting, using jq and avoiding at most hardcoded things should always be upvoted.
    – ribamar
    Sep 4, 2018 at 12:50
  • 1
    I like how you have used jq in the script to get the target URL
    – NurShomik
    Oct 26, 2018 at 18:29
  • I installed it like this, thanks it works smoothly, then tested as a command, and that works. But then I run selenium in the python script, and it raises the same exception: selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
    – miguelfg
    Jan 25, 2019 at 18:45

Webdriver installation (silent mode) that can be used in sysadmin scripts (bash/ansible).

## Geckodriver
wget https://github.com/mozilla/geckodriver/releases/download/v0.23.0/geckodriver-v0.23.0-linux64.tar.gz
sudo sh -c 'tar -x geckodriver -zf geckodriver-v0.23.0-linux64.tar.gz -O > /usr/bin/geckodriver'
sudo chmod +x /usr/bin/geckodriver
rm geckodriver-v0.23.0-linux64.tar.gz

## Chromedriver
wget https://chromedriver.storage.googleapis.com/2.29/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo chmod +x chromedriver
sudo mv chromedriver /usr/bin/
rm chromedriver_linux64.zip
  • Thanks. It seems that geckodriver version 0.16.1 is compatible with FF 52.4.0 (on Debian jessie) – geckodriver version 0.19 was not. Mar 22, 2018 at 5:44
  • I prefer this over the fully automated script for my use case. First, it doesn't use jq which I don't have installed on my system. Second, it always installs a known version that I can test and verify works correctly for me.
    – poleguy
    Jul 6, 2021 at 12:41

On Ubuntu 22.04, it seems that geckodriver is now installed when you install Firefox:

$ sudo apt install firefox 

It seems that the old firefox-geckodriver package has been dropped.

  • Thank you, I added your comment to my answer, but saw you made your own answer as well. if you want me to remove it please say so! Nov 30, 2022 at 9:24
  • 1
    @MisterVerleg No problem at all. Let's leave both your answer and my answer up and let the sorting/ranking system take care of the rest. Seems like the easiest approach :) Nov 30, 2022 at 10:16

If you use the command line pre ubuntu 2.04:

sudo apt-get install firefox-geckodriver

Thanks to the comment of @countermeasure:

apparently installing firefox will also install gecko driver

sudo apt install firefox 
  • In fact this worked at the time but the package is no longer available on latest Ubuntu versions, as mentioned by @countermeasure in the question comments.
    – baptx
    Nov 29, 2022 at 22:04
  • 1
    On Ubuntu 22.04, it seems that sudo apt install firefox will also install geckodriver. I'm guessing that might be why the firefox-geckodriver package was dropped. Nov 30, 2022 at 8:54

There are essentially three steps:

  1. download a release from github
  2. unzip into the right directory, namely usr/local/bin (can be merged into one line!)
  3. set executable permissions. These steps should work for any Linux distribution (worked on my Debian 10). Here is the shell code:
wget https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz
sudo tar -xzvf geckodriver*tar.gz -C /usr/local/bin
sudo chmod +x /usr/local/bin/geckodriver

As for newest versions of Ubuntu, it can be installed with sudo apt-get install firefox. Older versions accept sudo apt-get install firefox-geckodriver.

Package firefox-geckodriver is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .