Xcode 編譯時,都會產生不少 Cache 的檔案,要怎麼清除掉這些檔案呢?
- 註:目前環境 Xcode 10,目前看到 Xcode 10 以前都沒問題,10 以後還不確定
Xcode 清掉 Cache 的方法
想要清掉 Xcode 產生的 Cache,除了要省空間外,主要是遇到某些情況,想要將環境清乾淨,整個重新編譯,確認問題用。
Xcode 清除 Cache 的步驟
- 開啟 Xcode
- Command + Shift + K
- Command + Option + Shift + K
- 開啟 Terminal
- ls ~/Library/Developer/Xcode/DerivedData/ModuleCache # 先看看
- rm -fr ~/Library/Developer/Xcode/DerivedData/ModuleCache # 擔心的話建議先 mv 到自己目錄
- ls -lh "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.jon/ModuleCache" # path: /var/folders/gq/xxxxxxxxxxxxxxx/C/org.llvm.clang.jon/ModuleCache
- rm -fr "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.jon/ModuleCache" # 擔心的話建議先 mv 到自己目錄
- defaults delete com.apple.dt.Xcode # 清掉 xcode build cache
相關網頁
- 下述摘錄自此篇:Xcode Quick Fix - Clear Cache 此篇作者有直接寫一隻程式:fix-xcode.rb
- Clean the Build
- Command + Shift + K
- Product → Clean Build Folder
- Clean the Build Folder
- Command + Option + Shift + K
- Reset the Simulator Content and Settings
- Menu Bar → iOS Simulator → Reset Contents And Settings
- Delete Derived Data
- Menu Bar → Window → Organizer → Projects → Select Your Project
- Delete the Module Cache
- rm -fr ~/Library/Developer/Xcode/DerivedData/ModuleCache
- Delete Xcode Preferences
- defaults delete com.apple.dt.Xcode # terminal 直接輸入即可
- Clean the Build
- 下述摘錄自此篇:How to clear Xcode cache and stop crashes
- clean build: Command + Shift + K
- Clean out the build folder: Command + Shift + Option + K
- Reset Simulator content and settings: menu → iOS Simulator → click Reset Content and Settings
- Delete derived data: rm -fr ~/Library/Developer/Xcode/DerivedData/ModuleCache
- Launch Terminal: defaults delete com.apple.dt.Xcode
- How to Empty Caches and Clean All Targets Xcode 4 and later
- 乾淨的移除 Xcode - Qiita
在〈Xcode 清掉 Cache 的方法 - 2019〉中有 1 則留言