Fix: “Couldn’t Be Opened Because You Don’t Have Permission” in Xcode

Written by

in

Quick answer: The “couldn’t be opened because you don’t have permission to view it” error in Xcode usually happens when your app’s Info.plist contains invalid bundle keys—such as an incorrect CFBundleExecutable or CFBundlePackageType—or when a custom compiler setting prevents Xcode from producing a valid executable. Fix it by restoring standard Info.plist values like $(EXECUTABLE_NAME) and APPL, and setting “Compiler for C/C++/Objective-C” to Default Compiler in Build Settings.

Why this happens

Despite what the message says, The file "MyApp.app" couldn't be opened because you don't have permission to view it is rarely a macOS file-system permissions problem. Running chmod, repairing disk permissions, restarting your Mac, or deleting Derived Data on its own usually has no effect because the root cause is a malformed .app bundle.

When Xcode finishes building and attempts to launch your app on a simulator or physical device, the system reads Info.plist inside the .app bundle to find the executable binary (CFBundleExecutable), confirm the bundle type (CFBundlePackageType), and register the bundle identifier (CFBundleIdentifier).

If Info.plist was accidentally replaced or corrupted—for example, mixed up with a Playground’s Info.plist—or if a misconfigured compiler setting in Build Settings prevents Xcode from generating the expected executable binary, the launcher cannot open the bundle and surfaces this generic permission error.

How to fix it

1. Check and repair your Info.plist keys

A corrupted Info.plist is the most common cause of this error. For instance, if your app’s Info.plist was overwritten by a Playground or another target template, it may contain keys like LSBackgroundOnly, a wrong CFBundlePackageType (such as AAPL instead of APPL), or a hardcoded CFBundleExecutable that does not match your compiled binary.

Open your project’s Info.plist as source code (right-click Info.plist in the Project Navigator and choose Open As > Source Code) and verify these core keys:

<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSRequiresIPhoneOS</key>
<true/>

Check for these specific mistakes:

  • CFBundleExecutable: Must be $(EXECUTABLE_NAME) (or ${EXECUTABLE_NAME}), not a hardcoded string like iOS.
  • CFBundlePackageType: Must be APPL for an application bundle. A typo such as AAPL will prevent the bundle from launching.
  • CFBundleIdentifier: Should match your app’s bundle ID or $(PRODUCT_BUNDLE_IDENTIFIER), not a Playground identifier like com.apple.dt.playground....
  • LSBackgroundOnly: Remove this key if it is present in a standard iOS app.
  • Platform-specific keys: Remove hardcoded CFBundleSupportedPlatforms, DTPlatformName, or DTSDKName entries if they were copied from another plist; Xcode injects these automatically during the build.

If your Info.plist is heavily corrupted, create a new temporary Xcode project with the same name and compare its Info.plist against yours—or replace your broken Info.plist with a clean copy and re-add any custom keys your app requires.

2. Reset “Compiler for C/C++/Objective-C” to Default Compiler

If your Info.plist looks correct, an explicit or outdated compiler setting in your target’s Build Settings can prevent Xcode from producing a valid executable inside the .app bundle.

  1. Select your project in the Project Navigator and click your app target under Targets.
  2. Open the Build Settings tab and make sure All (not just Basic) is selected.
  3. Use the search bar to find Compiler for C/C++/Objective-C under Build Options.
  4. Change the value to Default Compiler.
  5. Press Shift + Command + K (Product > Clean Build Folder) and run the app again.

3. Verify Packaging and Info.plist build settings

If you recently renamed your target, moved files around, or upgraded a project, verify that Xcode’s packaging settings match your actual files:

  1. In your target’s Build Settings, search for Info.plist File (INFOPLIST_FILE) and confirm the path points to your real Info.plist.
  2. Check Executable Name (EXECUTABLE_NAME) and Product Name (PRODUCT_NAME) to make sure neither is empty or contains invalid characters.
  3. Open Build Phases > Copy Bundle Resources and confirm Info.plist is not listed there. Xcode processes Info.plist via the INFOPLIST_FILE setting; copying it as a raw resource can cause bundle validation issues.

4. Clean the build folder after fixing configuration

Once you have corrected Info.plist or Build Settings, clean the build artifacts so Xcode does not reuse a broken bundle from cache:

  1. Choose Product > Clean Build Folder (Shift + Command + K).
  2. Quit and relaunch the Simulator if you are testing on a simulator.
  3. Build and run (Command + R).

How to prevent it

  • Use build setting variables in Info.plist: Keep CFBundleExecutable set to $(EXECUTABLE_NAME) and CFBundleName set to $(PRODUCT_NAME) instead of hardcoding app names.
  • Do not copy Info.plist across target types: Never reuse an Info.plist from a Swift Playground, framework, or macOS target inside an iOS app target.
  • Keep the default compiler selected: Leave Compiler for C/C++/Objective-C set to Default Compiler unless you have a specific toolchain requirement.
  • Review git diff after merges: Inspect changes to Info.plist and project.pbxproj when resolving merge conflicts so stray keys do not slip into your app target.

FAQ

Why didn’t deleting Derived Data or changing file permissions fix this error?

Deleting Derived Data only removes cached build products; if Info.plist or Build Settings are misconfigured, Xcode rebuilds the same broken .app bundle. Similarly, chmod does not help because the launcher rejects the bundle due to missing or invalid executable metadata rather than Unix file permissions.

What is the difference between APPL and AAPL in CFBundlePackageType?

APPL is the standard four-character package type code that tells iOS and macOS the bundle is an executable application. AAPL is a common typo (or a non-app identifier) that causes the system to treat the bundle as something other than a launchable app.

Where do I find Info.plist settings if my Xcode project doesn’t have an Info.plist file?

Modern Xcode templates enable Generate Info.plist File (GENERATE_INFOPLIST_FILE = YES) in Build Settings, which synthesizes Info.plist at build time. You can inspect and edit those keys under your target’s Info tab and Packaging build settings.

Sources & credits

Parts of this guide are adapted from content licensed under CC BY-SA 3.0; this article is shared under the same license.