How (and why) to clear the cache on your Mac

Your Mac takes care of routine maintenance behind the scenes eventually, but that doesn’t mean you can’t keep things tidy yourself in the meantime. One easy way to keep your Mac running its best is to occasionally clean the cache.

Why clean your cache?

You know how you shop for something online and then for weeks you’re seeing it everywhere? That’s because your browser caches hundreds of files that make up the websites you visit. Caches also include cookies and trackers that save information about your browsing history and report the data back to the site. This works out in your favor when you return to a site without having to log in again, but it can also leave you feeling like your computer is spying on you.

Besides browser and website information, your Mac keeps several caches of its own for different reasons. The good news is — CleanMyMac can clear them all. With Setapp, you have access to CleanMyMac, the best solution for performing routine Mac maintenance whenever you like. This app can clear the browser cache in Firefox, Chrome, and Safari, as well as your system cache, email cache, user cache files, and even your DNS cache files.

Delete user caches on a Mac 

User cache (including app cache and DNS cache) makes up the majority of junk data on macOS. 

To find and clear your user cache manually, do the following:

  • In your Mac’s user folder, there’s a hidden Library folder, which itself contains a folder of caches left by the applications you’ve installed on your Mac. 
  • Strongly recommend that you remove the insides of ~/Library/Caches  and   /Library/Caches folders, but not the folders themselves.
  • Want to make sure your junk user cache data is gone forever? - Empty out your Trash.

Cache folder size

Those are usually fine to trash, and you can use CleanMyMac to handle them properly. It will find up to 5x more junk cache data to remove from all over your system.

DNS cache

Your Mac’s DNS cache is a list of all the DNS queries that were resolved for every site. When you type in “setapp.com," the DNS server resolves that to a numerical IP address. But if you notice a site not loading, or your browser acting up or working too slowly, resetting the DNS cache might be the cure.

To flush DNS cache manually :

  • Open Terminal (⇧ Shift++U, and double-click on Terminal)
  • Type this into Terminal:
    sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder;say cache flushed
  • Press Enter to run and fill your admin password to execute the command.

Delete system and app cache on Mac

The hidden system caches are mainly created by the apps that run on your Mac. To find and delete app cache in the same way as user cache, by going to ~/Library/Caches and removing the insides of the folders with the app name.

Be careful: not all app cache files can be safely deleted. Some app developers keep important information on cache folders. The great idea to backing up a folder before you erase all files inside. If everything works fine, you can delete this backup.

Clean up browser caches

Your browser cache is essentially saved bits of the websites you’ve visited recently. That way, if you go back, your computer can re-use locally cached elements that haven’t changed, which speeds up load times versus reloading everything fresh from the remote server. Your cache will overwrite itself eventually, but you can clear your cache, history, and cookies anytime you want to gain a little bit of extra security and speed up your Mac.

Clear Safari caches step-by-step

To delete Safari's websites' caches and cookies via browser preferences:

  1. Click Safari in the top menu click Preferences.
  2. In the window that appears, click the Advanced tab, and enable Show Develop menu.
  3. In menu bar go to Develop and choose Empty Caches.

Check and delete Safari browser cache with Terminal:

  1. Press Command + Shift + G to open up the Terminal
  2. With these simple commands you can delete Safari's cache file. But first, check its size using the disk usage (du) command:
    du -h /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db
    Note: replace "$HOME" with the name of your home folder To delete Safari's cache file type:
    rm /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db
    Note: when you use the remove (rm)command files are essentially unrecoverable. 
    A more prudent approach is to use the move (mv) command: 
    mv /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db ~/.Trash/ This will move the file to your user's ($HOME) trash. From there it is still recoverable until you empty the trash.
    Safari will create a new Cache.db file automatically when you open a new webpage. Open a new webpage or restart Safari and recheck disk usage:
    du -h /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db

That's all.

Chrome clearing cache tutorial

The simplest way to clear Chrome browser cache manually is:

  1. In the top right corner of Google Chrome browser click the 3-dot icon to choose Settings. 
  2. At the bottom of the menu, choose Advanced (or use Cmd+Shift+Delete keyboard shortcut)
  3. Click Clear browsing data and deselect all, but Cached images and files. Choose time range and hit Clear data button.

One more way to delete Chrome browser cache is to clear some folders where these data located. 

  1. To find Chrome cache files, open Finder and click to Go to the folder. 
  2. To go to the folder where Chrome' primary cache locates type:
    ~/Library/Caches/Google/Chrome/
  3. To go to the folder with the additional bulk of cached data type:
    ~/Library/Application Support/Google/Chrome/Default/Application Cache/
  4. Select files within these folders and delete them.

How to delete cache in Firefox manually

  1. Click the hamburger icon in the top right corner and choose Preferences.
  2. Choose Privacy & Security on the left sidebar.
  3. Scroll to the section Cookies and Site Data and click to Clear Data... tab
  4. Now, check Cached Web Content  and click Clear button to delete Firefox cache.
  5. Exit/quit all browser windows and re-open the browser.

How to clean all cache data at once

CleanMyMac is such a great tool because it lets you perform the exact maintenance you want, or run a Smart Cleanup scan with a single click and have the software make recommendations.

Clean your browser cache

  1. Open CleanMyMac and select Privacy in the sidebar
  2. Click Select Items to advance to the next page
  3. The list is broken down by app: you can check each browser to remove all data, such as cookies, browsing history, downloads history, HTML5 local storage, saved passwords, and even close the tabs from your last session. Or you can uncheck any of that you want to keep
  4. Click the Remove button at the bottom of the window when you’re ready to delete everything that’s checked

Clean your Mac’s DNS cache

  1. Open CleanMyMac and select Maintenance in the sidebar
  2. Check the box for Flush DNS Cache
  3. Click the Run button at the bottom of the window

Clean your Mac’s user cache

  1. Open CleanMyMac, select Smart Cleanup in the sidebar, and click the Scan button at the bottom of the window
  2. Once the scan is finished, click System Junk in the sidebar on the left
  3. Look at the list of results for User Cache Files, which is broken down by app
  4. Everything is selected by default, but you can deselect things you want to keep, or click Deselect All and then check items you want to delete
  5. Click System Cache Files in the list of System Junk, and check those if you like as well
  6. Click Clean when you’re ready to delete everything that’s checked

Shape up your Mac even more with other apps in Setapp

CleanMyMac isn’t the only app in the Setapp collection that helps you take good care of your Mac. Setapp gives you access to all of its apps at once, so you can try to get your Mac in even better condition with no downside. Here are some examples.

Declutter automatically sorts files you leave on your desktop, so they’re not cluttering up your view but are still easy to find.

Disk Drill can perform data recovery tasks, like restoring deleted files that haven’t been written over yet, or grabbing anything usable off a corrupted flash drive.

Gemini can find duplicate files. For example, photos and videos you downloaded from your iPhone as well as emailed yourself. Or PDFs you downloaded and filed away once, only to download again later when you forgot you already had a copy.

iStat Menus monitors your Mac’s vital signs in real time, so when things slow down you can see which app is hogging all your memory.

Get Backup Pro makes it easy to make bootable backups of your system, making emergencies not so scary anymore.

No one likes a slow Mac, and it’s a good idea to clean it up every so often. Cache files are the most common and probably the least understood offender that Setapp can help you to keep under control. So you can do everything else in a blink of an eye.