How to Fix macOS Gatekeeper Blocked App
In this tutorial, you'll learn about How to Fix macOS Gatekeeper Blocked App. We cover key concepts, practical examples, and best practices.
The Problem
You download an application and macOS prevents it from opening:
"MyApp" can't be opened because it is from an unidentified developer.
Or:
"MyApp" cannot be opened because the developer cannot be verified.
macOS cannot verify that this app is free from malware.
Gatekeeper blocks apps that are not signed with an Apple Developer certificate or have not been notarized by Apple.
Quick Fix
Step 1: Open the app via Security & Privacy
- Open System Preferences > Security & Privacy > General
- Look for the message: "MyApp was blocked from opening because it is not from an identified developer."
- Click Open Anyway
- Enter your administrator password
Step 2: Right-click to open (override)
- Right-click (or Ctrl-click) the application
- Select Open from the context menu
- Click Open in the confirmation dialog
This one-time bypass works for Gatekeeper-blocked apps.
Step 3: Remove the quarantine attribute
xattr -dr com.apple.quarantine /Applications/MyApp.app
The com.apple.quarantine extended attribute marks files downloaded from the internet. Removing it bypasses Gatekeeper for that file.
Step 4: Create a code signature (advanced)
If the app is unsigned, you can sign it with an ad-hoc signature:
codesign --force --deep --sign - /Applications/MyApp.app
The - specifies ad-hoc signing (no Apple certificate). This may satisfy Gatekeeper on some macOS versions.
Step 5: Disable Gatekeeper temporarily (not recommended)
sudo spctl --master-disable
This disables Gatekeeper system-wide. Re-enable after installing:
sudo spctl --master-enable
Step 6: Notarize the app (for developers)
If you distribute an app, submit it for notarization:
xcrun notarytool submit MyApp.dmg --apple-id your@email.com --team-id TEAMID --password @keychain:AC_PASSWORD
xcrun stapler staple MyApp.dmg
Notarized apps pass Gatekeeper without user intervention.
Step 7: Check the app's quarantine status
xattr -l /Applications/MyApp.app
If com.apple.quarantine exists, the app was downloaded from the internet.
Prevention
- Download apps from the Mac App Store or official developer websites.
- Developers: Notarize all distributed builds.
- Do not disable Gatekeeper permanently.
Common Mistakes with gatekeeper blocked
- Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable
- Using
headandtailinstead of pattern matching, causing runtime errors on empty lists - Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
These mistakes appear frequently in real-world MACOS code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.
Practice Exercise
Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.
This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.
FAQ
DodaTech Tool Reference
Durga Antivirus Pro scans apps that bypass Gatekeeper, providing an additional malware check before the first launch.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro