2019独角兽企业重金招聘Python工程师标准>>>
有时候我们即使安装了一些来源奇怪的软件,也无法运行。使用终端运行则有如下提示:
LSOpenURLsWithRole() failed with error -10810 for the file /Applications/xxx.app.
这是因为 Mojave 引入了新的签名校验机制。需要重新签名:
$ codesign --sign - --force --deep /Applications/xxx.app
/Applications/xxx.app: replacing existing signature
如果包内有其他 app,还需要单独执行:
$ codesign --sign - --force --deep /Applications/xxx.app/Contents/path/to/inside.app
有些 app 依赖于开发者工具包,需先安装 Xcode,再执行:
$ xcode-select --install
有些 dmg 里真正的安装包是隐藏的,可以通过以下命令在 finder 里显示隐藏文件夹:
$ defaults write com.apple.finder AppleShowAllFiles Yes && killall Finder
复制隐藏文件后文件仍然是隐藏的,通过以下命令取消隐藏和其他属性:
$ chflags nohidden /path/to/hidden.file
$ xattr -cr /path/to/hidden.file
如果在签名那一步遇到这个错误,十有八九是忘了取消文件的隐藏标志:
/Application/xxx.app: resource fork, Finder information, or similar detritus not allowed