使用altool公证Mac应用报错No command argument was specified怎么解决
问题根因定位与修复步骤
1. 核心错误修复(直接解决当前报错)
你遇到的No command argument was specified报错由两个低级命令格式错误直接导致:
- 参数前缀符号错误:命令中
—notarize-app、—password前的横线是全角长破折号,不符合命令要求的两个半角短横线--格式,系统无法识别对应参数 - 换行格式错误:命令拆分多行书写时没有加续行符
\,系统会将每一行识别为独立命令,导致参数丢失
修改后的正确命令如下(单行版):
xcrun altool --notarize-app -f /Users/fishbacp/Desktop/determinants/determinant_calculator.zip --primary-bundle-id org.gvsu.determinant -u my_email@gmail.com --password "@keychain:AC_PASSWORD"
如果需要分行书写,需在每行末尾添加续行符\:
xcrun altool --notarize-app -f \ /Users/fishbacp/Desktop/determinants/determinant_calculator.zip --primary-bundle-id \ org.gvsu.determinant -u my_email@gmail.com --password "@keychain:AC_PASSWORD"
2. 后续避坑优化
altool的公证功能已被苹果官方弃用,macOS 12及以上系统推荐使用稳定性更高、报错提示更清晰的notarytool完成公证:
- 提交公证命令(直接复用你已经存在钥匙串的
AC_PASSWORD凭证):
xcrun notarytool submit /Users/fishbacp/Desktop/determinants/determinant_calculator.zip --keychain-profile "AC_PASSWORD" --wait
- 公证成功后,将公证凭证钉到应用上:
xcrun stapler staple 你的应用本地路径/determinant_calculator.app
3. 前置校验项(提前排除后续可能出现的公证失败问题)
- 确认签名应用的Bundle ID与你在开发者平台创建的
org.gvsu.determinant完全一致 - 确认应用签名时已经开启硬化运行时(公证强制要求,签名时需添加
--options=runtime参数) - 确认zip包使用
ditto命令打包,避免资源分支、权限丢失导致公证不通过:
ditto -c -k --sequesterRsrc --keepParent ./determinant_calculator.app ./determinant_calculator.zip
内容的提问来源于stack exchange,提问作者fishbacp
相关产品推荐
相关产品推荐

