Whether you’re new to using Mac Terminal or you’re an experienced user, you know the power of this tool and that it can do almost anything that can be done from a desktop or GUI app. Uninstalling applications is no different. Mac Terminal has the power to uninstall them completely.
There is no single command you can run in Mac Terminal to uninstall an application completely. Still, by using the find command and the rm command, we can track down all remnants of an application and properly remove them.
My name is Eric, and as a software engineer, I know that most applications on your computer consist of multiple files that can be placed in various locations on your computer. I also know properly uninstalling apps is the best way to keep your Mac’s performance good.
If you keep reading below, I will provide details on how to completely remove an application from your Mac using Terminal. I will also discuss why it is crucial to properly and completely uninstall applications from your system.
- Steps to Uninstall Applications with Mac Terminal
- Step 1: Back up your system.
- Step 2: Start the Terminal application
- Step 3: Locate the application’s .app directory.
- Step 6: Select and copy the path and directory.
- Step 5: Remove the application’s .app directory.
- Step 6: Remove any other .app directories listed in the search.
- Step 7: Look for other application folders and files.
- Use Caution with the rm Command
- Why is Uninstall Necessary?
Steps to Uninstall Applications with Mac Terminal
Completely uninstalling an application using Mac Terminal is possible but requires some investigative skills, decision-making, and a level of comfort using the command line in Mac Terminal. It’s more complex than just running an uninstall command.
If you’re willing to spend a little time and a bit of effort, you will be able to do this. Still, if you are uncomfortable with Mac Terminal and the command line, I suggest using an excellent third-party tool to uninstall applications completely.
One of the important steps in doing this is first to back up your system using Time Machine. While regular backups are recommended for your machine anyway, it is always a good idea to run a backup before you start a process like this, just in case there are issues.
If you are ready to uninstall an application from your system using Mac Terminal, use the steps below. For my example, in the steps below, I will uninstall an application called iTerm. You can use the name of your application with the same steps.
Step 1: Back up your system.
Use TimeMachine or whatever backup software you usually use to take a snapshot or backup of your system. This will allow you to restore everything if you accidentally delete something that should not be removed or if anything else goes wrong.
Step 2: Start the Terminal application
You can use your preferred method to start the Terminal application on your desktop.
Step 3: Locate the application’s .app directory.
Most applications you install on your system will have a .app directory under the /Applications directory or possibly another. You must first locate the directory using the find command, as shown below.
sudo find / -type d 2>/dev/null | grep “/<AppName>.app$”
Where AppName is the name of your application.
For example, the application’s name is iTerm, so I will search for iTerm.app, as shown below.
sudo find / -type d 2>/dev/null | grep “/iTerm.app$”
Note that you will be prompted for your password to run this command. This is because we are using sudo, which will give us permission to search almost all of the directories where the .app directory may exist. You will need admin permissions on your system and use the password you use to log in to your Mac.
Be sure to type the application name the same as you see it on your desktop. The command is case-sensitive to ensure we find only the correct directory, so use the correct case for each letter in the name.
Step 6: Select and copy the path and directory.
From the results of the above find command, you should see the .app directory listed on your screen along with its path. There may be multiple results, as shown below. If there are, select the one in the /Applications directory. If there is not one in the /Applications directory, just select the last one in the list.
Use your cursor or pointer to select or highlight the entire line and copy the text into your buffer.
Step 5: Remove the application’s .app directory.
Removing the application’s .app directory will remove most of the files related to the application. This will, for all intent and purposes, remove the application and prevent it from working any longer. You can use the rm command, as shown below, to remove the directory.
Type the rm -r command and then paste the path and directory name that you have copied in step 4 after the rm -r command. For my example, the command will look like this.
rm -r /Applications/iTerm.app
Step 6: Remove any other .app directories listed in the search.
The search performed in step 4 above probably produced more than one result. You should go back and rerun the search and see if there are any .app directories left. Repeat steps 4 and 5 until there are no longer any results from the search in step 4.
Usually, after a couple of times, you will no longer see results from the search, and you can move on to step 7.
Step 7: Look for other application folders and files.
The main part of the application is now gone, and it will be disabled. The goal now is to find any remaining files that may exist that are related to the application. For most, there will be no more files or folders to remove, but it is always good to check to make sure.
In this part, you will also need to use your own judgment as to what files are or aren’t related to your application. Search results can often produce files and folders with similar names or that contain the same string as your application, so here you want to use caution and verify what you are removing.
For my iTerm application, I performed the following search. You can use the same search command and replace iTerm with the name of your application.
sudo find / -type file 2>/dev/null | grep “/iTerm”
When I ran this command, I got the results shown below.
Notice that in these results, each one has found a file or directory containing iTerm2.This is due to the string iTerm being contained in iTerm2. These particular files and folders that have iTerm2 in them are not part of the application I am removing. In fact, they are a completely different app.
So, in this case, I will not remove any of these. The results do not display anything with just iTerm in them, so it appears there is nothing left to remove for this application. If there were, I could use the rm command as I did in step 5 to remove them.
As you can see, this process takes some investigation and decision-making to ensure that you get all of the related files removed. While it can take a bit of work, it does ensure you remove all items related to the application.
Use Caution with the rm Command
Just a word of caution when using the rm command. It’s one of the most powerful commands in Mac Terminal and allows you to delete many things from your system, but a small typing mistake can easily delete something you don’t want to remove and even your entire hard drive.
Ensure you look at what you are deleting before hitting the return key. Also, remember that rm does not move items into the trash; it deletes them permanently.
Why is Uninstall Necessary?
You might wonder why it is necessary to uninstall applications. It may not be necessary, but it is an excellent idea to uninstall applications you will no longer use.
If you’re like me, you might have a tendency to try out lots of different applications, but you don’t always find them useful and may never use them again. In this case, they just sit on your disk drive, taking up valuable space.
Some applications can be very large and may take a great deal of space, while others may be very small, using what seems to be an insignificant amount of space. Over time these can add up, and you will find that you no longer have available disk space for new applications and data.
Removing unused applications makes good sense. It helps to preserve your space and keep your system healthy and running smoothly. If you find that in the future, you need the application, you can always go back and download it again and reinstall it.
Below are some common questions you might have about completely uninstalling Mac Terminal applications.
Why use Mac Terminal to Uninstall?
Mac Terminal is a great tool to use to uninstall applications. Using the command line, we can thoroughly search through the disk and find any files or directories with the application name, and we then get to decide what we want to remove and what we want to keep.
Are there desktop tools available to do this?
While I prefer to use Mac Terminal to completely uninstall applications, there are desktop tools out there that can do this pretty well. This might be a good option if you are uncomfortable using Mac Terminal. Tools like CleanMyMac work well for many users.
Will I lose my data?
Yes, you will lose any data related to the application and contained in any of the application directories you delete. You should not lose anything unrelated to the application and not in the application directories.
In any case, it is always a good idea to ensure you have your system backed up before removing an application and ensure that your important data files are copied to a location you will not delete.
You can completely uninstall applications using Mac Terminal and the command line by searching your disk drive for directories and files that have the same name as the application. Once found, you can delete them, removing the application from your system.
You will need to use your discretion as to what you delete, being careful not to delete things with similar names. As with any type of cleanup operation such as this, you should back up your system before starting so that you can restore it if you accidentally delete the wrong item.
I hope the information provided can help you to completely uninstall applications from your Mac. As usual, let me know if you have any questions or comments. I would love to hear from you.