Sub topic 8
Deleting safely: backups and what to leave alone
This chapter assumes you can open System Settings and Finder, know where your home folder and ~/Library are, and can paste a simple command into Terminal. It covers how to delete files without losing data or damaging your system. Later chapters apply the routine to caches, developer tools, and snapshots.
Why deletion needs a routine
Freeing space is easy. Freeing space without regret takes a little discipline. Three problems cause most mistakes:
- Deletion is often permanent. Emptying the Trash removes files for good. Terminal commands such as
rmskip the Trash entirely. - Names mislead. A folder called
Cachemay hold only rebuildable data. A folder calledApplication Supportmay hold the only copy of your documents. - Sizes mislead. The biggest item is not always the best one to delete. A 40 GB folder of photos you need is worth more than 2 GB of caches you can safely clear.
A routine fixes this. Check a backup, classify what you plan to remove, delete the smallest reversible thing first, then verify the result.
Step 1: Confirm you have a backup
A backup is a second copy of your data on a different device or service. A file that exists only on your Mac's internal disk is not backed up, even if you rarely touch it.
Three common options:
| Option | What it protects | Limits |
|---|---|---|
| Time Machine to an external drive | Documents, apps, settings, with version history | Needs the drive connected. Restoring takes time. |
| iCloud Drive and iCloud Photos | Files and photos kept in iCloud | Syncs deletions too. Deleting a file on the Mac removes it from iCloud as well. |
| Manual copy to an external drive | Only what you copy | Easy to forget, no history |
Syncing is not backup. If you delete a synced file, the deletion spreads to your other devices. Recently deleted items can usually be recovered for a limited time, but do not rely on that window.
To check Time Machine, open System Settings, choose General, then Time Machine. Look at the last backup time. If it is days old, run a backup before you delete anything large. The menu bar Time Machine icon, when enabled, offers Back Up Now.
You can also check from Terminal:
tmutil latestbackupIf the command prints a path, a backup destination is mounted and has a completed backup. If it reports an error or no backups, treat that as "no current backup".
Step 2: Classify what you plan to remove
Sort each candidate into one of three groups before you act.
Safe to remove
These are files you can regenerate or that you no longer want:
- Items in the Trash.
- Installer files (
.dmg,.pkg) for software you already installed. - Duplicate downloads and old exports you have confirmed are copies.
- Movies and large files that you can download again, such as purchased TV shows.
- Contents of
~/Library/Cachesfor apps you have quit, with the care described in the cache chapters.
Remove only after checking
These may be valuable. Open them, confirm what they are, and have a backup:
- Large files found in Finder or Terminal that you do not recognize.
- Old iOS device backups in the Finder or Apple Devices app. These may be the only backup of an old phone.
- Virtual machine disk images and game libraries. They are large, but rebuilding them can take hours.
- Mail attachments and downloads that Mail does not store elsewhere.
Leave alone
Do not delete these by hand:
- Anything in
/System,/usr,/bin,/sbin, and/private/var. macOS protects most of these, and the rest are not yours to change. - The
/System/Volumes/Datavolume contents as a whole, or any attempt to "clean" System Data by deleting folders from it. ~/Library/Application Supportdata for apps you still use. It often holds your settings, databases, and licenses.~/Library/Preferences,~/Library/Keychains, and~/Library/Mail.- Photos, Music, and Messages libraries. Manage them from inside their apps, not in Finder.
- Time Machine snapshots and backup folders removed by dragging to the Trash. Use
tmutilor Time Machine settings instead.
Why you should leave libraries to their apps
A library such as Photos Library.photoslibrary looks like one file in Finder, but it is a package, a folder that Finder displays as a single item. It holds a database and thousands of files that refer to each other. Deleting pieces inside it can corrupt the library. Delete photos in the Photos app, and let the app update its own database.
The same applies to Mail, Messages, and Music. These apps keep indexes that must stay consistent with the files.
Step 3: Delete the least risky way first
Choose the method that you can undo.
- Move to Trash first. In Finder, select the item and press Command-Delete. The file stays recoverable until you empty the Trash.
- Wait. Use the Mac for a day or two. If an app misbehaves or a file turns out to matter, you can put it back (right-click the item in Trash, then Put Back).
- Empty the Trash. Only then do you reclaim the space. Option-Shift-Command-Delete empties without a confirmation. Avoid it unless you are sure.
Space is not returned until the Trash is emptied. Many people delete 20 GB and wonder why free space did not change.
Terminal deletion
rm does not use the Trash. Follow these rules:
- List before you delete. Run
lsorduon the exact path first. - Avoid
rm -rfwith variables or wildcards you have not previewed. - Never run commands with
sudo rmcopied from a forum unless you understand each path. - Prefer the Trash for anything you did not create yourself.
A safe pattern is to preview the target and its size, then move it rather than delete it:
target="$HOME/Library/Caches/com.example.OldApp"
ls -la "$target" && du -sh "$target"
mkdir -p "$HOME/Desktop/to-delete"
mv "$target" "$HOME/Desktop/to-delete/"Replace com.example.OldApp with a folder you have identified. The ls and du lines show what you are about to move. The mv command removes it from its original location, so the app rebuilds it if needed, while you keep the files on your Desktop until you are sure.
A decision flow
The diagram shows the order of checks before you remove anything.
Common errors
- Deleting caches while the app is open. The app may crash or rewrite the files right away. Quit the app first.
- Trusting a cleaner app. Some third-party cleaners remove items based on name patterns. Review their list. If you cannot explain an item, do not remove it.
- Deleting System Data by guess. System Data is a category label, not a folder. No single folder corresponds to it, so there is nothing safe to "delete".
- Forgetting synced deletes. Removing a file from iCloud Drive on one device removes it everywhere.
- Assuming the Trash frees space immediately. It does not. Empty it, then recheck.
- Removing local snapshots by hand. Snapshots are managed by Time Machine and macOS. Use supported commands, covered in a later chapter.
Verify the result
After emptying the Trash, confirm that space was recovered and that nothing broke:
df -h /System/Volumes/DataCompare "Avail" with the number you noted before. Free space can also shift because of purgeable space and snapshots, so a small difference does not mean the delete failed. Then open the apps affected and check that they launch and your data is present.
A short checklist
- Back up and confirm the last backup time.
- Identify the item and classify it: safe, check first, or leave alone.
- Quit related apps.
- Move to Trash, or to a holding folder if you use Terminal.
- Wait a day or two.
- Empty the Trash.
- Verify free space and app behavior.
Exercise
You find a 12 GB folder named ~/Library/Application Support/SomeApp and your Mac is low on space. Your last Time Machine backup was three weeks ago. What do you do before deleting it, and why might you decide not to delete it at all?
Show answer
First identify what the folder holds: check what SomeApp is, whether you still use it, and look inside for databases, projects, or licenses. Run a Time Machine backup, because the last one is three weeks old and would not hold recent changes. Application Support often contains data that is not rebuilt automatically, so if you still use the app, leave the folder alone or clear space from inside the app instead. If you decide the app is no longer needed, uninstall it, move the folder to the Trash rather than using rm, wait a few days, and then empty the Trash.
Exercise
Why does rm -rf ~/Documents/Old Projects risk deleting the wrong things, and how do you write the command safely?
Show answer
The shell splits the unquoted path at the space into two arguments, ~/Documents/Old and Projects. Both are deleted if they exist, so Projects in the current directory could be removed. Quote the path as "$HOME/Documents/Old Projects". Better, preview it with ls and du first and move it to the Trash instead of running rm.
Exercise
You deleted 15 GB of files, but df -h shows almost no change. Give two likely reasons.
Show answer
The files are still in the Trash, so they have not been removed. Another reason is that a Time Machine local snapshot still references them, so the space stays in use until the snapshot is removed or macOS reclaims it as purgeable space. Free space can also fluctuate because other processes write data.