2

I need to install an .ipa file that I own onto my device, an iPhone 5.

I have the device, the iOS developer account (complete access), Xcode, etc. Now, how should I "codesign" it, add certificates, provisioning profiles and finally how do I install it in my device?

Armen Michaeli
  • 8,625
  • 8
  • 58
  • 95
rahulg
  • 2,183
  • 3
  • 33
  • 47

2 Answers2

5

Since you have an .ipa, what you need to do is extract the .ipa (basically a ZIP file), pull out some files related to the old signing, swap in your new provision profile, and then re-sign. Simply zip it back up and you should be good to go.

IPA="/path/to/file.ipa"
PROVISION="/path/to/file.mobileprovision"
CERTIFICATE="Name of certificate: To sign with" # must be in keychain
# unzip the ipa
unzip -q "$IPA"
# remove the signature
rm -rf Payload/*.app/_CodeSignature Payload/*.app/CodeResources
# replace the provision
cp "$PROVISION" Payload/*.app/embedded.mobileprovision
# sign with the new certificate
/usr/bin/codesign -f -s "$CERTIFICATE" --resource-rules Payload/*.app/ResourceRules.plist Payload/*.app
# zip it back up
zip -qr resigned.ipa Payload

This is all assuming that you're not trying to change the bundle ID or anything with entitlements. Note that the new profile must have the necessary entitlements for this to work on a device.

For a pre-made script that also does this, see the following:

https://github.com/RichardBronosky/ota-tools

Armen Michaeli
  • 8,625
  • 8
  • 58
  • 95
wottle
  • 13,095
  • 4
  • 27
  • 68
1

I got very nice linked from internet that you can create certificates, provisioning profile and co-design using following steps.

As you said you have complete access of you iOS developer account with 99$ yearly subscription. then you have to your system.

  • Create Developer cer from you with your certificate signing request or CSR. Download it and install it in to you key Chain by Double clock on Cer. that shoul appear in to you keyChain like following screenshot with private key. If with your Dev cer if there is no private-key then there is some mistake in to you system authority cer.

    enter image description here

  • Now for testing app in to your device you have to add your device UDID in to this dev cer. You cannot run an iOS application on a random device. You need to specify on which devices your iOS application should run by adding one or more iOS devices to the iOS Dev Center.

  • Browse to the Certificates, Identifiers & Profiles section of the iOS Dev Center, click the Devices tab in the iOS Apps section, and click the plus button in the top right. To register a device, enter a name for the device and he device's UDID. The UDID is an identifier that uniquely identifies an iOS device. Note that the UDID is not the same as the device's serial number.

    enter image description here

  • You can find the UDID of a device by connecting the device with your machine and launching Xcode's Organizer. You can open the Organizer by selecting Organizer from the Window menu. Select the Devices tab at the top and select the device you're interested in. The 40 character alphanumeric string next to the label Identifier is the device's UDID.

  • After add your device UDID then you need to create AppID for you application. To create a new app ID in the iOS Dev Center, navigate to the Certificates, Identifiers & Profiles section, click iOS Apps, and choose App IDs from the menu on the left. To create a new app ID, click the plus button in the top right. like following screenshot

    enter image description here

  • After cratering AppId then you need to Create a Provisioning Profile that use for code Signing. With the development certificate and the app ID in place, it's time to create a provisioning profile for your application. Before we start, it might be useful to explain what a provisioning profile is, because this is something that confuses a lot of new iOS developers.

  • It will become clearer if we create a provisioning profile for your application so let's do that now. In the Certificates, Identifiers & Profiles section of the iOS Dev Center, select the Provisioning Profiles tab in the iOS Apps section. Click the plus button in the top right to create a new provisioning profile. Select iOS App Development in the section labeled Development and click Continue. like following screenshot:

    enter image description here

  • Click on continue In the next step, select the app ID you created a few minutes ago.

    enter image description here

  • Select the development certificate from the list of certificates to associate the new provisioning profile with the correct certificate and click Continue.

    enter image description here

  • You then need to select the devices you wish to link to the provisioning profile. Remember that only these devices will be able to run your application during development.

    enter image description here

  • Give the provisioning profile a descriptive name so you can easily find it later. Click Generate and download the provisioning profile to your development machine. Double-click the provisioning profile to add it to Xcode.

    enter image description here

  • Open the Xcode project that you created during the previous tutorial and select the project from the Project Navigator on the left. Select the first item in the list of targets and click the tab labeled Build Settings at the top. search for the subsection titled Code Signing Identity

    enter image description here

  • After setup code sign, certificates,provisioning profiles create IPA by select device that connected Via Cable with Xcode. Run your project with your Device.

  • For Creating IPA Go to Top Bar of mac-screen--->Product-->Archive like following screenshot.

enter image description here

  • This process might be take some time for creating Build wait a while then you got new window with look like following.

enter image description here

  • Tap on distribute Button you get multiple option like following screenshot:

enter image description here

  • You have to select second option as same as above screenshot and click on Next Button. Then next screen with one drop-down. Select correct Identifier that you are using as a code sign And click on export.

  • After some process there is one window appear for location of save ipa file like following screenshot.

enter image description here

  • Yuhoo your IPA file is created now you can install by many thing for example using iTunes, using Test Flight using Diawi
Nitin Gohel
  • 49,482
  • 17
  • 105
  • 144
  • How does this answer the question? The OP has an .`ipa` file not an `.xcodeproj`... – trojanfoe Sep 03 '14 at 06:26
  • please OP said **how should I codesign it, add certificates, provisioning profiles and finally how do I install it in my device?** @trojanfoe – Nitin Gohel Sep 03 '14 at 06:29
  • He also said he had an `.ipa` file. Your answer assumes he is compiling his project from source. – trojanfoe Sep 03 '14 at 06:30
  • Hi @NitinGohel , yeah, this does not answer my question as of now. I can easily codesign for which I have the Xcodeproject. But in case of just the `ipa`, how do I do it – rahulg Sep 03 '14 at 07:06
  • check the end of my answer i provide a linked of DIAWI, test Flight go through and upload your ipa and dev provisioning profile after upload success open its provide link in to your device safari browser. and please read your question ones you are asking that **how should I codesign it, add certificates, provisioning profiles and finally how do I install it in my device?** – Nitin Gohel Sep 03 '14 at 07:09
  • in to your question you said how to codesign it and now you said I can easily codesign for which. what is this man...? please ask question clearly so we can provide actual answer instead of other things. – Nitin Gohel Sep 03 '14 at 07:14
  • @NitinGohel What is this man, please read the question properly, I clearly wrote **Install Unsigned IPA file** ! Man! you should have read the complete question in detail before providing such a long answer, man, now people will not be interested in responding my question. Wasting mine as well as your time, man! – rahulg Sep 03 '14 at 12:06
  • by the way i also provide answer of your install IPA. stuff your question title and it's description totally different. what does it mean. how should I codesign it, add certificates, provisioning profiles and finally how do I install it in my device? this answer is start to end in to description of you question you are asking 4 thing. lean how to ask question first. – Nitin Gohel Sep 03 '14 at 12:16