macOS Tutorials
Last updated: December 25, 2023
Delete Temporary Files on Mac

How to Delete Temporary Files on Mac

Blog->macOS Tutorials->How to Delete Temporary Files on Mac

Is your Mac’s storage space almost full and its performance lagging because your hard drive is cluttered with temporary files you didn’t even know existed? You’re not alone. Many Mac users deal with the same issue. In this article, we’ll teach you how to clean temporary files on a Mac so that your device runs as efficiently as the day you got it.

What Is the Role of Temporary Files on Mac?

Before we explain how to delete temporary files on your MacBook, iMac, Mac mini, Mac Studio, or Mac Pro, let’s understand what they are and why they exist.

Despite what you might think, temporary files on Mac play a crucial role in your computer’s daily functioning. These files are created by the MacOS, as well as by various applications, to store data that might be necessary for certain processes or to speed up future access to information, or to save some information that is needed only briefly.

Common sources that generate temporary files include:

  • The applications you use: Among these, web browsers are the biggest offenders. They create caches to store images, scripts, and other parts of the websites you visit, enabling them to load faster the next time you access them.
  • The macOS operating system: MacOS creates all kinds of temporary files for its own operations. These can include system logs, error reports, and intermediate files used during software updates. Essentially, these files are like the MacOS’s way of keeping notes on its own performance and tasks.
  • Your user activity: As users, we sometimes download files, create documents, or install software and then forget about them. These files, although initially needed, can become obsolete and linger unnoticed in various folders.

While these temporary files are useful, they can accumulate quickly, becoming unwanted digital clutter. Regularly deleting them not only frees up space but also keeps your Mac running at peak performance, so knowing how to clean temporary files on Mac is essential.

Steps to Clean Temporary Files on Mac

When your Mac starts to feel like a garage packed with items you no longer use, it’s time to roll up your sleeves and start cleaning out those temporary files. We’ve placed the most efficient methods first because we want you to achieve excellent results as quickly as possible.

Step 1: Manually Delete Temporary Files

To manually delete temporary files on your Mac, you’ll need to venture into the folders where they are stored:

System Library Cache:

  • Location: /System/Library/Caches/
  • Purpose: Stores system cache files for macOS core functions.

User Library Cache:

  • Location: ~/Library/Caches/ (where ~ indicates the user’s home directory)
  • Purpose: Contains user-specific cache files related to system processes and applications.

Temporary Folder:

  • Location: /private/var/tmp/
  • Purpose: Holds temporary files created by applications and the system, some of which may be in active use.

Once you have navigated to these folders, you can delete the files they contain. To do this, select the files or folders you want to remove and drag them to the Trash. After moving the files to the Trash, be sure to empty the Trash to complete the deletion process and free up the space on your hard drive.

Important: Before you delete any files, it’s important to ensure they are not currently in use by the system or any applications. One simple solution is to restart your device and delete Mac temp files before you launch anything.

Step 2: Remove Temporary Files from Web Browsers

Web browsers store cache files to expedite your online experience, but over time, these files can become a cumbersome collection of outdated data. Here’s how to purge these files from Safari, Firefox, and Chrome on your Mac.

Safari:

  1. Open Safari and click on Safari in the menu bar.safari settings menu
  2. Choose Settings and then the Privacy tab.
  3. Click the Managed Website Data Button.safari manage website data
  4. Use the Remove All option to delete all stored browsing data.
  5. Confirm your decision by clicking the Remove Now button.

Firefox:

  1. Launch Firefox and click on the hamburger icon (three horizontal lines) in the upper right corner.
  2. Select Settings.firefox settings menu
  3. Navigate to the Privacy & Security tab.
  4. Click on Clear Data in the Cookies and Site Data section.firefox clear data button background
  5. Click Clear to confirm. You can remove the checkmark from Cookies and Site Data if you want to remain logged in to websites.

Chrome:

  1. Open Chrome and click on the three dots in the upper right corner.
  2. Choose the Settings option.chrome settings menu
  3. Navigate to the Privacy and security tab and click on Clear browsing data.chrome clear browsing data
  4. Click the time range dropdown menu and select All time.
  5. Click Clear data.

After you remove temp files in Mac, you might notice that websites take a little longer to load than usual on your first visit back. This is normal, as your browser is rebuilding a fresh cache, fetching the latest data from websites again. This slight delay is a small price to pay for the benefits you receive in return: a clean slate free of unnecessary files.

Step 3: Remove Deleted Files from the Trash

Even after you’ve deleted temp files in macOS, they haven’t quite left your Mac yet—they’re just sitting in the Trash. To fully clean up temporary files on Mac and regain your precious disk space, you need to empty the Trash.

