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

运行flutter run报错:找不到xcodebuild工具,旧Xcode无法升级求助

解决 xcrun: error: unable to find utility "xcodebuild" 问题(适配Xcode 13.2旧版本)
  • 检查Xcode命令行工具路径
    打开终端执行:

    xcode-select -p
    

    如果输出不是/Applications/Xcode.app/Contents/Developer,执行以下命令修正路径(确保你的Xcode安装在Applications目录,路径不符请自行调整):

    sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
    
  • 确认Xcode授权与命令行工具配置

    1. 打开Xcode,进入Xcode > Preferences > Locations,在Command Line Tools下拉菜单中选择Xcode 13.2
    2. 终端执行以下命令接受Xcode许可协议:
      sudo xcodebuild -license accept
      
  • 补充PATH环境变量
    检查当前PATH是否包含Xcode工具目录:

    echo $PATH
    

    如果看不到/Applications/Xcode.app/Contents/Developer/usr/bin,需要添加到环境变量:

    • 若使用bash,编辑~/.bash_profile文件,添加:
      export PATH="/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH"
      
      保存后执行source ~/.bash_profile生效
    • 若使用zsh,编辑~/.zshrc文件,添加同样的代码,执行source ~/.zshrc生效
  • 重启验证
    关闭所有终端窗口,重新打开后执行flutter run,同时建议重启你的IDE(VS Code/Android Studio)确保环境变量完全生效

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.07 00:14:54