How to Install or Uninstall mockery Ubuntu 22.04

Updated: September 15, 2022

Mockery provides the ability to easily generate mocks for golang interfaces. It removes the boilerplate coding required to use mocks. In this guide, I will show you how to install mockery on Ubuntu 22.04.

Prerequisites to install

  • Operating system: Ubuntu 22.04 or older Ubuntu versions
  • Privileges: Ensure that you are able to execute the sudo commands line.

Prerequisites to install mockery on Ubuntu 22.04

Install mockery Ubuntu 22.04

mockery 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 mockery using APT

This is a popular method for installing any Ubuntu packages because it is simple to understand, even if you are a Linux beginner. Following these steps to get mockery on your Ubuntu.

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

sudo apt update

Step 2: Start the package installation on Ubuntu 22.04. You can now install mockery Ubuntu by executing this command in the terminal.

sudo apt install mockery

Install mockery using Aptitude

Aptitude allows users to view a list of available packages and manage package installation, upgrade, and removal. If you haven’t already installed it on Ubuntu, run this command to do so.

sudo apt -y install aptitude

After installing it, you can now install mockery, just following these steps:

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

sudo apt-get update

Step 2: Start the package installation on Ubuntu 22.04. After updating, you can install mockery Ubuntu by pasting this command into the terminal and pressing Enter.

sudo aptitude -y install mockery

Uninstall mockery on Ubuntu 22.04

Have you ever thought that uninstalling an application from Ubuntu might be challenging? You’re wrong; any program, not just a mockery, can be easily uninstalled by anyone.

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

sudo apt remove --auto-remove mockery

If you want to uninstall mockery and delete its data and dependencies, you can also run the following command:

sudo apt autoremove --purge mockery

Conclusion

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