"The file "MyApp.app" couldn't be opened because you don't have permission to view it" when running app in Xcode 6 Beta 4

171,649

Solution 1

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>

Solution 2

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

Solution 3

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.

Solution 4

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

Solution 5

For me, a simple Product -> Clean worked great

Share:
171,649

Related videos on Youtube

drewag
Author by

drewag

I am on this forum to learn, and to help others! I thrive on collaboration and sharing of ideas! I am passionate about design, interface, and coding. Interface for me includes the obvious things like user interface and graphics, but also design patterns, API's and on occasion documentation and coding standards :). I work for a dev shop based in Denver, CO called Chronos Interactive as well as on my own app business called Learn Brigade. Check out my Blog Check out my Stack Overflow Career Page Follow me on Drewag

Updated on February 21, 2022

Comments

  • drewag
    drewag over 2 years

    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

    • Bamaco
      Bamaco over 9 years
      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.
    • Srinivasan N
      Srinivasan N over 9 years
      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.
    • Krumelur
      Krumelur about 9 years
      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 :)
    • mazorati
      mazorati over 7 years
      Product > Clean solve this for me
    • Ravi
      Ravi almost 7 years
      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!!
    • mrunal thanki
      mrunal thanki over 6 years
      I have different solution for it. Please check my answer here stackoverflow.com/a/46546044/5013722
    • monkey0506
      monkey0506 about 6 years
      @Krumelur I just spent hours on that before I stumbled upon your comment. The project in question doesn't need any of its own source code -- it's a standalone game app built from the game engine "framework" and a game data file. The game engine framework is built as a dependency via Xcode, but the app isn't executable unless it has some (redundant/useless) source code of its own. THANK YOU.
    • Mohd Iftekhar Qurashi
      Mohd Iftekhar Qurashi about 5 years
      I am also facing same issue in the when running app in Xcode 10.1 if any one have better solution please share
    • Jason
      Jason over 4 years
      When cleaning failed to resolve it and my Info.plist settings were already as mentioned in the solutions below, restarting my machine worked like a charm. Good old turn it off and on again :)
    • Narendar Singh Saini
      Narendar Singh Saini almost 4 years
      What worked for me is here: stackoverflow.com/questions/24924809/…
  • drewag
    drewag almost 10 years
    I tried the extreme of giving "everyone" Read & Write permissions but still no luck
  • fingaz
    fingaz almost 10 years
    So the other thing that I can think of to try is to reset ACLs and Home Folders which I believe is commonly found on the recovery partition by enter resetpassword in the terminal app. But to further troubleshoot you could drag that folder to the shared folder at /Users/ and create a new admin to see if it is user specific.
  • drewag
    drewag almost 10 years
    thanks for the help! I actually discovered the problem (the info.plist of the project was corrupted)
  • Fede Cugliandolo
    Fede Cugliandolo over 9 years
    This answer should be marked as the correct one @drewag
  • Slowburner
    Slowburner over 9 years
    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.
  • Fabio Napodano
    Fabio Napodano over 9 years
    it looks like there are different problems behind this cryptic error message, anyway this is what solved my ptoblem with XCode 6.1
  • nburk
    nburk over 9 years
    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
  • Bala Vishnu
    Bala Vishnu over 9 years
    Thanks..Same was my case
  • Eric
    Eric over 9 years
    One thing to note, is that mine was set to $(EXECUTABLE_NAME) and updating it to ${EXECUTABLE_NAME} fixed the problem for me.
  • Srinivasan N
    Srinivasan N over 9 years
    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?
  • Nilesh Kikani
    Nilesh Kikani over 9 years
    Thanks a lots @Albert Renshaw, youe answer resolved my issue. I am searching solution for that since last two days.
  • Pescolly
    Pescolly over 9 years
    Good reminder that sometimes the simple solution is the one that works.
  • zumzum
    zumzum over 9 years
    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...
  • WebOrCode
    WebOrCode over 9 years
    Same problem, name of field is "Bundle display name" for changing name under the icon
  • Jayprakash Dubey
    Jayprakash Dubey over 9 years
    @Albert : I have default $(EXECUTABLE_NAME) name in Executable file but still getting the same build error..
  • Paul
    Paul over 9 years
    This was the answer for me when using SpriteBuilder (Cocos2d-Swift)
  • kiranpradeep
    kiranpradeep over 9 years
    Why are people up voting this copying of the highest rated answer?
  • Joris Weimar
    Joris Weimar about 9 years
    Same. I had product name set to fixed value. When I changed the target name, the error showed up.
  • Jayprakash Dubey
    Jayprakash Dubey about 9 years
    @iOSRocks : Welcome buddy!
  • JakeP
    JakeP about 9 years
    Thank you, this helped a lot.
  • tonyedwardspz
    tonyedwardspz almost 9 years
    I had this issue after upgrading OSX today. This had it sorted in under a minute.
  • endavid
    endavid almost 9 years
    I tried localizing the Info.plist but then it gave me a build error because it couldn't find the file anymore. I reverted my changes, and then I was getting this "permission" error thing. Since everything was obviously as it was before, the problem wasn't in the Info.plist itself. I cleaned the Build folder as yury.ku suggested and that worked for me.
  • MobileMon
    MobileMon over 8 years
    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"
  • Luca Torella
    Luca Torella over 8 years
    yep, I had a similar problem. Info.plist file was in the binary file format. Had to convert it
  • Ri_
    Ri_ over 8 years
    I don't know how you discovered this, and it wasn't my exact problem but it lead me to the solution so THANKS!!
  • Ohad Schneider
    Ohad Schneider over 8 years
    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.
  • Tommy
    Tommy over 8 years
    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.
  • Alex
    Alex about 8 years
    thank god, you just saved me hours of pointless Xcode debuggin'
  • Mike Gledhill
    Mike Gledhill about 8 years
    This also fixed it for me. With a "different" application name, the program built, ran, and would even Archive (ready to become an in-house app). But when I attempted to make that in-house app with a manifest file, I'd get an error of "Missing required bundle identifier property in distribution manifest" error. Xcode. Each year giving us another reason to hate it just a little bit more.
  • yeahdixon
    yeahdixon almost 8 years
    YUP this was it for me too .
  • Jeremy Kelleher
    Jeremy Kelleher about 7 years
    You can also change the name of Info.plist to FRAMEWORK_NAME_HEREInfo.plist
  • user1105951
    user1105951 about 7 years
    this helped me. but I thought I can use folder reference. strange.
  • emiliomarin
    emiliomarin over 6 years
    This fixed it for me. It happened after I renamed my project. Thanks.
  • Firas Shrourou
    Firas Shrourou over 6 years
    The same here, copying from another projet
  • SLi
    SLi over 6 years
    Yes. This helped me too.
  • chadbag
    chadbag almost 6 years
    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.
  • mkll
    mkll almost 6 years
    Worked for me too.
  • JerseyDevel
    JerseyDevel over 4 years
    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!
  • Vyachaslav Gerchicov
    Vyachaslav Gerchicov over 4 years
    and? the question is about macOS, you answer for iOS
  • Giriraj.Mulay
    Giriraj.Mulay about 4 years
    I am facing same issue tried various solution but didn't worked for me.. Help will be appreciated
  • Soylent Graham
    Soylent Graham almost 4 years
    I also had this, (missing a main()) but with .cpp, for any readers that may believe the .m or .mm is significant.
  • AZZ
    AZZ over 3 years
    it's worked for me. I finally fixed by deleting the Exclude_Archs. 3q very much! It's what you says, not a permission issue.
  • Ilya Muradymov
    Ilya Muradymov over 3 years
    finally! –––– thank you, I've forgot about that setting!
  • pyfyc
    pyfyc over 3 years
    It works for me too in xcode 12.1. However it says that the "Legacy Build System" property will be deprecated in future versions.
  • Arshad Shaik
    Arshad Shaik over 3 years
    It would be better, if you have explained in detail
  • DoruChidean
    DoruChidean almost 3 years
    Using the legacy system fixed it for me too. Now I just need to find out how to migrate to the new one
  • jwezorek
    jwezorek almost 3 years
    let me know if you figure this out please. I havent tried.
  • salvi shahzad
    salvi shahzad over 2 years
    where is the issue navigator?
  • Aftab Ahmed
    Aftab Ahmed over 2 years
    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.
  • ManuQiao
    ManuQiao about 2 years
    @salvishahzad the left area of Xcode, where you see build warnings and errors. Cmd+5 is the shortcut under Xcode 13.