解决“Mac应用”已损坏,无法打开的问题

文章目录
  1. 1. 问题描述
  2. 2. 方案1: 开放系统安装来源
    1. 2.1. 使用命令行打开设置选项
    2. 2.2. 修改系统配置
      1. 2.2.1. 系统偏好设置
      2. 2.2.2. 安全性与隐私
      3. 2.2.3. 认证
      4. 2.2.4. 修改未任意来源
  3. 3. 方案2: 使用xattr命令修复App权限

问题描述

在Mac下安装一些软件时提示”来自身份不明开发者”,其实这是Mac新系统启用了新的安全机制。
默认只信任 Mac App Store 下载的软件和拥有开发者 ID 签名的应用程序。
换句话说就是 Mac 系统默认只能安装靠谱渠道(有苹果审核的 Mac App Store)下载的软件或被认可的人开发的软件。

这当然是为了用户不会稀里糊涂安装流氓软件中招,但没有开发者签名的 “老实软件” 也受影响了,安装就会弹出下图所示警告框:“xxx已损坏,打不开。您应将它移到废纸篓”或者“打不开 xxx,因为它来自身份不明的开发者”。

方案1: 开放系统安装来源

使用命令行打开设置选项

macOS Sierra 10.12及以上系统默认是不开启这个设置选项,需要通过命令行手动显示。

在终端内执行sudo spctl --master-disable

修改系统配置

修改系统配置:系统偏好设置… -> 安全性与隐私。

系统偏好设置

安全性与隐私

认证

修改未任意来源

方案2: 使用xattr命令修复App权限

Use xattr on the App Throwing the Damaged Error
This is sort of a last resort and is only recommended for advanced Mac users. Generally speaking if the app is still throwing a ‘damaged’ error message you might want to not use it. Use this at your own risk.

With the command line you can use xattr to view and remove extended attributes from a file on the Mac including the application throwing the “Appname.app is damaged and can’t be opened. You should move it to the Trash.” error message.

Launch Terminal and then issue the following command:

xattr -cr /path/to/application.app

For example:

xattr -cr /Applications/Signal.app

The -c flag removes all attributes, whereas -r applies recursively for the entire targeted .app directory contents.

The xattr command can also be used to remove the ‘application downloaded from the internet’ error message on the Mac too. Again this is only recommended to advanced users because modifying extended attributes may have unintended consequences, and again you might be attempting to run an app that you should not be running, either for stability, privacy, security, or other reasons.

Did the tricks above work to resolve the “Appname.app is damaged and can’t be opened. You should move it to the Trash.” error on the Mac for you? Do you know of another workaround or solution to resolving this error message? Share with us in the comments!