How can I clean xcode build cache?

11,223

How to clear Xcode cache manually

1. Clean the build

Tip: If you’re trying to fix a problem with Xcode crashing, it’s worth cleaning the project build first. This will get rid of the current build and create a new one next time you run the code.

With the project open in code, go to the menu bar, choose Product, and select Clean or: With the project open, press Command + Shift + K.

2. Clean out the build folder

To clean out the build folder, and get rid of cache files, do the following:

In the Code project, click on the Product menu while holding down the Option (Alt) key and choose Clean build folder, or: Press Command + Shift + Option + K.

3. Reset Simulator content and settings

If neither of the steps above resolves your problem, try resetting the simulator content and settings:

Go to the menu and choose iOS Simulator, then click Reset Content and Settings.

4. Delete derived data

If you’re still having problems, try deleting derived data, which will force Xcode to recreate it when you next run it.

In the menu, choose Window, then Organizer. Now select Projects, and then click Select your project. Choose the project whose derived data you want to delete. In the window that opens, you’ll see see the Derived Data folder listed, along with its Finder path. To the right of the folder, there’s a Delete button. Press it. Now, delete the module cache.

Go to: ~/Library/Developer/Xcode/DerivedData/ModuleCache. Drag the files from the ModuleCache folder to the Trash and empty it.


Source: https://macpaw.com/how-to/clear-xcode-cache

Share:
11,223
Ali Shahnazi
Author by

Ali Shahnazi

Informix & SQL Server DBA

Updated on June 05, 2022

Comments

  • Ali Shahnazi
    Ali Shahnazi almost 2 years

    Any change I do in Xcode, build successfully but when I review it in simulator or transfer it to my iPhone, the previous successful build which was sent to the store is running.

    It was a working application with history of changes in app store, then I decided to change the name and unique identifier. All went well and I was able to deploy first changes to the store, after that xcode started to show this odd behavior. I made changes, built successfully but the previous version showed up in simulator etc. Then I found a silly workaround, every change I made, I rebuilt the environment by pull the code from my repo and

    #cordova add platform [email protected]
    #pod update
    #pod setup
    #pod install
    

    Then open the Xcode and built the project, then everything was as expected. but unfortunately this trick stopped working as well and I stuck. I do clean I do clear DerivedData folder I do use "watchdog" application to do cleaning

    Did I miss anything?

    • Teja Nandamuri
      Teja Nandamuri almost 5 years
      you can do cmd + shft + K to clean , and then run your application
    • Ali Shahnazi
      Ali Shahnazi almost 5 years
      Thanks. But this is not resolving my issue. I mentioned that every time I do clean.
  • Ali Shahnazi
    Ali Shahnazi almost 5 years
    Thanks @Troy. It didn't resolve my issue. Now wonder if my issue is related to the cache!
  • Ali Shahnazi
    Ali Shahnazi almost 5 years
    For those who struggle to find step 3 of Troy's comment: Xcode => Open Developer Tool => Simulator who runs the simulator then Hardware => Erase All content and setting