User Agents

Web browsers and everyday web tech, explained

How to Clean Uninstall and Reinstall Firefox in Ubuntu

· 4 min read · Browsers

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

This guide walks you through completely removing Firefox from Ubuntu (including its profile data and configuration files) and then installing a fresh copy. This is useful if Firefox is misbehaving, corrupted, or you simply want a clean slate. You'll need sudo access to your Ubuntu system and an internet connection.

What You'll Need

  • A user account with sudo privileges
  • Internet connection (for downloading the new Firefox)
  • Terminal access (Ctrl+Alt+T)

Step-by-Step

  1. Back up your Firefox data (optional but recommended). If you have bookmarks, passwords, or other data you want to keep, back up your profile folder. The default location is ~/.mozilla/firefox/. Copy the entire folder to an external drive or a safe location: cp -r ~/.mozilla/firefox /path/to/backup/
  2. Close Firefox completely. Ensure no Firefox processes are running: pkill firefox
  3. Remove Firefox using apt. If Firefox was installed via the Ubuntu repository (the default), run: sudo apt purge firefox This removes the application and its configuration files (though not your profile, which is in your home directory).
  4. Remove any leftover dependencies. Run sudo apt autoremove to clean up unused packages that were installed as dependencies.
  5. Delete the Firefox profile folder. Even after purge, your personal data (bookmarks, passwords, cookies) remains in ~/.mozilla/firefox/. To completely remove it, delete this folder: rm -rf ~/.mozilla/firefox (Be absolutely sure you backed up first!)
  6. Check for other Firefox installations. If you installed Firefox via Snap or Flatpak, remove those as well. For Snap: sudo snap remove firefox For Flatpak: flatpak uninstall org.mozilla.firefox
  7. Verify removal. Run which firefox – it should return nothing. Also check snap list and flatpak list to confirm no Firefox entries remain.
  8. Reinstall Firefox. The simplest method is via apt: sudo apt update && sudo apt install firefox This installs the standard Ubuntu version (which is a Snap on recent releases). Alternatively, you can download the official Mozilla build from the Firefox website, extract it, and run it from a folder. That method gives you the latest version and avoids Snap.
  9. Launch Firefox. You can start it from the application menu or by typing firefox in a terminal. It will create a fresh profile.

Common Mistakes

  • Using apt remove instead of apt purge. remove leaves configuration files behind; purge deletes them.
  • Forgetting to delete the profile folder. If you skip step 5, old settings and potentially corrupted data will be reused.
  • Not checking for Snap/Flatpak versions. Ubuntu 22.04 and later default to Snap; if you installed Firefox via Snap, apt purge won't remove it.
  • Skipping the backup. If you delete your profile without backing up, you lose all bookmarks, passwords, and history permanently.

Tips

  • Use apt purge firefox rather than apt remove to get rid of all system-level config files.
  • If you want to keep your bookmarks but not other data, export them to an HTML file (Bookmarks > Manage Bookmarks > Import and Backup > Export Bookmarks to HTML) before deleting the profile.
  • Consider using the official Mozilla tarball if you want the latest version and don't want Snap's auto-updates or confinement. Download from https://www.mozilla.org/firefox/, extract to /opt, and create a launcher.
  • After reinstalling, set up your preferences fresh. This is a good opportunity to review privacy settings and extensions.

Troubleshooting

Firefox won't launch after reinstall. If you installed via Snap and it fails to start, try snap run firefox in a terminal to see error messages. Common issues include missing graphics drivers or conflicting environment variables.

Old profile reappears. If you see your old bookmarks despite deleting ~/.mozilla/firefox, you may have a Snap or Flatpak version that stores profiles in a different location. Snap stores profiles in ~/snap/firefox/common/.mozilla/firefox; Flatpak in ~/.var/app/org.mozilla.firefox/.mozilla/firefox. Delete those as well.

apt says "firefox is not installed" but it's still in the menu. This indicates a Snap installation. Check with snap list | grep firefox and remove with sudo snap remove firefox.

Permission errors when deleting profile. Run sudo rm -rf ~/.mozilla/firefox if your user lacks write permissions, but be careful with sudo.

After reinstall, Firefox crashes on startup. Try launching in safe mode: firefox --safe-mode. If that works, a corrupt extension or hardware acceleration setting is the culprit. Reset preferences by creating a new profile with firefox -P.

Frequently Asked Questions

Will uninstalling Firefox delete my bookmarks?

No, not automatically. Uninstalling via apt does not touch your home directory. However, if you delete the ~/.mozilla/firefox folder as part of a clean uninstall, your bookmarks will be deleted. Always back up first.

What's the difference between apt remove and apt purge?

remove deletes the program files but leaves configuration files in /etc and elsewhere. purge deletes those as well, giving a cleaner removal.

Why is Firefox installed as a Snap by default on Ubuntu?

Since Ubuntu 22.04, Firefox is distributed as a Snap package to ensure automatic updates and better security isolation. You can still install the traditional .deb version from Mozilla's website.

Can I reinstall Firefox without losing my profile?

Yes, if you skip step 5 (deleting the profile folder), your old profile will be reused. This is useful if you want to fix a broken installation without losing data.

How do I completely remove Firefox from Ubuntu 20.04?

On 20.04, Firefox is a .deb package. Use sudo apt purge firefox and then delete ~/.mozilla/firefox if you want a full clean.

What if I installed Firefox from the official website?

If you downloaded the tarball, remove it by deleting the folder where you extracted it (e.g., /opt/firefox) and any desktop entry files in ~/.local/share/applications.