Your Ultimate Guide to Clear Xcode Cache

Xcode is a popular integrated development environment (IDE) for macOS computers. It allows users to develop apps and software using assets that you can find inside the IDE. Though it’s an excellent IDE, just like other similar software, it’s fairly heavyweight. Since it contains a lot of assets and consists of numerous features, it’s not rare to find the Xcode folder taking up a ton of storage space on your computer. And while it has a ton of folders, the cache is arguably the best folder to clear if you want to free up space since (1) it’s large and (2) it’s unnecessary. That being said, here’s what you need to know to clear Xcode cache.

Part 1: What Is The Xcode Cache?

Just so we’re clear: the Xcode cache isn’t the entire directory. It refers to a mere part of the Xcode directory. And in case you don’t know, the cache corresponds to files that were created by the IDE at the point when it needed it. Perhaps it created the files when you had to add an asset. Maybe the cache file was generated because you needed to edit one of your projects. Either way, the Xcode cache is a collection of files that the IDE once needed, but are now obsolete and no longer necessary.

clear Xcode cache

Part 2: Are Xcode Caches Necessary?

As stated earlier, Xcode cache files are not necessary. They were when the IDE first created them, but after a while, they no longer had a use. In fact, you may notice that when you use cleanup software, you’ll often find that under the “Junk Files” category are the caches of your apps. Xcode cache is no exception in that it becomes junk files after a while.

Part 3: Can I Clear Xcode Cache Mac?

Naturally, since it’s no longer necessary, you can clear Xcode cache. As a matter of fact, it’s an advisable practice if you want to free up space on your computer. Do keep in mind that cache files won’t be collated in one spot. There may be a couple of cache files outside of its default directory, and those cache files might be alongside possibly important files. Since that’s the case, it’s not the best idea to just empty the Xcode cache folder, as you may delete other files in the process. There are safer methods, three, to be exact, and we’ll look at a step-by-step guide for each one. Let’s start with perhaps the simplest and easiest method.

Part 4: How Do I Clear Xcode Cache Through The IDE?

The IDE has a built-in feature where you can ‘Clean’ a project. It allows you to delete unnecessary files that can potentially cause issues to the project. And as you may imagine, that includes the cache files. Here’s how you can use this method:

  1. Launch the Xcode IDE.
  2. Open the project containing the cache files you want to delete.
  3. Click Product from the top menu bar.
  4. Select Clean from the dropdown menu.

Alternatively, you can simply press Command + Shift + Option + K in combination. It’s a shortcut to clean the project files.

Part 5: How Do I Clear Xcode Cache Via Spotlight?

Spotlight is the built-in search feature of macOS computers. It allows you to locate files and folder by typing in either its keyword or file path. In this case, we’ll be using the file path to search for the cache folder and consequently clear Xcode cache:

The Spotlight is typically on the desktop. So, first things first, you must go to the desktop. There, click the search bar. That should be the Spotlight. Then, type in the following file path: ~/Library/Developer/Xcode/DerivedData/ModuleCache

The Spotlight will show you a couple of results. Select the one that has the name ModuleCache. Open the folder, then delete the files. That’s how you can clear Xcode cache.

clear Xcode cache via Spotlight

Part 6: How Do I Clear Xcode Cache With Finder?

Finder also has a search feature that works similarly to Spotlight, but that’s not what we’re using since it’s not very effective. Rather, we’ll use another of its built-in features, which is the Go to Folder… feature. Here’s how you can use this feature:

  1. Open the Finder app.
  2. Click Go from the top menu bar.
  3. Select Go to Folder… from the dropdown menu.
  • When a popup window appears, type in the following: ~/Library/Developer/Xcode/DerivedData/ModuleCache
  • Click Go. Finder should take you to the specified file path.
  • Once you’re in the correct folder, delete the files you want to delete.

Keep in mind that this method, as well as the one that involves Spotlight, requires you to empty the Trash after following the process. That way, you can be sure the cache files aren’t consuming disk space on your computer.

clear Xcode cache with the Finder

Part 7: How Do I Clear Xcode Cache Using Mac Cleaner

Using the aforementioned methods, you’ll be able to get rid of every file inside the Xcode cache folder, as long as you’re able to find the directory. However, one thing you must note is that the Xcode IDE isn’t necessarily the only software that requires a cache cleanup. Though it does consume a lot of space, there are other apps in your computer with cache folders that do the same. And if you were to use the previous methods, it may take a long time. In this case, it’s best to use Mac Cleaner.

Mac Cleaner is a cleanup software that can delete all kinds of files from your computer. One type of file that happens to be one of the targets of the software is app cache, meaning you can clear Xcode cache with this. Here’s how to use the app:

Step #1: Open Mac Cleaner on Your Computer/Laptop

The first step is to get this software, and you can start by clicking this link. It will take you to the software’s download site. On that page, there will be a button that says Download Now. Click that button to prompt the download of a DMG file, which is the extension for installers in macOS computers. Once it completes the download, open the DMG file to start the installer.  Follow the onscreen instructions onward. The software will open automatically once the installation is complete.

launch Mac cleaner

Step #2: Select Clean Up Junk

If you look at the left side of the interface, you’ll find six different options. These correspond to the six modules Mac Cleaner currently has, and these include (1) Clean Up Junk, (2) Delete Large Files, (3) Delete Duplicate Files, (4) Erase Private Data, (5) Speed Up Your Mac, and (6) Manage Apps & Extensions. Since you want to clear Xcode cache, you’ll mostly need the Clean Up Junk module since the app cache is a type of app junk file. This module allows you to get rid of junk files like System Junk, App Junk, Trash Bin, iOS Junk, Unused Disk Images, and Downloads. Select the module by clicking on it from the left sidebar.

clean up junk

Step #3: Click the Scan Button

Upon selecting the module, the software will split into two sides. One side says Quick Clean and the other says Deep Clean. Quick Clean scans your computer for the following file types: System Junk, App Junk, Trash Bin, and iTunes Junk, while Deep Clean scans the computer for those in addition to three more: Downloads, iOS Junk, and Unused Disk Images. Select the scanning option you want to use. You can choose either one since both scans are for App Junk. Then, click the Scan button.

quick clean scan Mac

Step #4: Pick a File Category and File/s

Once the scan is complete, you’ll find a list of items on the left side of the interface. These are the file categories that Clean Up Junk was able to scan, and they may include the following: System Junk, Downloads, Trash Bin, and Unused Disk Images. Select the App Junk category from this list. Upon doing so, a new list will appear on the right side of the interface. Select files from that list by clicking on their corresponding checkboxes. Make sure you select the correct files that correspond to your Xcode cache files. If you don’t know exactly which of them are the cache files, you can click the Select All box to select all the items in the list.

choose a file category and file

Step #5: Click the Clean Button

To finalize the process, you must click the blue button at the top-right corner of the window that says Clean. That will initiate the deletion process, and it may take a few minutes or so for it to complete. But that should be the last thing you need to do.

As you can see, it’s actually not that difficult to clear Xcode cache. Though the traditional methods may work, they’ll leave a couple of cache files behind in different parts of your computer. With Mac Cleaner, it should thoroughly clear out the cache.

delete the Junk files

Wrapping Up

While Xcode is an IDE, it’s just like any other software or app in that it also generates cache files. And if you know a thing or two about storage management, you’d know that clearing an application’s cache is crucial. Not only does the cache often take up a considerable amount of disk space, it also tends to have no use to your computer outside of its initial function from when it was made. Thankfully, it’s easy to clear Xcode cache, as long as you know what you’re doing. This guide should help in that regard.