You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

M1芯片模拟器运行项目报错:添加排除架构后仍出现Command PhaseScriptExecution failed with a nonzero exit code错误

Fixing "Command PhaseScriptExecution failed with a nonzero exit code" on M1 Mac After Adjusting Excluded Architectures

Hey there, I’ve run into this exact headache a few times with M1 Macs and Xcode simulator builds—let’s walk through some practical fixes to get your project running again:

  • Launch Xcode via Rosetta
    A lot of older build scripts still aren’t optimized for arm64. Right-click the Xcode app in your Applications folder, select Get Info, check "Open using Rosetta", then restart Xcode and try building again. This forces Xcode to run in x86_64 mode, which often resolves script compatibility issues.

  • Verify and fix script permissions
    The error might stem from a build script lacking execute permissions. To fix this:

    1. Locate the problematic script from the error log (it’ll show the full path, e.g., Pods/Target Support Files/Pods-YourApp/Pods-YourApp-frameworks.sh).
    2. Open Terminal, run chmod +x /full/path/to/your/script.sh to grant execute access.
    3. Rebuild your project.
  • Clean project and reset Derived Data
    Corrupted cache is a super common culprit here:

    • Press Cmd + Shift + K in Xcode to clean the project.
    • Go to Xcode > Settings > Locations, click the arrow next to Derived Data to open the folder. Delete the folder for your project, then restart Xcode and rebuild.
  • Update your CocoaPods configuration (if using Pods)
    If you’re using CocoaPods, make sure your Podfile has M1-compatible settings. Add this block at the end of your Podfile:

    post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
        end
      end
    end
    

    Then run pod install in Terminal, and rebuild your project.

  • Reset Xcode’s global build cache
    Sometimes the global Xcode cache gets messed up. Run this command in Terminal to clear it:

    rm -rf ~/Library/Caches/com.apple.dt.Xcode
    

    Restart Xcode after running this, then try building again.

If none of these work, grab the full error log from the Report Navigator (the last tab in Xcode’s left sidebar) and share the specific script that’s failing—this will help narrow down the exact issue.

内容的提问来源于stack exchange,提问作者NoName555

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.01 00:53:13