46

I was looking for some advice on provisioning profiles / certificates etc... I use an iMac at work to develop on, and I also sometimes find myself checking out my code from git onto my MacBook Pro at home but I always run into issues when I want to test on my iPhone from another computer.

Obviously my provisioning profiles on the device match the certificate issued to my iMac from work, so from my laptop, I can't test on the device because the provisioning profile doesn't match a certificate. so I get a code sign error.

What can I do to bypass this ?

Thanks in advance.

Daniel
  • 23,129
  • 12
  • 109
  • 154

5 Answers5

75

Apple provides an easy solution to working on multiple machines.

You can export your developer profile from your work iMac and move it onto your Macbook Pro.

  1. In Xcode 4, bring up the Organizer. Click on "Devices"/

  2. Now, click on "Developer Profiles" in the sidebar.

  3. Then, on the bottom of the screen you will see a button called "Export" and a button called "Import". On the computer with the original certificates click "export" and save the profile. You may be prompted to enter a password.

  4. On the second computer, use "import" to install the certificates.

Exporting a developer profile

You should be able to develop and test seamlessly between the two machines now.

Edit:

According to Topher Fangio in the comments below, you may need to:

open Keychain Access, then find [your] iPhone Developer Certificate on my desktop, and export it. Then import it on your [second machine]. If you see the dropdown and associated private key on one machine, but not the other, then you need to export it apparently.

Hopefully Topher's insight will help anyone who has trouble with using Xcode to do this.

Community
  • 1
  • 1
Moshe
  • 57,511
  • 78
  • 272
  • 425
  • Could you give a little more detail about this please ? – Daniel Aug 14 '11 at 16:04
  • Thanks a lot, I remember seeing these buttons in the organizer a while ago now, do feel a little silly having not remembered and tried before asking the question, will have to bite my tongue a little longer next time. Thank you – Daniel Aug 14 '11 at 16:09
  • 1
    Of course, no problem. I'd been meaning to canonicalize this sort of post, thanks for the opportunity. – Moshe Aug 14 '11 at 16:15
  • 5
    Just a note: this post did not work for me. I wound up needed to open Keychain Access, find my iPhone Developer Certificate on my desktop, and export it, then import it on my laptop. If you see the dropdown and associated private key on one machine, but not the other, then you need to export it apparently. This fixed my issue. – Topher Fangio Apr 04 '12 at 19:44
  • @TopherFangio - Really? Please elaborate. – Moshe Apr 04 '12 at 19:45
  • i forgot to to export my certificae or profile in my other computer and now i am abroad dwith my laptopn.I imported the profile that i downloaded from developer center.I did not creaate a new certficate so i also downloaded it but the thing is that wether the certificate or profile seem to be ok.Organizer says that a valid code signin is not found – Ilker Baltaci Aug 19 '12 at 15:56
  • @Moshe That first link in your post to Apple is no longer working – Peter M Oct 25 '12 at 12:52
  • Thanks @Moshe, but did you really have to say "Apple provides an easy solution ..."? I feel we should not evangelise Apple here on this site – ericn Jun 21 '14 at 06:20
  • Great, I couldn't find this in Xcode 5, regardless, I was able to export from KeyChain and then import by double clicking on the second computer. Thanks – Ege Akpinar Aug 26 '14 at 10:56
  • but, if we don't have access to the other mac at the moment that has the account setup and want to do something urgent on the new mac? – Min Soe Jun 14 '15 at 12:07
10

If you're using Xcode 6.x - 8.x, there is a very easy way to do this:

See the section titled Exporting and Importing Certificates and Profiles in the app distribution guide.

To sum it up:

  1. go to Xcode's preferences
  2. click on accounts
  3. click on the gear icon at the bottom left
  4. select 'export accounts' and enter the desired filename and password
  5. open the newly created file on your new machine

Done! this will import the profiles from the previous machine.

Turnip
  • 35,836
  • 15
  • 89
  • 111
Julian B.
  • 3,605
  • 2
  • 29
  • 38
  • but, what if we can't access to the mac that the account is setup. Anyway? – Min Soe Jun 14 '15 at 12:05
  • In that case you will probably have to re-create the provisioning profiles. In in that case your problem doesn't apply to this question since it does not apply to multiple machines. – Julian B. Jun 15 '15 at 15:28
  • it's still multiple machine. Let's say I have iMac in the office and all the source code in the cloud. So, every time I went home, i turn off iMac, and something comes up urgently. I have to work from home and I don't have account setup in my macbook. That doesn't account multiple machine ? – Min Soe Jun 16 '15 at 02:10
3

I have Xcode 4.6.1 and in the organizer there is now a refresh button at the bottom right. Hit that, sign in to your Apple account and it should pull all the relevant profile info.

-Cheers

swift taylor
  • 610
  • 5
  • 10
  • 1
    Also a good solution. But the answer marked as correct will also import other profiles and certificates. You can export the entire bunch, if say you're working in multiple teams - not uncommon for freelancing, or even white label work. – Daniel Mar 27 '13 at 21:59
  • excellent point @Daniel I forgot to mention that I had to export my developer cert from the computer that I had generated the signing request on, and import it on the other computer. – swift taylor Mar 28 '13 at 17:34
3

You need to keep the original private key file and certificate file you create as the absolute first step in the process on the portal. Then you need to import not just the certificate but the private key file too on your laptop. Once that is done, you should be able to sign with your developer cert and provisioning profile on both laptops.

I've gotten in this situation too. You can start it all over on the provisioning portal if needed with no real negative effects.

Nathanial Woolls
  • 5,231
  • 24
  • 32
  • This sounds like what I need, I will have to try it on Monday when I can get onto the iMac and get my private key file. By Private key file are you referring to the certificate request file I generated with Keychain prior to obtaining my certificate? – Daniel Aug 14 '11 at 16:05
1

This answer does not seem to apply to Xcode 4.6.3 where the Organizer does not have a "Developer Profile" section.

In Xcode 5 and 6 (which most will be using at the time of posting) there is a different procedure which is discussed here.

Community
  • 1
  • 1
David
  • 1,018
  • 13
  • 22