Dennis
Dennis

Reputation: 693

Permission Denied when running Mac app after upgrading to XCode 4.4

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?

Upvotes: 16

Views: 11528

Answers (8)

rougeExciter
rougeExciter

Reputation: 7513

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.

Upvotes: 0

geekydevjoe
geekydevjoe

Reputation: 108

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.

Upvotes: 0

uliwitness
uliwitness

Reputation: 8843

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?

Upvotes: 0

adamdehaven
adamdehaven

Reputation: 5920

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.

Upvotes: 0

endy
endy

Reputation: 3872

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

Also check your gatekeeper settings.

Upvotes: 0

Peter Hosey
Peter Hosey

Reputation: 96373

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?)

Upvotes: 6

jab
jab

Reputation: 4063

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.

Upvotes: 9

Old McStopher
Old McStopher

Reputation: 6359

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.

Upvotes: 8

Related Questions