Permission Denied when running Mac app after upgrading to XCode 4.4
Asked Answered
C

8

16

I had a working Mac application until I updated to XCode 4.4 and Mountain Lion. Now the application still compiles, but when I try to run it I get an error message.

error: failed to launch '/Users/username/James/mac/Browser/trunk/Browser/DerivedData/Browser/Build/Products/Debug/Browser.app/Contents/MacOS/Browser' -- Permission denied*

Can anybody explain why I might be getting this?

Cybernetics answered 9/8, 2012 at 4:15 Comment(9)
trying doing a full "Clean" within Xcode (under the "Product" menu) and see if that fixes your problem.Literator
Michael. I tried a Clean. No such luck. Thanks.Cybernetics
Thanks for trying. Let's do one more thing: what happens when you throw out the "Derived Data" folder (which should be almost exactly the same thing as a "Clean")? When you do another build, perhaps the permissions will be correct.Literator
I removed it and XCode added it back and I'm having the same issue. The permission on the file are set to -rwxr-xr-x by default. Even when I set the entire DerivedData folder to full permissions I still get the error.Cybernetics
I unchecked "Code Sign Application" and it runs. So now I need to figure out what happened to make this start failing.Cybernetics
JWood - I was able to get it running by removing code signing temporarily. I don't know why that isn't working, but I'll probably try new development certificates.Cybernetics
In my case, I'm trying to use a Developer ID certificate, and getting this exact error message. If I try to run the app from Finder, it gets SIGKILLed immediately.Radmen
hmm, I think apple wanna push developers to store their app on mac app store... -,-aDiffusivity
Im not sure wether you tried it: maybe you try to recheck the owner flag of the whole DerivedData folder. Sometimes it also depends on the ownership. You can try it easily by using another login on your mac. I hope this helpsAmabel
T
9

I found this on an iPhone 5 (iOS 6.0) newly set up for development. I had to manually launch the app on the phone, and it said "Are you sure you want to launch this app signed by this devloper?" Once I approved that, the "permission denied" went away and it now launches from Xcode.

Theodoratheodore answered 18/10, 2012 at 18:35 Comment(0)
N
8

Unlock the Device

Try simply unlocking your device before running on it. I was stumped by this very same issue. Upon building and running with no changes to OS, environment, code, etc., I was receiving the error.

Similar questions have been asked here and here, but were not helpful in this situation.

Nostrum answered 20/8, 2012 at 19:56 Comment(3)
I'm guessing that Xcode is finally honoring the lock screen. (Am I right that it didn't before?)Nostrum
I apologize that I didn't make my initial post clear. This is an OSX application, not iOS.Cybernetics
Ah, well that certainly makes a difference. I'll leave the answer here for others who Google to this.Nostrum
R
6

