A Beginner’s Guide To Terminal Commands
To Clean Up Mac
When a macOS user finds that their computer no longer has sufficient space, the first thing they usually do is go through several
folders looking for files they can delete. This type of cleanup is time-consuming and is often very inefficient. What not many
people don’t know is that there’s an easier way to clean up Mac, and it’s basically through typing in commands in Terminal.
What is Terminal?
Terminal is the command line interface, also known as CLI, of macOS computers. It’s similar to the Command Prompt of
Windows PCs. Basically, the Terminal is where you can perform various operations by typing in the appropriate commands.
You can, for example, restart your computer without going through the standard steps. You only need to know what command
you must enter in Terminal. Similarly, you can delete certain files and subsequently clean up Mac without having to use the
Finder, which is usually what you use to delete files. Again, you will need to know the exact Terminal command to enter.
In your case, if you want to use terminal commands to clean up Mac, there are several commands you can use, not just one,
and that’s what this guide is all about. Read on to learn what commands you can use to clean up your macOS computer storage.
What Terminal Commands Can You Use to Clean Up
Mac?
‘Cleaning up’ can have different connotations to different people. To some, it may mean simply deleting unnecessary files and
freeing up disk space. While to others, it may mean cleaning up only the cache and the current RAM of the computer.
Depending on what exactly you intend to do, the appropriate command will naturally differ.
With that said, here’s a list of Terminal commands to clean up Mac:
sudo purge: This is the command you can use if your main goal is to clear up the RAM and cache of your computer.
It’s the perfect command if you’re mainly struggling with poor performance. Keep in mind that this won’t fix any
storage problems since it actually doesn’t delete files, but rather clears up resources to fine tune your device. It’s an
excellent way to boost your computer’s performance without actually restarting it, which is what most people would
have otherwise done if it weren’t for the command. sudo purge works immediately after use.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder;: This command is ideal if you want to clean up the
cache files that corresponds to your browser’s history. It clears the IP addresses of the websites you previously visited
and it should fix the issue where you encounter 404 error codes when visiting certain websites in your browser.
cd ~/Library/Logs, sudo rm -rf ~/Library/Logs/*: With this command, you can clean up log files on your computer. It’s
the ideal command if you’re not only facing issues with your browser, but on your computer in general. For example,
if your device is constantly crashing, apps are freezing, or files and apps are not being opened properly.
sudo rm -rf /private/var/log/*: This command cleans up system log files and achieves the same effect as the previous
command. It’s advisable to enter this command regularly even if you’re not encountering any issues.
rm: The ‘rm’ command allows you to delete any file you want on your computer. You just have to type in rm on
Terminal, then type in the file path of the file you want to delete. An excellent shortcut for that is simply typing in ‘rm’
then immediately dragging and dropping the file into the Terminal window.
Each of these Terminal commands have different uses, and that’s what makes Terminal an incredible tool. You can practically
do anything you want, as long as you know the corresponding command or code for it. If you don’t necessarily have anything to
do, then you can try to play around with Terminal. For that, of course, you need to access Terminal.
How to Access Terminal
There are several ways to access the Terminal window, but here’s the standard method:
1. Open Finder on your computer.
Note: Finder is the file management program of macOS computers, similar to File Explorer in Windows PCs.
2. Click Applications from the left sidebar of Finder.
3. Find and open the Utilities folder.
4. Locate and double-click Terminal.
With this, you should be able to access the Terminal.
BONUS: Clean Up Mac Without Terminal Using
Umate Mac Cleaner [RECOMMENDED]
If you want to use Terminal commands to clean up Mac, you’d need to have a decent amount of technical knowledge. If you’re
not exactly a techie, then a simpler option to clean up your computer would be to use third-party tools. One tool that should be
quite easy to use is Umate Mac Cleaner—a cleanup software that specializes in deleting unnecessary files. Here’s how to use it:
Step #1: Download, Install, And Open Umate Mac Cleaner
The first thing you need to do is click this link. It should take you to the software’s download site, and there, you’ll find a
Download Now button. Click that button to download a DMG file—the file extension for installers in macOS computers. Once
the download is finished, open the DMG file to start the installation process. Follow the instructions on the installer from that
point onwards. Umate Mac Cleaner will open automatically once the installation is complete.
Step #2: Pick a Cleaner Module
The software has a total of six modules, and you can find them on the left side of the interface. The main goal of this step is to
select the most suitable module out of the six according to your needs. The modules in Umate Mac Cleaner include:
Clean Up Junk
Delete Large Files
Delete Duplicate Files
Erase Private Data
Speed Up Your Mac
Manage Apps & Extensions
To choose a module, just click on the option from the left side of the interface. In your case, you need to choose one of the first
three modules which we like to call the cleaner modules. They’re the ones capable of cleaning up your macOS computer.
So, you must choose between Clean Up Junk, Delete Large Files, and Delete Duplicate Files.
Step #3: Click the Scan Button
For step #3, you need to scan your computer for files or whatever you want to look for. The process will ultimately depend on
the module you chose in the previous step. We’ll just take a look at the steps for all six modules:
Clean Up Junk: Upon selecting Clean Up Junk, you’ll find two options on your screen.
One is Quick Clean while the other is Deep Clean. These are the two scanning methods that the module offers. Quick
Clean is the ideal option if you want to quickly get this over with and you only want to delete any file you can delete.
But if you’re looking for a specific file type, Deep Clean is more suitable since it provides more accurate search results.
You can choose whatever you want or need. Afterward, click the Scan button at the bottom of the interface.
Delete Large Files: Click the Scan button.
Delete Duplicate Files: The fourth step is to click the Browse button on the interface.
You can find it on the left side of the Select a File Directory field. When a popup appears, go to the directory or folder
you want to scan for duplicate files. Once you’re there, click the Scan button below the Select a File Directory field.
Step #4: Select Item/s
For the fourth step, you need to select which files, programs, or app you want to get rid of. The items you’ll find will vary in file
type according to the module you chose, so it might be best to look at the selection process for each module:
Clean Up Junk: On the next page, you’ll find a list on the left side of the interface.
That list will consist of file categories that the module was able to scan. These include items like System Junk,
Downloads, Trash Bin, and Unused Disk Images, among many things. Your goal this time is to select files to delete, but
before that, you must select a category first, only then will the list of files appear from the right side of the software.
Once the files appear, select the files you want to delete by clicking on their corresponding checkboxes. You can also
click the Select All checkbox if you want to delete all files.
Delete Large Files: Select the item (e.g., file, folder, disk image, archives, etc.) you want to delete from the list.
Delete Duplicate Files: Select the items (e.g., image, document, audio, video, etc.) you want to delete from the list.
Step #5: Click the Blue Button
To finalize the process, you just have to click the button at the top-right corner of the window. It should say something along
the lines of Clean, Delete, and Erase. It may take a while to execute the command, so you have o wait for a few minutes.
Going Forward
It doesn’t take an expert to use Terminal, but it at least requires you to know the Terminal commands to perform or execute
certain operations. And while it’s quite common to look up Terminal commands to clean up Mac, you must remember that
there’s much more you can do with this feature. So, try looking up other commands while you’re at it.