How to solve the problem that the Mac application prompts that it is damaged and cannot be opened
Solution to the problem that Mac application prompts “damaged” and cannot be opened
When downloading an app on your Mac, you might get an error message saying “XXX is damaged and cannot be opened,” preventing you from using the app properly. This is usually because there’s a problem with the app’s signature information during the download process. Here’s how to fix this annoying issue:
Temporarily bypass notarization
If you just want a quick fix, you can use a notarization bypass:
- Click the “Launchpad” in the upper left corner of your Mac, then open the “Terminal” program under “Other” to start the terminal window.
- In the terminal window, enter the following command first, remember to leave a space at the end:
sudo xattr -rd com.apple.quarantine
如:sudo xattr -rd com.apple.quarantine /Applications/25mac.app
- Then open “Finder”, go to the “Applications” folder, find the application icon with the problem, and drag it directly to the terminal window
- After dragging the application icon, press the Enter key to execute the command
- You will be prompted to enter your password. Enter your Mac’s system login password and press Enter.
- The password will not be displayed, just press Enter to confirm
- Done! Now you can open the app without any corruption warnings.
The above steps can quickly and temporarily fix the issue of not being able to open the app, but it will become invalid again after restarting the computer. If you want to completely fix it, you can try the re-signing method below.
Re-signing the app
This method can permanently fix the application signature and solve the problem:
- Open the Terminal program and enter the following command, remembering to leave a space at the end:
sudo codesign --force --deep --sign - 如:sudo codesign --force --deep --sign - /Applications/25mac.app
- Then open the “Applications” folder and drag the problem application into the terminal
- Press Enter to execute the command, enter the password, and complete the signature
- This time after restarting the computer, the problem of being unable to open will no longer occur.
SIP Method
You can choose one of the above two methods to solve the “damaged” application problem according to your needs and reopen the application without any obstacles. If the error still occurs, you can use a big move and turn off SIP file system protection. For details, please refer How to disable SIP System Integrity Protection on Mac
Advanced
The sudo xattr -rd com.apple.quarantine command is explained as follows:
sudo – Obtain root privileges to execute commands
xattr – Manage extended file attributes on macOS
-r – Recursively remove extended attributes from specified files
-d – Delete operation without displaying detailed information
com.apple.quarantine – This is a mark that the macOS system puts on downloaded applications, including information such as the source URL.
This command is used to recursively delete the quarantine extended attribute of the specified files or folders.
On macOS, applications downloaded from the internet are marked with a quarantine flag, and the system checks this flag to decide whether to allow the application to be opened.
If there is a problem with the application’s signature, the quarantine flag will result in a “corrupted” error.
Use the sudo xattr -rd com.apple.quarantine /Path/to/App command to delete this mark, bypass the security check, and temporarily solve the problem of not being able to open the App.
Please note that this method will become invalid after restarting the app. You need to do this every time you open the app. It is only recommended for temporary situations.
sudo codesign –force –deep –sign – The command is explained as follows:
sudo – Obtain root privileges to execute commands
codesign – Tool for signing and verifying code signatures
–force – Force the signing operation, regardless of whether the original signature exists
–deep – recursively sign, applying the signature to all code in the specified target
–sign – Perform a signature operation and add a signature to the target file
- Signature uses the system default identity to sign
What this command does is:
- Force recursive code signing for the specified target (application, etc.) and add signature information
- Regardless of whether there is a signature, re-sign with the system default identity
- The signature is applied to all code and components in the target
On macOS, downloaded apps that lack the correct signature information will fail to open and report a “damaged” error.
Using this command fixes the application’s signature and resolves the issue. Unlike simply removing the quarantine tag, this method permanently resolves the issue.
Please note that the signature uses the system default certificate, which is different from the developer’s original signature and may cause the software to run abnormally. It is recommended to use it only when necessary.
IT Resource Hub » How to solve the problem that the Mac application prompts that it is damaged and cannot be opened