Introduction / Why This Is Needed
Over time, macOS accumulates temporary files, application caches, and logs that can occupy anywhere from several gigabytes to tens of gigabytes of disk space. These files are not critical for system operation, but their accumulation slows down searches, can cause "Not Enough Space" errors, and reduces overall performance. In this guide, you will learn how to safely find and remove temporary data manually and using built-in tools, reclaiming precious gigabytes.
Requirements / Preparation
- macOS Version: Instructions are current for macOS Sonoma (14), Ventura (13), Monterey (12), and Big Sur (11).
- Access Permissions: Deleting system temporary files (
/private/var/tmp) requires administrator privileges (password). - Pre-installed Packages: Terminal is available by default. Some steps will require the Safari or Google Chrome browser.
- Recommendation: Before starting, ensure you have access to a backup (Time Machine or another) in case of accidental deletion of important data. Close all browsers and active applications (e.g., Photoshop, Xcode), as they may lock their cache files.
Step-by-Step Instructions
Step 1: Preparation: Create a Backup and Close Applications
Before cleaning, ensure all important data is saved. Close all browsers and active applications to avoid file access errors during deletion. This will also prevent caches from being recreated immediately after clearing.
Step 2: Clearing User Caches via Finder
This is the safest and most controlled method.
- In Finder, click the menu "Go" → "Go to Folder..." (or
Cmd+Shift+G). - Enter the path:
~/Library/Cachesand click "Go". - You will see dozens of folders named after application domain identifiers (e.g.,
com.apple.Safari,com.google.Chrome,com.adobe.Photoshop). - Open each folder and delete all its contents (files and subfolders). Do not delete the folders themselves, as applications will recreate them upon next launch.
- Repeat for all folders you wish to clear. Pay special attention to browser folders and heavy applications (e.g.,
com.spotify.client,com.plexapp.plex-media-player).
💡 Tip: If the
Cachesfolder seems huge, you can simply move it to the Trash (right-click → "Move to Trash"), then create an empty folder with the same name. However, the method of deleting contents is more precise.
Step 3: Deleting System Temporary Files via Terminal
System temporary files are stored in /private/var/tmp and /tmp.
- Open Terminal (from
/Applications/Utilities/or via SpotlightCmd+Space). - Enter the following command to clear the main system temporary directory:
sudo rm -rf /private/var/tmp/* - The system will prompt for the administrator password. Enter it (characters are not displayed) and press
Enter. - The
/tmpfolder (which is often a symbolic link to/private/tmp) is already cleared by the command above. Additional cleanup is usually not required.
⚠️ Important: The
rm -rfcommand deletes files permanently. Ensure you have entered the path correctly. Do not usesudo rm -rf /orsudo rm -rf ~— this will lead to catastrophic consequences.
Step 4: Clearing Browser Caches (Safari and Chrome)
For Safari:
- Launch Safari.
- From the menu, select "Safari" → "Settings" (or
Cmd+,). - Go to the "Advanced" tab.
- At the bottom of the window, click the "Show Develop menu in menu bar" checkbox if it's not already enabled.
- Now, in the menu bar, select "Develop" → "Empty Caches".
For Google Chrome:
- Launch Chrome.
- In the address bar, type:
chrome://settings/clearBrowserDataand pressEnter. - In the window that opens, select "Cached images and files" (uncheck other items if you only want to clear the cache).
- In the dropdown menu "Time range", select "All time".
- Click "Clear data".
Step 5: Freeing Up Space with macOS's Built-in Utility
macOS provides a convenient storage analyzer.
- Click the Apple logo (☰) in the top-left corner → "About This Mac".
- Go to the "Storage" tab (or "Storage Management" button).
- The system will calculate and suggest several categories for cleanup: "Recommendations" (e.g., "Automatically empty Trash"), "Documents", "Trash".
- Click "Manage..." or follow the prompts (e.g., "Store in iCloud", "Optimize Storage", "Empty Trash").
- This utility will also show which applications occupy the most space, helping you decide what to remove.
Step 6: Checking the Result and Final Cleanup
- Return to "About This Mac" → "Storage" and see how much space has been freed.
- If you used Terminal, check the size of the
/private/var/tmpfolder:
The command will show the current size.du -sh /private/var/tmp - Don't forget to empty the Trash (right-click on the Trash icon in the Dock → "Empty Trash").
- Restart your Mac. This will terminate background processes that may have been using temporary files and free associated resources.
Verifying the Result
The primary indicator of success is increased free disk space in the "About This Mac" → "Storage" section. You should see an increase of several gigabytes (the exact amount depends on how long it's been since your last cleanup and how many applications you use).
Additionally, you can verify that cache folders are indeed empty:
ls -la ~/Library/Caches/com.apple.Safari/
If the output shows only . and .. (or is completely empty), the folder has been cleared.
Potential Issues
- "Operation not permitted" error when deleting via Finder: A file is in use by a running application. Close the corresponding application and try again.
- Not enough space to complete the operation: Sometimes, the system requires temporary free space to delete large volumes of temporary files. Free up space by other means (e.g., delete old downloads) and retry.
- Cache folders refill instantly: This is normal. Applications begin creating new cache files upon first launch after clearing. Regular (every 1-2 months) manual cleanup is the optimal strategy.
- System "hangs" after
sudo rm -rfcommand: If you accidentally entered an incorrect path (e.g.,/instead of/private/var/tmp), this could lead to deletion of system files. In such a case, a macOS reinstallation will be required. Be extremely careful when usingsudo rm -rf.