Removing (uninstalling) software

There are 2 basic ways to uninstall applications in FreeBSD. The first is to use the "make deinstall" command. To do this, cd to the Ports directory of that application. For example, if we wanted to uninstall bash:

cd /usr/ports/shells/bash
make deinstall

This will remove the application from your system. Note that this method will work even if you originally installed the application through Packages rather than Ports.

The other method of uninstalling an application is using the "pkg_delete" command. This method also works regardless of whether you installed the application through Ports or Packages, and whether or not you did a "make install clean" when you installed through Ports.

The caveat with this command is that you have to know the full name of your application. Normally you would just know the short name, for example, "firefox". That is the command you would enter in a terminal window (or set in your Fluxbox menu) in order to run the application Firefox. However, in order to uninstall, we need to know full name, including version number. To find this:

pkg_info | grep firefox

This will give you the full package name and a short description.

firefox-1.5.0.4,1 Web browser based on the browser portion of Mozilla

That's the full name of Firefox as installed on my system on 6 July 2006. To uninstall this application, as root type:

pkg_delete firefox-1.5.0.4,1

This will remove Firefox from your system. If you're using zsh as your shell, you can usually just type the short name of the application (or even just the first few characters of the name) and tab-complete the rest. Very useful. For more information on zsh, visit our section here.