Ways to Uninstall or Install dafny Ubuntu 22.04

Updated: September 11, 2022

Dafny is a programming language with a program verifier. The verifier processes function preconditions, postconditions, and assertions, and sends them to an SMT solver for checking. In this way, assertion failures become compiler errors, rather than runtime ones. In this tutorial, I will show you how to install dafny on Ubuntu 22.04.

Software Requirement

  • OS: Ubuntu 22.04 or older versions with more than 2GB RAM
  • Privileges: Check that you can run sudo commands.

Prerequisites to install dafny on Ubuntu 22.04

Install dafny Ubuntu 22.04

dafny is one of the popular ways on Ubuntu now so that this tutorial will show you some ways to install it. Choose the one that you think is easy and you can follow.

Install dafny using APT

This is a popular method for installing Ubuntu packages because it’s easy to follow, even if you are a newbie in Linux. Following these steps to get dafny on your Ubuntu 22.04.

Step 1: You must update the APT package repository cache before attempting to install, update, or remove any packages. Update the APT database to fetch new packages from Ubuntu. Launching the terminal and entering the following Linux command:

sudo apt-get -y update

Step 2: Install the package on Ubuntu 22.04. After updating the system, you can install dafny Ubuntu by pasting this command into the terminal and executing it.

sudo apt-get install dafny

Install dafny using Aptitude

Users can manage their installation, upgrade, and removal of packages with Aptitude and view a list of the packages that are currently available. If you haven’t already installed it on Ubuntu, run this command to do so.

sudo apt-get -y install aptitude

After that, you can now install dafny, just following these steps:

Step 1: Update the APT database to download new packages from Ubuntu. Launch the terminal and enter the following Linux command:

sudo apt-get -y update

Step 2: Start installing the packages on Ubuntu 22.04. After updating the system, you can install dafny Ubuntu by executing this command in the terminal.

sudo aptitude -y install dafny

Uninstall dafny on Ubuntu 22.04

Have you ever thought that uninstalling an application from Ubuntu is difficult? You are mistaken; Anyone can easily uninstall any program, not just dafny.

You can uninstall dafny Ubuntu by running this command if you installed it using APT or Aptitude.

sudo apt remove --auto-remove dafny

You can also execute this command if you want to uninstall dafny and remove its data and dependencies:

sudo apt autoremove --purge dafny


In this tutorial, I showed you ways to install dafny on Ubuntu 22.04 and some ways to uninstall dafny too. If you need any help, don’t hesitate to contact me. I’m very glad to answer them.