Here’s how to do it:

  1. Click on the Trash icon in your Dock.
  2. Click the Empty button in the top-right corner.trash empty button
  3. Confirm your decision by clicking on Empty Trash.

Remember, once you empty the Trash, there’s no going back—the files are gone for good unless you use data recovery software before they become overwritten, which can happen very quickly or after a long time.

Alternative Ways to Remove Temporary Files on Mac

For those who prefer not to go too deep into their Mac’s file system or simply want additional methods to ensure a thorough cleanup, there are alternative ways to delete temp files in macOS.

Method 1: Restart Your Mac

Ease of Implementation Impact on Storage Required Skills
Trivial Limited Minimal

A simple but often overlooked method to clean up temporary files on your MacBook is to restart it. This process can automatically clear out several types of temporary files, such as”

  • Contents of /tmp directory: This directory serves as a temporary storage area and is cleared out every time you restart your Mac.
  • Virtual memory swap files: macOS uses swap files for managing virtual memory.
  • System logs and diagnostics: Over time, your Mac accumulates system logs and diagnostic reports that can take up space.
  • Application cache: While not all applications clear their cache upon a system restart, many do. This includes both system applications and some third-party applications.

To restart your Mac:

  1. Click the Apple logo in the top-left corner of your screen.
  2. Select Restart from the dropdown menu.apple menu restart option
  3. Allow your Mac to shut down and reboot itself completely.

Keep in mind that while a restart is effective for clearing certain temporary files, it may not remove all types of cache, especially those related to user activities and most third-party apps.

Method 2: Use Cleaning Utilities

Ease of Implementation Impact on Storage Required Skills
Fairly Easy Significant Low

Another efficient way to remove temporary files from your Mac is by using specialized cleaning utilities. Such applications are designed to identify and delete unnecessary files, including caches, temporary files, logs, the contents of the Trash folder, and more.

cleanmymacx main screen

The best utilities have a user-friendly interface that makes them accessible to users of all skill levels and reduces the cleaning process into a few simple clicks. Examples include:

  • CleanMyMac X: Developed by MacPaw, CleanMyMac X is known for its comprehensive cleaning capabilities and user-friendly interface.
  • BuhoCleaner: A fairly lightweight tool focused on quickly cleaning up junk files and managing applications and startup items.
  • CCleaner for Mac: The Mac version of the popular cleaning utility may not be as capable as its Windows counterpart, but it’s still an excellent and free choice.

Beyond just cleaning, these applications often offer extra features like performance monitoring and privacy protection, so they can do more than just delete temporary files on your MacBook.

The biggest downside of relying on cleaning utilities is that you don’t fully control the process. Sometimes, these tools may remove files that are beneficial or necessary for certain applications to function properly.

Tip: A nice compromise between fully automated cleaning utilities and manual cleaning are the best disk space analyzers for Mac, which can instantly reveal the biggest space hogs

Method 3: Utilize Terminal Commands

Ease of Implementation Impact on Storage Required Skills
Fairy difficult Significant High

For those who prefer a more hands-on approach, using Terminal commands can be an effective method to delete temporary files on Mac. This method is particularly useful for advanced users who are comfortable with command-line interfaces.

To use Terminal to delete temporary files:

  1. Open Terminal from the Applications > Utilities folder.
  2. Navigate to the folder you want to clean using the cd command. For example, to go to the user library cache, you would type cd ~/Library/Caches/.
  3. Once you’re inside the folder, use the rm command to delete the files. For example, typing rm -rf * will delete all the files in the current directory (you may need to execute the command as administrator by prefacing it with “sudo”).delete caches in terminal
Warning: Be very cautious with the rm command, as it will permanently delete all files in the directory without placing them in the Trash.

FAQ

Temporary files can be located in various folders, such as /System/Library/Caches/, ~/Library/Caches/, and /private/var/tmp/. You can access these locations using Finder or Terminal.
Yes, you can use Terminal commands to delete temporary files on Mac. However, this method requires a good understanding of the macOS file system and command-line syntax.
Generally, it’s safe to delete temporary files, as these are intended to be transient. That said, you should always ensure that the files you’re deleting are not currently in use by your system or applications.

Conclusion

Freeing your Mac from the clutches of unnecessary temporary files, can be like giving it a breath of fresh air. In this article, we’ve described multiple methods that you can easily implement to delete temporary files from your system. Just remember that regardless of whether you’re using macOS Sonoma, Ventura, or an older version, regular maintenance is crucial for keeping your system running smoothly.

David Morelo is a tech-focused content writer with the ability to turn complex topics into easily digestible pieces of information. When he’s not writing for onMac, he spends his time creating content for SMBs and enterprises across the IT sector, focusing primarily on data backup and disaster recovery, cybersecurity, cloud computing, and the Internet of Things.
Scroll to top