Xcode 27 Validate App 卡在 Preparing:dwarfdump-classic「bad CPU type」的解決方法
在 Apple silicon Mac 上,若 xcrun 將 dwarfdump-classic 解析到舊的僅支援 Intel 的 Command Line Tools 副本,且未安裝 Rosetta,Xcode 27 的驗證與上傳可能卡在 Preparing。將該副本移開並選用 Xcode 即可解決。

如果在搭載 Xcode 27 的 Apple silicon Mac 上,Validate App、Distribute App 或 Transporter 一直停在「Preparing」,請檢查 xcrun 是否把 dwarfdump-classic 解析到 /Library/Developer/CommandLineTools 中舊的、僅支援 Intel 的副本。沒有 Rosetta 時,該執行檔無法啟動,而根據開發者回報,驗證輔助程式不會報錯,只會一直等待。請將過時的 Command Line Tools 資料夾移開,並讓 xcode-select 指向 Xcode 27;安裝 Rosetta 則是短期的替代做法。
Apple 尚未公布根本原因。以下診斷來自 Apple Developer Forums 上的開發者,而在該處回覆的一位 DTS 工程師只是請對方提交錯誤回報,並未證實其運作機制。
卡住時的現象
回報中提到的環境是 Apple silicon 上的 macOS 27.0 與 Xcode 27.0 (27A266a)。封存、簽署與 IPA 打包都能成功,接著 Organizer 會停在某個進度階段,且永遠不會逾時。開發者回報的階段包括「Preparing…」、帶有「Analyzing app」的「Validating…」,以及上傳時的:
Preparing to upload [App].ipa
Xcode 介面不會出現任何錯誤。Transporter 1.4.5 會以同樣方式卡住,對 IPA 執行 xcrun swinfo 也會卡住。有位開發者提到,同一個專案透過 Xcode Cloud 上傳卻毫無問題,這表示問題出在本機工具鏈,而不是 App 本身。
只有自行執行該工具時,才會看到錯誤:
% /Library/Developer/CommandLineTools/usr/bin/dwarfdump-classic --help
zsh: bad CPU type in executable
發生原因
根據論壇回報,Xcode 與 Transporter 在驗證期間執行的 swinfo 輔助程式會呼叫 dwarfdump-classic。thread 847303 的發文者表示,Xcode 27 已不再內附該工具,因此查找會退回到位於 /Library/Developer/CommandLineTools 的獨立 Command Line Tools。在受影響的 Mac 上,該資料夾中是僅支援 x86_64 的副本,其中一例是 2019 年的版本,由 Migration Assistant 一併帶過來。
以下兩項有文件記載的平台事實,說明了為何現在才出現這個問題:
- Xcode 27 版本說明指出,Xcode 27 只能安裝並執行於 Apple silicon Mac。
- macOS 27 版本說明指出,若先前已安裝 Rosetta,升級至 macOS 27.0 後不會自動還原。
原本升級前透過 Rosetta 執行的僅限 Intel 執行檔,現在完全無法啟動。在這些回報中,swinfo 不會顯示這個失敗,只是一直等待。
如何確認是不是這個問題?
執行以下三個指令。下列預期輸出是某位開發者在 thread 845212 中貼出的內容。
xcode-select --print-path
# /Applications/Xcode.app/Contents/Developer
xcrun --find dwarfdump-classic
# /Library/Developer/CommandLineTools/usr/bin/dwarfdump-classic
file "$(xcrun --find dwarfdump-classic)"
# Mach-O 64-bit executable x86_64
請注意,在該回報中 xcode-select 已經指向 Xcode,但 xcrun 仍然在 Command Line Tools 中找到該工具。如果 xcrun --find 的結果落在 CommandLineTools,而且 file 只列出 x86_64,那就是原因所在。在 xcrun 指令加上 --verbose,可以看到查找的進行方式。
為了確認 Rosetta 是否存在,原發文者查看了 /Library/Apple/usr/libexec/oah/ 中有沒有 libRosettaRuntime。這個檢查方式來自論壇,並非 Apple 文件。
解法:將過時的 Command Line Tools 移開並選用 Xcode
以下指令需要管理員密碼。移動資料夾不會刪除任何內容,之後仍可還原。
- 結束 Xcode 與 Transporter,並取消任何卡住的驗證。
- 將舊的獨立 Command Line Tools 移開:
sudo mv /Library/Developer/CommandLineTools /Library/Developer/CommandLineTools-old - 將 Xcode 27 設為使用中的開發者目錄。若你的 Xcode 不在標準位置,請調整路徑:
依 Apple 文件所述,sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer--switch需要超級使用者權限,且會影響這台 Mac 上的所有使用者。你也可以在 Xcode > Settings > Locations 的 Command Line Tools 項目中選擇 Xcode 版本。 - 清除
xcrun的查找快取,讓它重新解析工具。xcrun 的 man page(man xcrun)說明,--kill-cache會移除快取,並使所有值重新快取:xcrun --kill-cache - 重新開啟 Xcode,再次封存並執行 Validate App。
thread 845212 中的開發者回報,執行前兩個指令後,swinfo 就會回到 shell,不再卡住;接著重新封存的版本驗證通過,顯示「Your app successfully passed all validation checks.」
替代做法:安裝 Rosetta
安裝 Rosetta 可以讓舊的執行檔運作,thread 847303 的發文者便是搭配上述的移開步驟一併使用。Apple 支援文件提供了 Terminal 指令;Mac 必須連上網路:
softwareupdate --install-rosetta
請將這視為權宜之計。同一份 Apple 支援文件指出,自 macOS 28 起,Rosetta 將只提供給某些依賴 Intel 框架的舊版遊戲使用。屆時,建置路徑上任何僅限 Intel 的工具都會再次失效。
如何確認已經解決?
xcrun --find dwarfdump-classic不再傳回/Library/Developer/CommandLineTools內的路徑。若目前使用的 Xcode 沒有這個工具,它可能會傳回錯誤。xcrun swinfo會回到提示符號,不再卡住。在 thread 845212 中,它隨後印出另一個bitcode-build-tool內部錯誤,但 Organizer 的驗證仍然成功。- Organizer 越過「Preparing」,要不是驗證通過,就是回報真正的錯誤。
變化情況與例外狀況
- 過時的
~/.itmstransporter資料夾。在 thread 845212 中,有位開發者遇到同樣的卡住問題,刪除了存放 2018 與 2019 年 Transporter 檔案的~/.itmstransporter後即解決。若想保留退路,請改為重新命名而非刪除。 - 你仍需要獨立的 Command Line Tools。移開舊資料夾後,請以
xcode-select --install或「軟體更新」安裝最新的套件,用pkgutil --pkg-info=com.apple.pkg.CLTools_Executables檢查,然後再次執行xcrun --find dwarfdump-classic與file,確認查找路徑上沒有僅支援 x86_64 的副本回來。 - 永久移除舊副本。Apple 文件記載的指令是
sudo rm -rf /Library/Developer/CommandLineTools。這會永久刪除該資料夾。若要避免「軟體更新」再次提供該套件,Apple 文件記載的做法是sudo pkgutil --forget com.apple.dt.commandlinetools。 - 上傳仍被擋住。在 thread 847720 中,Organizer 上傳卡住的開發者改用 Xcode Cloud,或在 Terminal 以
xcrun iTMSTransporter -m upload發布(貼出該指令的開發者還以-assetFile傳入 IPA 路徑、以-u傳入 Apple ID、以-p傳入 App 專用密碼,並以-itc_provider傳入提供者簡稱)。 - 不同的 swinfo 失敗情形。在 thread 847720 中,原發文者轉述了某個 AI 程式設計助理未經驗證的診斷:
swinfo是當掉(SIGSEGV,結束代碼 139),而不是在等待dwarfdump-classic。如果xcrun --find dwarfdump-classic並未指向CommandLineTools,這個解法大概不適用;請改用上述的上傳替代做法。 - Transporter 當機。thread 847303 也回報 Transporter 1.4.5 在 macOS 27.0 上繪製活動佇列時會當機。這看起來是另一個獨立的錯誤。
如何在建置用 Mac 上預防
- 移轉 Mac 或升級 macOS 之後,對
/Library/Developer/CommandLineTools/usr/bin/dwarfdump-classic執行file。若只顯示x86_64,請依上述方式將整個資料夾移開。若之後仍需要獨立工具,請安裝最新的 Command Line Tools,並再次執行相同的 file 檢查。 - Apple 建議每次升級 macOS 後都檢查是否有新版 Command Line Tools,因為已安裝的版本可能與新的 macOS 不相容。
- 在自行代管的建置機器上,請以
xcode-select --switch或DEVELOPER_DIR明確指定開發者目錄,並將xcrun --find dwarfdump-classic檢查加入你的佈建腳本。 - 發行用的工具不要倚賴 Rosetta。macOS 27 升級不會還原它,而在 macOS 28 中它也受到限制。
資料來源
- Apple Developer Forums: Xcode 27 Validate App and Upload hang at Preparing
- Apple Developer Forums: Xcode 27 RC App Store Connect validation/upload hangs
- Apple Developer Forums: Xcode 27.0 RC hangs at Preparing to upload
- Apple Developer Documentation: Installing the command-line tools
- Apple Developer Documentation: Configuring command-line tools settings
- Apple Developer Documentation: macOS 27 Golden Gate Release Notes
- Apple Developer Documentation: Xcode 27 Release Notes
- Apple Support: Using Intel-based apps on a Mac with Apple silicon


