294

Whenever I try to run my app in Xcode 6 Beta 4 I am getting the error:

The file "MyApp.app" couldn't be opened because you don't have permission to view it.

This error appears no matter what simulator or device I target.

I have tried:

  • Deleting all Derived Data from Organizer in Xcode
  • Repairing permissions on my drive
  • Manually elevating the permissions of the built MyApp.app
  • Restarting my computer

Has anyone else run into this problem and found a solution?

Screenshot

10
  • 2
    I am getting the same problem with XCode 6.1. At first, the issue was just with the simulator, now, after following some leads in this post, I have the same error running my target phone as well.
    – Bamaco
    Nov 26, 2014 at 19:41
  • 1
    I followed @YuAn solution. It works very well for the simulator. Thanks But when I try to build it on the device, I am still getting the message saying 'I don't have any permission to view it'. The myapp.app file in products directory in xcode and also in derived data directory is showing blocked even after trying to build after deleting the contents of the derived data. Jan 8, 2015 at 7:02
  • 4
    Another (stupid) way to trigger this problem: Compile an app with only resources, and no source files. Don't ask me how I know that :)
    – Krumelur
    Jun 12, 2015 at 15:21
  • 4
    Product > Clean solve this for me
    – mazorati
    Sep 30, 2016 at 21:21
  • In my case none of these did not work!! Once I delete pilst file from Xcode and again attach with project, it works like a charm!! Hope help you Guys!!
    – Ravi
    Jul 25, 2017 at 18:34

60 Answers 60

255

I use Xcode6 GM. I encountered the same problem. What I did was to go to Build Settings -> Build Options. Then I changed the value of the "Compiler for C/C++/Objective-C" to Default Compiler.enter image description here

0
150

Having the problem on DEVICE too (not just simulator)?


The other solutions only fixed it for me on simulator, not device.

For me this problem occurred (in Xcode 6) when I would try to change the main info.plist properties whilst trying to change my app name.

In info.plist I had changed Executable File name to something other than the default ${EXECUTABLE_NAME}...

I had mistaken this field for the field that changes the name of the app under the icon on the springboard.

8
  • 11
    In my case, this worked thank you. I'd been changing other similar fields in my <appname>-Info.plist file, and once I'd changed Executable File back to ${EXECUTABLE_NAME} as you suggested, it built and ran.
    – Slowburner
    Nov 6, 2014 at 3:50
  • Same problem, name of field is "Bundle display name" for changing name under the icon
    – WebOrCode
    Mar 26, 2015 at 14:40
  • @Albert : I have default $(EXECUTABLE_NAME) name in Executable file but still getting the same build error.. Mar 27, 2015 at 13:00
  • This was the answer for me when using SpriteBuilder (Cocos2d-Swift)
    – Paul
    Mar 29, 2015 at 22:40
  • 1
    This lead me to my solution, which was I had gotten an extra Info.plist when I included the source for an external library into my code, and they had an Info.plist inside their assets group folder. Removing that extra Info.plist fixed my problem.
    – chadbag
    Jul 21, 2018 at 2:46
146

In Xcode do the following

Window --> Organiser --> Projects --> The app with the issue --> delete button in Derived Data.

I then cleaned the project and voila

works

3
  • I followed @YuAn solution. It works very well for the simulator but when I try to build it on the device, I am still getting the message saying 'I don't have any permission to view it'. The myapp.app file in products directory in xcode and also in derived data directory is showing blocked even after trying to build after deleting the contents of the derived data. Any Idea what went wrong? Jan 8, 2015 at 7:04
  • this worked for me BUT it keeps happening. I can't continually delete derived data every time I want to run the app in the simulator...
    – zumzum
    Mar 12, 2015 at 14:36
  • I am facing same issue tried various solution but didn't worked for me.. Help will be appreciated Jun 17, 2020 at 12:10
54

For me, a simple Product -> Clean worked great

0
46

I've fixed it by cleaning a build folder. Just went to 'Product' menu and Option+Click 'Clean'. After that a problem was resolved.

0
31
+50

There was a problem with the Info.plist of the project. I created a new project with the same name in Xcode 6 beta 4 and then replaced the real project's Info.plist with the new one. The project then built and ran fine.

