When installing software via a .pkg file downloaded from the Internet, macOS may display the following error:
"xxx.pkg" cannot be opened because Apple cannot check it for malicious software.

This behavior is caused by Gatekeeper, a macOS security feature. Starting with macOS Catalina (macOS 10.15), Apple requires all .pkg packages to be signed and notarized by its services. However, many applications available on the Internet do not pass this validation — even if they are legitimate.
1. Finder solution (classic method, often non-functional)
- Open the folder containing the
.pkgfile in Finder. - Hold the
CTRLkey and click the file. - Select Open.
- In the warning dialog, click Open again.
2. Recommended solution: remove the quarantine flag
macOS adds a com.apple.quarantine attribute to files downloaded via a browser. You can remove it using the Terminal:
sudo xattr -rd com.apple.quarantine xxx.pkgFor our example of unblocking PowerShell 7.5.1 :
sudo xattr -rd com.apple.quarantine ~/Downloads/powershell-7.5.1-osx-arm64.pkg This command recursively removes all quarantine attributes from the file and its associated metadata.
Then, launch the .pkg file normally (by double-clicking it or using the open command).
3. Alternative solution: unblock via PowerShell
If you already have a working version of PowerShell installed on your Mac, you can unblock the file using:
Unblock-File -Path xxx.pkgFor our example to unblock PowerShell 7.5.1:
Unblock-File -Path ~/Downloads/powershell-7.5.1-osx-arm64.pkg
Comments