This guide shows you how to force-empty the Trash on a Mac using Terminal, which is useful when the normal Empty Trash command fails because a file is locked, in use, or corrupted. You’ll need to open Terminal (found in /Applications/Utilities/ or via Spotlight) and run a few commands with administrator privileges. No additional software is required.
What You’ll Need
- A Mac running macOS (any recent version).
- An administrator account (you’ll need to enter your password).
- Terminal app (pre-installed).
Step-by-Step
- Open Terminal. Press Command (⌘) + Space to open Spotlight, type “Terminal,” and press Return. Alternatively, go to Applications → Utilities → Terminal.
- Run the safe empty command first. Type the following and press Return:
rm -rf ~/.Trash/*
This removes all files in your user Trash folder. The~represents your home folder, and.Trashis a hidden folder where your Trash items are stored. - If that fails due to permissions, use sudo. Type:
sudo rm -rf ~/.Trash/*
You’ll be prompted for your password. Enter it (you won’t see characters as you type) and press Return. - If files are still stuck, try the system Trash. Some items may be in the root user’s Trash. Run:
sudo rm -rf /Users/Shared/Trash/*
This is rare, but it covers cases where files were deleted from shared locations. - If files are “in use” or locked, force quit Finder first. Run:
killall Finder
This restarts Finder, which may release file locks. Then repeat step 2 or 3. - If the Trash still won’t empty, use the
rmcommand with the-fflag on specific items. List the Trash contents first:ls -la ~/.Trash
Then remove a specific stubborn file by name:rm -f ~/.Trash/"filename"
Replace “filename” with the actual name (use quotes if it has spaces). - If all else fails, restart in Safe Mode and then empty. Restart your Mac, hold the Shift key until the login window appears, log in, then try emptying Trash normally or via Terminal again.
Common Mistakes
- Using the wrong path. Many users type
~/.Trashbut forget the tilde, which means “home directory.” Without it, the command may target a non-existent folder. - Forgetting the
-fflag. Without-f,rmwill ask for confirmation for each file, and may fail on read-only files. Always use-rfwhen deleting directories. - Running
sudowithout need. Usingsudocan be dangerous if you mistype the path. Always double-check the command before pressing Return. - Not quitting apps that are using the files. If a file is open in an application,
rmmay fail. Quit the app first.
Tips
- Use the secure empty option if privacy matters. macOS’s “Secure Empty Trash” was removed in newer versions, but you can use
rm -Pto overwrite the file before deleting (slower, but more secure). For example:rm -P ~/.Trash/*. - Check for hidden files. Some files in Trash may be hidden (starting with a dot). Use
ls -lato see them. - Create a custom alias. To speed up future empties, add an alias to your shell profile:
alias emptytrash='rm -rf ~/.Trash/*'. - Be careful with wildcards. The
*in~/.Trash/*matches all files and folders, but not hidden files (starting with a dot). If you want to remove those too, userm -rf ~/.Trash/(note: no*), but that will also remove the .Trash folder itself, which is fine—it will be recreated automatically.
Troubleshooting
“Operation not permitted” error: This usually means macOS’s System Integrity Protection (SIP) is blocking access. If you’re trying to delete files in the system Trash (e.g., /var/.Trash), you may need to disable SIP temporarily, which is not recommended. Instead, try moving the files to your user Trash first: sudo mv /path/to/file ~/.Trash/ then empty.
Files reappear after deletion: This can happen if an app is syncing or recreating the file. Quit the app, then delete again. If it’s a cloud-synced file (e.g., iCloud Drive), temporarily turn off sync.
“No such file or directory” when using ~/.Trash: If your home folder is on an external drive or you’re using a different user account, the path might differ. Use echo $HOME to check your home directory.
Terminal says “Permission denied” even with sudo: This may be because the file is owned by another user or is protected by macOS. Try using sudo chflags -R nouchg ~/.Trash to remove the “uchg” (user immutable) flag, then delete.
Trash icon still shows full after emptying: Sometimes the Finder doesn’t refresh. Run killall Finder to restart it, or log out and back in.
Frequently Asked Questions
Q: Is it safe to use rm -rf on the Trash?
A: Yes, as long as you point it to the correct path (~/.Trash). Double-check the path before running, as rm -rf is irreversible.
Q: Why can’t I empty the Trash normally?
A: Common reasons include files being locked by an app, permissions issues, or corrupted files. Terminal bypasses Finder’s checks and forces deletion.
Q: Will this permanently delete my files?
A: Yes, the files are removed from your drive and cannot be recovered from the Trash. Consider using Time Machine or other backups if you need to recover them.
Q: What does the sudo command do?
A: sudo runs the command with administrator (root) privileges, allowing you to delete files that your user account doesn’t have permission to modify.
Q: Can I use this to empty another user’s Trash?
A: Yes, if you have admin rights, you can replace ~ with the other user’s home path, e.g., sudo rm -rf /Users/otheruser/.Trash/*. But do this only if you have permission.
Q: What if I accidentally delete the wrong files?
A: Because rm is permanent, there’s no undo. Always double-check the path and consider using ls to list files first. If you have Time Machine, you may be able to restore from a backup.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- How to Add & Remove Favorites in Windows 10 Photos App
- Fix Links Not Opening in Chrome: 7 Top Ways
- Windows 11 search how to control automatic indexing of frequently used folders?
- How to Set Up Tips on Twitter (X) for Android & iOS
- Microphone Access: Give Apps Only What They Need
- Fix QuickBooks Error Code: Step-by-Step Guide