Look at the diff, it appears like the plist might have somehow gotten mixed up with a playground's plist. The bundle identifier was "com.apple.dt.playground.iOS-18300-13" and the executable and bundle names were "iOS" along with some other oddities.

This is the full diff in case anyone needs it for reference:

        <key>CFBundleDevelopmentRegion</key>
        <string>en</string>
        <key>CFBundleExecutable</key>
-       <string>iOS</string>
+       <string>${EXECUTABLE_NAME}</string>
        <key>CFBundleIdentifier</key>
-       <string>com.apple.dt.playground.iOS-18300-13</string>
+       <string>com.myCompany.${PRODUCT_NAME:rfc1034identifier}</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
-       <string>iOS</string>
+       <string>${PRODUCT_NAME}</string>
        <key>CFBundlePackageType</key>
-       <string>AAPL</string>
+       <string>APPL</string>
        <key>CFBundleShortVersionString</key>
        <string>1.0</string>
-       <key>CFBundleSupportedPlatforms</key>
-       <array>
-               <string>iPhoneSimulator</string>
-       </array>
+       <key>CFBundleSignature</key>
+       <string>????</string>
        <key>CFBundleVersion</key>
        <string>1</string>
-       <key>DTPlatformName</key>
-       <string>iphonesimulator</string>
-       <key>DTSDKName</key>
-       <string>iphonesimulator8.0</string>
-       <key>LSBackgroundOnly</key>
-       <true/>
        <key>LSRequiresIPhoneOS</key>
        <true/>
+       <key>UIMainStoryboardFile</key>
+       <string>Main</string>
        <key>UIRequiredDeviceCapabilities</key>
        <array>
                <string>armv7</string>
        </array>
+       <key>UISupportedInterfaceOrientations</key>
+       <array>
+               <string>UIInterfaceOrientationPortrait</string>
+               <string>UIInterfaceOrientationLandscapeLeft</string>
+               <string>UIInterfaceOrientationLandscapeRight</string>
+       </array>
 </dict>
 </plist>
1
  • yep, I had a similar problem. Info.plist file was in the binary file format. Had to convert it Oct 2, 2015 at 8:14
29

I've had same this error in Xcode 8.2. The reason I found out for me, another Info.plist is added in my project while adding library (manually copy).

So that Xcode is getting confused for selecting correct Info.plist.

I just removed that Info.plist from the added library.

Then it is working fine without any permission alert.

3
  • You can also change the name of Info.plist to FRAMEWORK_NAME_HEREInfo.plist May 4, 2017 at 2:25
  • The same here, copying from another projet Jan 23, 2018 at 13:35
  • This is exactly what my issue was. I added another folder of swift files and it had a plist file in there. I deleted that plist file and all is well.. Thank you! Oct 8, 2019 at 21:09
17

Please check if you have changed Executable file => $(EXECUTABLE_NAME) to any other name. If you have changed this name then it shows this error. Please replace it with $(EXECUTABLE_NAME).

2
  • Yeah happened to me when trying to change app name. Season developer so just went into plist absentmindedly and changed "Executable File" when in reality I mean to change "Bundle Name"
    – MobileMon
    Oct 1, 2015 at 18:37
  • This fixed it for me. It happened after I renamed my project. Thanks. Oct 21, 2017 at 15:08
15

Product -> Clean (command shift K) fixed it for me

2
  • Good reminder that sometimes the simple solution is the one that works.
    – Pescolly
    Feb 1, 2015 at 23:02
  • A clean and Xcode restart was required here under Xcode 7.2.1. Cleaning alone progressed me to an "unknown error" with no attempt to build.
    – Tommy
    Feb 23, 2016 at 17:31
14

My goodness!! I spent hours to resolve this issue.

On XCode 7.3 I was having project with no issues.

Mistake I did

I just Added physical folders and moved my files into them, problem started.

I tried everything

  • Default compiler
  • Clean and build
  • Reset simulator and reboot simulator, Xcode, iPhone even mac
  • Updated Info.plist
  • Deleting Derived Data
  • Editing the permission on the folder of the project
  • Checking my architectures

