[{"data":1,"prerenderedAt":599},["ShallowReactive",2],{"blog-article-\u002Fblog\u002Fhow-to-clear-xcode-derived-data-safely":3},{"id":4,"title":5,"author":6,"body":7,"category":579,"cover":580,"coverAlt":581,"description":582,"draft":583,"extension":584,"meta":585,"navigation":586,"path":587,"publishedAt":588,"seo":589,"stem":590,"tags":591,"translationKey":596,"updatedAt":597,"__hash__":598},"articles_en\u002Fblog\u002Fhow-to-clear-xcode-derived-data-safely.md","How to Clear Xcode Derived Data Safely","Harry",{"type":8,"value":9,"toc":563},"minimark",[10,19,27,33,38,41,57,60,63,80,83,87,173,184,188,191,220,223,227,230,296,299,315,318,338,341,388,391,395,402,405,444,447,451,454,457,460,464,473,484,488,493,496,500,503,507,510,514,517,521,551,559],[11,12,13,14,18],"p",{},"Yes, you can safely delete Xcode Derived Data. The default folder contains generated build products and indexes that Xcode can create again. Deleting it does ",[15,16,17],"strong",{},"not"," delete your project source code, but the next build and code indexing pass will take longer.",[11,20,21,22,26],{},"The important part is scope: quit Xcode first and make sure you are deleting ",[23,24,25],"code",{},"~\u002FLibrary\u002FDeveloper\u002FXcode\u002FDerivedData",", not Archives, simulator devices, or a project folder.",[28,29,30],"blockquote",{},[11,31,32],{},"Paths and inspection commands verified on macOS 15.7.7 with Xcode 16.2 on August 10, 2026. Xcode menus can move between releases, but the default Derived Data path and the Terminal methods below remain applicable unless you configured a custom build location.",[34,35,37],"h2",{"id":36},"what-is-xcode-derived-data","What is Xcode Derived Data?",[11,39,40],{},"Xcode uses Derived Data as a workspace for files it generates while building and understanding a project. It commonly includes:",[42,43,44,48,51,54],"ul",{},[45,46,47],"li",{},"compiled products and intermediate build files;",[45,49,50],{},"the code index used by navigation, search, and completion;",[45,52,53],{},"logs and other per-project build support data;",[45,55,56],{},"local Swift package checkouts and related build data for that workspace.",[11,58,59],{},"Apple documents the index inside a workspace-specific Derived Data directory, and its Xcode release notes recommend clearing a project's Derived Data as a recovery step for some build problems. In other words, this folder is meant to be reproducible—not the authoritative copy of your source code.",[11,61,62],{},"Deleting it can help when:",[42,64,65,68,71,74,77],{},[45,66,67],{},"old projects have left several gigabytes of generated data;",[45,69,70],{},"a build keeps using stale results;",[45,72,73],{},"code completion or indexing behaves incorrectly;",[45,75,76],{},"a package or macro build fails after an Xcode update;",[45,78,79],{},"you need disk space and accept a slower first rebuild.",[11,81,82],{},"Do not clear it on a schedule just because it exists. Active projects benefit from incremental build data, so removing a small, healthy folder only trades disk space for build time.",[34,84,86],{"id":85},"what-is-safe-to-delete","What is safe to delete?",[88,89,90,106],"table",{},[91,92,93],"thead",{},[94,95,96,100,103],"tr",{},[97,98,99],"th",{},"Location",[97,101,102],{},"Recommendation",[97,104,105],{},"What happens after deletion",[107,108,109,123,136,149,162],"tbody",{},[94,110,111,117,120],{},[112,113,114],"td",{},[23,115,116],{},"~\u002FLibrary\u002FDeveloper\u002FXcode\u002FDerivedData\u002FProjectName-*",[112,118,119],{},"Safe for a project you recognize",[112,121,122],{},"That project rebuilds and reindexes",[94,124,125,130,133],{},[112,126,127,128],{},"Everything inside ",[23,129,25],{},[112,131,132],{},"Safe when you need a full reset",[112,134,135],{},"Every Xcode project rebuilds and reindexes",[94,137,138,143,146],{},[112,139,140],{},[23,141,142],{},"~\u002FLibrary\u002FDeveloper\u002FXcode\u002FArchives",[112,144,145],{},"Do not treat as cache",[112,147,148],{},"You may lose archived builds and the matching debug symbols needed for distribution or crash analysis",[94,150,151,156,159],{},[112,152,153],{},[23,154,155],{},"~\u002FLibrary\u002FDeveloper\u002FCoreSimulator\u002FDevices",[112,157,158],{},"Review separately",[112,160,161],{},"You may lose simulator apps, settings, and test data",[94,163,164,167,170],{},[112,165,166],{},"Your repository or project directory",[112,168,169],{},"Do not delete",[112,171,172],{},"This is your actual source code and project configuration",[11,174,175,176,179,180,183],{},"Also check Xcode ",[15,177,178],{},"Settings → Locations"," before cleanup. If Derived Data is set to ",[15,181,182],{},"Custom",", use the location shown there instead of assuming the default path.",[34,185,187],{"id":186},"method-1-remove-derived-data-with-finder","Method 1: Remove Derived Data with Finder",[11,189,190],{},"This is the clearest method when you want to inspect project folders before removing anything.",[192,193,194,197,204,211,214,217],"ol",{},[45,195,196],{},"Save your work and stop any running build or test.",[45,198,199,200,203],{},"Open ",[15,201,202],{},"Xcode → Settings → Locations",".",[45,205,206,207,210],{},"Find ",[15,208,209],{},"Derived Data"," and select the arrow beside its path to reveal the directory in Finder.",[45,212,213],{},"Quit Xcode.",[45,215,216],{},"Move only the folder for the affected project to Trash. If you want a complete reset, move the contents of the Derived Data directory instead.",[45,218,219],{},"Reopen Xcode and build the project again.",[11,221,222],{},"Using Trash gives you a short recovery window. Empty it only after confirming that the project opens and rebuilds as expected.",[34,224,226],{"id":225},"method-2-inspect-and-clear-it-from-terminal","Method 2: Inspect and clear it from Terminal",[11,228,229],{},"First confirm the folder and its total size:",[231,232,237],"pre",{"className":233,"code":234,"language":235,"meta":236,"style":236},"language-bash shiki shiki-themes github-light github-dark","du -sh \"$HOME\u002FLibrary\u002FDeveloper\u002FXcode\u002FDerivedData\"\ndu -sh \"$HOME\u002FLibrary\u002FDeveloper\u002FXcode\u002FDerivedData\"\u002F* 2>\u002Fdev\u002Fnull | sort -h\n","bash","",[23,238,239,263],{"__ignoreMap":236},[240,241,244,248,252,256,260],"span",{"class":242,"line":243},"line",1,[240,245,247],{"class":246},"sScJk","du",[240,249,251],{"class":250},"sj4cs"," -sh",[240,253,255],{"class":254},"sZZnC"," \"",[240,257,259],{"class":258},"sVt8B","$HOME",[240,261,262],{"class":254},"\u002FLibrary\u002FDeveloper\u002FXcode\u002FDerivedData\"\n",[240,264,266,268,270,272,274,277,280,284,287,290,293],{"class":242,"line":265},2,[240,267,247],{"class":246},[240,269,251],{"class":250},[240,271,255],{"class":254},[240,273,259],{"class":258},[240,275,276],{"class":254},"\u002FLibrary\u002FDeveloper\u002FXcode\u002FDerivedData\"\u002F",[240,278,279],{"class":250},"*",[240,281,283],{"class":282},"szBVR"," 2>",[240,285,286],{"class":254},"\u002Fdev\u002Fnull",[240,288,289],{"class":282}," |",[240,291,292],{"class":246}," sort",[240,294,295],{"class":250}," -h\n",[11,297,298],{},"Each project directory normally starts with a readable project name followed by a unique suffix. To inspect it in Finder:",[231,300,302],{"className":233,"code":301,"language":235,"meta":236,"style":236},"open \"$HOME\u002FLibrary\u002FDeveloper\u002FXcode\u002FDerivedData\"\n",[23,303,304],{"__ignoreMap":236},[240,305,306,309,311,313],{"class":242,"line":243},[240,307,308],{"class":246},"open",[240,310,255],{"class":254},[240,312,259],{"class":258},[240,314,262],{"class":254},[11,316,317],{},"To permanently remove one project, replace the example directory name with the exact name from your own output:",[231,319,321],{"className":233,"code":320,"language":235,"meta":236,"style":236},"rm -rf \"$HOME\u002FLibrary\u002FDeveloper\u002FXcode\u002FDerivedData\u002FYourProject-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n",[23,322,323],{"__ignoreMap":236},[240,324,325,328,331,333,335],{"class":242,"line":243},[240,326,327],{"class":246},"rm",[240,329,330],{"class":250}," -rf",[240,332,255],{"class":254},[240,334,259],{"class":258},[240,336,337],{"class":254},"\u002FLibrary\u002FDeveloper\u002FXcode\u002FDerivedData\u002FYourProject-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n",[11,339,340],{},"To permanently remove every entry in the default Derived Data folder:",[231,342,344],{"className":233,"code":343,"language":235,"meta":236,"style":236},"find \"$HOME\u002FLibrary\u002FDeveloper\u002FXcode\u002FDerivedData\" \\\n  -mindepth 1 -maxdepth 1 -exec rm -rf {} +\n",[23,345,346,361],{"__ignoreMap":236},[240,347,348,351,353,355,358],{"class":242,"line":243},[240,349,350],{"class":246},"find",[240,352,255],{"class":254},[240,354,259],{"class":258},[240,356,357],{"class":254},"\u002FLibrary\u002FDeveloper\u002FXcode\u002FDerivedData\"",[240,359,360],{"class":250}," \\\n",[240,362,363,366,369,372,374,377,380,382,385],{"class":242,"line":265},[240,364,365],{"class":250},"  -mindepth",[240,367,368],{"class":250}," 1",[240,370,371],{"class":250}," -maxdepth",[240,373,368],{"class":250},[240,375,376],{"class":250}," -exec",[240,378,379],{"class":254}," rm",[240,381,330],{"class":250},[240,383,384],{"class":254}," {}",[240,386,387],{"class":254}," +\n",[11,389,390],{},"These commands bypass Trash. Read the full path before pressing Return, and do not run the final command if Xcode is building, testing, or indexing.",[34,392,394],{"id":393},"method-3-try-clean-build-folder-first","Method 3: Try Clean Build Folder first",[11,396,397,398,401],{},"If one project has a build problem but you do not need to remove its index and all other generated workspace data, start with ",[15,399,400],{},"Product → Clean Build Folder"," in Xcode. Apple also documents this command as a troubleshooting step.",[11,403,404],{},"The command-line equivalent for a workspace can look like this:",[231,406,408],{"className":233,"code":407,"language":235,"meta":236,"style":236},"xcodebuild \\\n  -workspace YourApp.xcworkspace \\\n  -scheme YourApp \\\n  clean\n",[23,409,410,417,427,438],{"__ignoreMap":236},[240,411,412,415],{"class":242,"line":243},[240,413,414],{"class":246},"xcodebuild",[240,416,360],{"class":250},[240,418,419,422,425],{"class":242,"line":265},[240,420,421],{"class":250},"  -workspace",[240,423,424],{"class":254}," YourApp.xcworkspace",[240,426,360],{"class":250},[240,428,430,433,436],{"class":242,"line":429},3,[240,431,432],{"class":250},"  -scheme",[240,434,435],{"class":254}," YourApp",[240,437,360],{"class":250},[240,439,441],{"class":242,"line":440},4,[240,442,443],{"class":254},"  clean\n",[11,445,446],{},"This is narrower than deleting the entire Derived Data directory. It asks the selected build system to clean that project's build products; it is not a general disk cleanup command for every Xcode workspace.",[34,448,450],{"id":449},"what-should-you-expect-after-cleanup","What should you expect after cleanup?",[11,452,453],{},"The first build will usually be slower. Xcode needs to rebuild targets, recreate its index, and may need to resolve or fetch package data again. Code completion and jump-to-definition can also be incomplete until indexing catches up.",[11,455,456],{},"Your project files, Git history, signing certificates, provisioning profiles, and Xcode Archives are outside the default Derived Data root. They are not affected when you delete only the exact path described above.",[11,458,459],{},"If the original build error returns after a clean rebuild, Derived Data was probably not the root cause. Check the first meaningful compiler error, dependency resolution, the selected Xcode version, and project build settings instead of repeatedly clearing caches.",[34,461,463],{"id":462},"review-xcode-derived-data-with-mangodisk","Review Xcode Derived Data with MangoDisk",[11,465,466,467,472],{},"If you prefer to see the size and exact location before cleaning, ",[468,469,471],"a",{"href":470},"\u002Fdocs\u002Ffeatures\u002Fdeep-clean","MangoDisk Deep Cleanup"," includes a dedicated Xcode Derived Data rule.",[11,474,475,476,478,479,483],{},"The rule is intentionally narrow: it targets only the default ",[23,477,25],{}," root, requires Xcode to be closed, and is not selected by default. It does not include project source, Archives, signing material, simulator devices, or installed simulator runtimes. Scanning happens locally, and you review the result before cleanup. See the ",[468,480,482],{"href":481},"\u002Fdocs\u002Fsafety","MangoDisk safety guide"," for the full confirmation and cleanup-history workflow.",[34,485,487],{"id":486},"frequently-asked-questions","Frequently asked questions",[489,490,492],"h3",{"id":491},"can-i-delete-derived-data-while-xcode-is-open","Can I delete Derived Data while Xcode is open?",[11,494,495],{},"Do not delete it during a build, test, or indexing operation. Quit Xcode first so files are not being rewritten while cleanup is in progress.",[489,497,499],{"id":498},"will-deleting-derived-data-fix-every-xcode-build-error","Will deleting Derived Data fix every Xcode build error?",[11,501,502],{},"No. It is useful for stale or inconsistent generated data, but it cannot fix source errors, invalid signing, missing dependencies, or incorrect build settings.",[489,504,506],{"id":505},"how-often-should-i-clear-it","How often should I clear it?",[11,508,509],{},"Clear it when you need meaningful disk space or have evidence of stale build data. There is no benefit to removing healthy Derived Data after every build.",[489,511,513],{"id":512},"why-did-the-folder-come-back","Why did the folder come back?",[11,515,516],{},"That is expected. Xcode recreates Derived Data as soon as you build or index a project. Cleanup reclaims old generated data; it does not disable future build caching.",[34,518,520],{"id":519},"sources","Sources",[42,522,523,531,538,545],{},[45,524,525],{},[468,526,530],{"href":527,"rel":528},"https:\u002F\u002Fdeveloper.apple.com\u002Fdocumentation\u002FXcode-Release-Notes\u002Fxcode-26-release-notes",[529],"nofollow","Xcode 26 Release Notes: Derived Data cleanup recovery steps",[45,532,533],{},[468,534,537],{"href":535,"rel":536},"https:\u002F\u002Fdeveloper.apple.com\u002Fdocumentation\u002Ftechnotes\u002Ftn3118-debugging-your-apps-launch-screen",[529],"Apple Technical Note TN3118: Clean Build Folder",[45,539,540],{},[468,541,544],{"href":542,"rel":543},"https:\u002F\u002Fdeveloper.apple.com\u002Flibrary\u002Farchive\u002Fdocumentation\u002FXcode\u002FConceptual\u002FRN-Xcode-Archive\u002FChapters\u002Fxc4_release_notes.html",[529],"Xcode 4 Release Notes: workspace indexes in Derived Data",[45,546,547],{},[468,548,550],{"href":549},"\u002Fblog\u002Fcargo-cache-vs-target-folder","Cargo Cache vs target Folder: What Can You Delete?",[11,552,553,554,558],{},"Want to review generated developer files visually before deciding what to remove? ",[468,555,557],{"href":556},"\u002F","Download MangoDisk"," and run Deep Cleanup locally.",[560,561,562],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":236,"searchDepth":265,"depth":265,"links":564},[565,566,567,568,569,570,571,572,578],{"id":36,"depth":265,"text":37},{"id":85,"depth":265,"text":86},{"id":186,"depth":265,"text":187},{"id":225,"depth":265,"text":226},{"id":393,"depth":265,"text":394},{"id":449,"depth":265,"text":450},{"id":462,"depth":265,"text":463},{"id":486,"depth":265,"text":487,"children":573},[574,575,576,577],{"id":491,"depth":429,"text":492},{"id":498,"depth":429,"text":499},{"id":505,"depth":429,"text":506},{"id":512,"depth":429,"text":513},{"id":519,"depth":265,"text":520},"Developer Disk Cleanup","\u002Fimages\u002Fblog\u002Fhow-to-clear-xcode-derived-data-safely.webp","Developer reviewing generated Xcode build data before reclaiming disk space","Learn what Xcode Derived Data contains, when it is safe to delete, and how to clear one project or the entire folder without touching source code",false,"md",{},true,"\u002Fblog\u002Fhow-to-clear-xcode-derived-data-safely","2026-08-10T00:00:00+08:00",{"title":5,"description":582},"blog\u002Fhow-to-clear-xcode-derived-data-safely",[592,593,594,595],"Xcode Derived Data","Xcode cache","macOS","Developer disk cleanup","article-how-to-clear-xcode-derived-data-safely","2026-08-12T00:00:00+08:00","Dm8pzCbbYaXAbVVE_kdAyNB41ElWNNxrwE49sbWRM9g",1786706051540]