This is caused by an entitlement (and, presumably, having the wrong kind of certificate for it).

  • If you have the sandbox enabled, and try to sign with a Developer ID certificate, your application will crash on launch (as of Lion—I haven't tried this on Mountain Lion).
  • If you have iCloud enabled, and try to sign with a Developer ID certificate, your application will not launch at all—in Xcode, you'll get the error message in the question, and in Finder, the application will launch ever so briefly and then get SIGKILLed.

Presumably, there is a right kind of certificate with which one can sign an app in order to be able to test with a sandbox and maybe even iCloud that you can obtain if you have a Mac Developer Program membership. A Developer ID certificate is not that kind of cert.

(That solves my problem, anyway. Dennis, what kind of cert were you trying to sign with?)

Radmen answered 12/11, 2012 at 18:12 Comment(4)
I ran into this problem too. I tried to code sign a Mac OSX app with my iOS developer id. It didn't like it. Now I guess I'll have to pay the $99 for Mac Developer access to test my iCloud stuff...ackFairfax
Unfortunately, you can't use iCloud in apps not from the App Store. (citation)Holzman
@cobbal: I should at least be able to run the app. Besides which, is there no kind of cert that I could use to test iCloud support in my own app on my own machine?Radmen
@PeterHosey I'm ignorant about that; I've been developing iOS apps for far too long. I suspect the situation on Mac has been borrowed from iOS though, and that you have to have the paid certificate (like the Ad-hoc one that lets you just run apps on iOS devices, but not distribute widely) to be able to use iCloud features. This is pure speculation on my part, and I defer to anyone who actually has tried it.Holzman
S
0

Open the organizer and make sure you're mac is in developer mode.

Also check your gatekeeper settings.

Shuma answered 17/11, 2012 at 20:10 Comment(1)
GateKeeper is off by default on Lion (even on versions where it is present—since 10.7.4 or 10.7.5). My Mac was not in developer mode, but I turned that on and it did not help.Radmen
G
0

The device is seeing the app as an "unauthorized app downloaded from the web" for lack of a better description. Go into Settings > Security & Privacy, and at the bottom, allow applications downloaded from Anywhere.

Gloaming answered 18/11, 2012 at 0:5 Comment(4)
I already have it set that way (it's the default on Lion) and still had the problem.Radmen
It's actually not the default on LionGloaming
It is the default on Lion. Here's a screenshot from a brand-new user account on 10.7.5: i.imgur.com/dyDVN.pngRadmen
Sorry, I was referring to Mountain LionGloaming
C
0

Throwing a few thoughts on the wall:

  • Are you perhaps building on an external disk? Some drives get special permissions (like the "ignore permissions" checkbox), or maybe have ACLs set in a weird way. Tried building on internal startup disk?

  • Are you code signing? Have you tried just turning that off, to see if there's a bug in code signing or entitlements? Not the first time a new codesign tool has a bug.

  • Have you tried using xcode-select and updating any command line tools that are installed to make sure they all match the version of Xcode used?

  • Do you have any shell script build phases or the likes that might be editing the application after it's been signed, thus breaking the signature?

  • Have you checked if your hard disk is full or there's a (broken?) symlink somewhere in a path, or a volume name that has been unmounted?

Convention answered 18/11, 2012 at 1:33 Comment(1)
My Home folder is on another volume, but “ignore permissions” is not turned on. I haven't tried it from an all-on-the-boot-disk account. • The problem only happens with code signing turned on, with either iCloud or sandboxing enabled—see my answer. • This was building with Xcode itself, so CLI tools shouldn't be an issue. • Good thought! But no, no phases outside of the standard five. • Home folder disk was pretty close to full at one point, but is nowhere near it now and the problem still happens. AFAIK, no borken paths.Radmen
S
0

i am sure this is long been figured out, but I have been getting the Permission denied and it turned out I had to add my laptop to the provisioning profile. I had recently reimaged my machine and in doing so the provisioning profile was no longer valid for that machine. It worked fine until i enabled iCloud. That's when the permission denied started.

Check the organizer in XCODE, click on the devices tab and click on your machine on the left. Check to see that the UDID it shows is listed in the devices section in your mac developer portal.

Stab answered 4/5, 2013 at 1:58 Comment(0)
H
0

The short answer is when you get this error message, there is no valid development provisioning profile in the built application.

That alone won't solve your problem! There are a number of common causes of this:

  • You've moved to a new machine and haven't installed the provisioning profile in Xcode. Also see below
  • You've moved to a new machine and it's not in developer mode OR not added to the provisioning profile

For both of these, let Xcode regenerate it, or do it yourself in the Member centre... You can validate the causes is something to do with your provisioning profile by running Console and filtering on taskgated where you can see which provisioning profile it is trying to use (it will pull the one embedded in the application first, then try to pull from any installed on the Mac).

Make sure you check in your build settings that the right one is being used for Debug builds. Simple steps that normally resolve (XCode 5)

  1. Go to member centre and create a new development profile
  2. Select the app and certificate
  3. Validate that the machine you are using is in the list of machines to be included in the profile, tick the box
  4. Generate the certificate
  5. Download it, and drag it over the Xcode icon in the doc
  6. Go to the Build Settings tab in your target and set the provisioning profile to the one you've just downloaded

    • You haven't configured your iCloud/APN/GameCenter entitlements correctly.
Homocentric answered 13/1, 2014 at 9:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.