nothing worked :(

How I resolved

I was about create new project and then I just deleted those physical folders I added, clean build and YESS!!

It works!!

enter image description here

1
  • this helped me. but I thought I can use folder reference. strange. May 25, 2017 at 17:51
13

Try "cmd+shift+k" to clean the project and rebuild. At least it worked for me

11

Sometimes opening old project in new version Xcode will get this message.

Go to Issue navigator and follow the warning hint 'Upate to reconmmented settings'.

Boom, magic!

2
  • where is the issue navigator? Oct 18, 2021 at 17:51
  • @salvishahzad the left area of Xcode, where you see build warnings and errors. Cmd+5 is the shortcut under Xcode 13.
    – ManuQiao
    May 30, 2022 at 6:00
11

I had similar issue (xCode 6.2) for sample code downloaded. I tried to set Executable Name to Default in Info.plist but this didn't worked.

Instead change Compiler for C/C++/Objective-C to Default compiler (Apple LLVM 6.0) instead of Unsupported Compiler(com.apple.compilers.llvmgcc42) for project.

Screenshot

0
11

My Application was working fine on XCode 9.4, but when I opened my project in XCode 10 I was experiencing this issue. For me the issue was the build setting. I found the answer in this page https://forums.developer.apple.com/thread/112141.

In short go to File > Workspace Settings… > Build System and change it to "Legacy Build System"

2
  • finally! –––– thank you, I've forgot about that setting! Nov 12, 2020 at 13:13
  • It works for me too in xcode 12.1. However it says that the "Legacy Build System" property will be deprecated in future versions.
    – pyfyc
    Jan 7, 2021 at 8:18
10

1) Go Firstly Build Options.

2) Then changed the value of the "Compiler for C/C++/Objective-C" to Default Compiler.

clean and working :-)

2
  • 1
    To clear it up: 1. Go to Build Settings (Choose All and Combined) 2. Search for Build Options 3. Set the Compiler for C/C++/Objective-C to Default Compiler
    – nburk
    Nov 26, 2014 at 18:51
  • Why are people up voting this copying of the highest rated answer? Mar 30, 2015 at 14:37
10

I found that changing my compiler to LLVM 6.0 in the Build Options was enough for me (xcode 6.1)

enter image description here

10

I got same error on my Xcode 6.1.1 for a project downloaded from gitHub which was committed 4 years ago. For me, setting Architectures to the default value Standard architectures(armv7,arm64) and Compiler for C/C++/Objective-C to Default Compiler in Building Settings worked.

10

I had the same issue in my project. Later on found that third-party (fmdb for SQLite) file used in project contained Info.plist.

Simply deleting the Info.plist file worked for me!

Info.plist

0
9

I recently meet the same problem for running an old project (initially created in Xcode 4.x) in Xcode 6.0.1.

I fixed the problem by changing the Architectures in Building Settings to the default value, which is "Standard architectures(armv7,arm64)".

Hope this could help anyone who got similar problems :)

1
  • it looks like there are different problems behind this cryptic error message, anyway this is what solved my ptoblem with XCode 6.1 Nov 10, 2014 at 18:08
9

I've had this error with a number of my older projects that I am getting out of the cupboard to update. It seems that using Xcode 6 with older code seems to bring this about for some reason.

I have fixed this in all projects that I have done this with by:

  1. Delete Derived Data
  2. in Product: do a clean
  3. go to Build Settings in the project Target and go to Build Options and change the value of the "Compiler for C/C++/Objective-C" to 'Default Compiler'.
9

I tried all of the listed answers and none of them was useful. The problem was due to existence of an another plist file linked from a submodule via cocoapods. Luckily this was my own module, so I just deleted this plist from the submodule project and reinstalled pods.

solution

Later on I understood that the key of the problem was in the name of that second plist: simply info.plist. You may rename the file and relink it via a sources section of a submodule

That second plist file had a unique name, so Xcode was not supposed to become frustrated. Even my target settings pointed on a main plist, not on a info.plist. Looks like Xcode takes special consideraions about that name

The bug reproduced in Xcode 6.4 and Xcode 7.0

2
  • A similar thing happened to me. My Info.plist was not configured correctly, so XCode took the first Info.plist it happened to find in the project's folder, which belonged to some unrelated dependency. Dec 9, 2015 at 17:29
  • thank god, you just saved me hours of pointless Xcode debuggin'
    – Alex
    Apr 18, 2016 at 6:02
8

Well in my case, I just rename the Bundle Name and Executable file values in info.plist same as project name. It worked for me.

7

What I did is here:

  • I deleted VALIDARCHS from Project
  • I deleted VALIDARCHS from Target
  • Build Active Architecture Only = YES (for Debug) Architectures
  • Standard Architectures $(ARCHS_STANDARD)

Also, File -> Project/Workspace Settings == New Build System

Xcode Version 12.0 (12A7209)

6

I had this similar problem. Somehow my value for the key Executable File got mixed up. Just change it back to ${EXECUTABLE_NAME} (Under your project > Info). Worked for me!

1
  • 1
    One thing to note, is that mine was set to $(EXECUTABLE_NAME) and updating it to ${EXECUTABLE_NAME} fixed the problem for me.
    – Eric
    Dec 24, 2014 at 7:20
6

If you google the text of this error message you will find maybe 20 threads across StackOverflow, Apple dev forums, Reddit, etc. about Xcode failing to be able to run a compiled executable with this error message.

In these threads you will find many people offering various suggestions about how to fix the problem: changing product name to match project name, changing build phase options, something with info.plist, changing compilers to or from Clang, etc. Presumably the suggestions are offered in good faith because they solved the problem for someone, but the answers are so varied that it is clear that the error message is generic and this is an important point if you are receiving it: this error seems to mean that something is wrong with the binary. Ignore its actual text: it may have nothing to do with permissions.

There is no general solution to this error. The error message is totally generic; assume it means "bad binary file". The solution if you are receiving it depends on what you are trying to do, what has changed, why you are seeing this error all of a sudden. Google the specifics of your situation rather than this error message.

In my case, and I have a feeling this is a common case, what I was trying to do was build an old iOS project, nine years old I think, on modern Xcode. The solution was to switch to the legacy build system which led to a compilation error because in the old project there were not modern architecture targets, which could be fixed by manually adding them.

5
  • It would be better, if you have explained in detail Mar 16, 2021 at 7:23
  • 1
    Using the legacy system fixed it for me too. Now I just need to find out how to migrate to the new one Jul 9, 2021 at 7:02
  • let me know if you figure this out please. I havent tried.
    – jwezorek
    Jul 9, 2021 at 16:34
  • Very well said @jwezorek! If one has run the code in New Build System and have changed to Legacy build system, it was giving this issue. We may have to change it back to Legacy may be once or twice and try again. I had run the code in Xcode 13 where it takes New Build system and had switched back to Xcode 12. Nov 3, 2021 at 5:38
  • Sad, it's deprecated now. Dec 22, 2023 at 8:18
5

In my case main.m containing the main(...) function was not contained in the list of "Compile Sources" in "Build Phases". To check if this is the case, enter into Build Phases and look, if your main.m appears in the "Compile Sources" list.

2
  • 1
    I don't know how you discovered this, and it wasn't my exact problem but it lead me to the solution so THANKS!!
    – Ri_
    Nov 18, 2015 at 12:00
  • I also had this, (missing a main()) but with .cpp, for any readers that may believe the .m or .mm is significant. Sep 12, 2020 at 14:55
5

Don't know if the problem is related but maybe it can be a solution for anyone pulling the hairs like me.

In my case, I have a project with a lot of targets. Each target is a customisation of that base project which is a Cocoa Touch Static Library and the targets, Applications. Even if the main file is added into the library compilation, but not in each target, that error message appears. So what I did? Manually added the main file to each target in the Compile Sources section and bingo, all fine.

0
5

For me the error was in the .plist file at the key CFBundleExecutable. I had renamed the executable removing a space that was between two words. (Eg: from "Wild Racer" to "WildRacer"). Took 1 day to spot it!!

Xcode is soooo unhelpful in the debugging!

3

What solved it for me was setting Build Active Architecture Only from No to Yes.

0
3

with X-code 6.3.2

[Build Settings] Options. [All]-[Build Options]-[Compiler for C/C++/Objective-C]-[Default compiler (Apple LLVM 6.1)]

Then rebuild the project, and it runs ok.

Not the answer you're looking for? Browse other questions tagged or ask your own question.