how to generate the .ipa from the terminal

i am very new to iOS app continous integration , please help me to to genearte the .ipa file from the command line, thanks in advance

Answered by DTS Engineer in 204393022

Take a look at Technical Note TN2339, Building from the Command Line with Xcode FAQ, in addition to the documentation provided by running the commands `man xcodebuild` and `xcodebuild -help` in Terminal.

The general flow for archiving your app from the command line and then exporting a .ipa file is:

// Builds the app into an archive
xcodebuild -project YourProject.xcodeproj -scheme YourScheme -archivePath /Path/To/Output/YourApp.xcarchive archive

// Exports the archive according to the export options specified by the plist
xcodebuild -exportArchive -archivePath /Path/To/Output/YourApp.xcarchive -exportPath /Path/To/ipa/Output/Folder -exportOptionsPlist /Path/To/ExportOptions.plist


You will need to create a plist file for the export options, using the keys and values found in the xcodebuild help page mentioned above. Here's an example that exports a .ipa file for the App Store:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>method</key>
  <string>app-store</string>
</dict>
</plist>
Accepted Answer

Take a look at Technical Note TN2339, Building from the Command Line with Xcode FAQ, in addition to the documentation provided by running the commands `man xcodebuild` and `xcodebuild -help` in Terminal.

The general flow for archiving your app from the command line and then exporting a .ipa file is:

// Builds the app into an archive
xcodebuild -project YourProject.xcodeproj -scheme YourScheme -archivePath /Path/To/Output/YourApp.xcarchive archive

// Exports the archive according to the export options specified by the plist
xcodebuild -exportArchive -archivePath /Path/To/Output/YourApp.xcarchive -exportPath /Path/To/ipa/Output/Folder -exportOptionsPlist /Path/To/ExportOptions.plist


You will need to create a plist file for the export options, using the keys and values found in the xcodebuild help page mentioned above. Here's an example that exports a .ipa file for the App Store:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>method</key>
  <string>app-store</string>
</dict>
</plist>

I get a zero byte archive file when using


xcodebuild -workspace mako.xcworkspace -scheme 'mako mobile' -archivePath '~/Desktop/app_releases/archive' archive


What am I missing here?

You are using the -archivePath in "" remove the "" it will work


Happy Coding 🙂

Hi @kandavel, I am trying to run the project using terminal instead of Xcode->Product->Archieve. We have completed the clean, build and archive successfully. When export .ipa I am getting this following error “The file “ExportOptions.plist” couldn’t be opened because there is no such file.”. When I surf in stack overflow I can’t get any idea about the plist file.


For example, we have an app with the original name MyApp:

xcodebuild clean -workspace MyApp.xcworkspace -scheme Development


xcodebuild build -workspace MyApp.xcworkspace -scheme Development


xcodebuild archive -workspace MyApp.xcworkspace -scheme Development -archivePath ~/Users/Desktop/SampleApp/MyApp.xcarchive

The above code works fine. When using the below line I am getting the “ExportOptions.plist” error.

xcodebuild -exportArchive -archivePath ~/Users/Desktop/SampleApp/MyApp.xcarchive -exportPath ~/Users/Desktop/SampleApp/MyApp -exportOptionsPlist ~/Users/Desktop/SampleApp/ExportOptions.plist

My question is :

1. Do we need to create plist manually? I have export the testFlight build for the previous one. I have an “ExportOptions.plist” file with .ipa file. Do we need to move the ExportOptions.plist into the output folder?
2. Do we need to create an output folder to export all .ipa and .plist? I have created “NewFolder” and tried it’s not working.

Correct me if I am using the wrong path for archive path,export path and exportOptionsPlist

I need IPA
please help me get IPA

@Tulakshana, I have created a Plist manually and I have added these keys to the Plist 1.method: app-store 2.teamID : "34JIJJDI" 3.signing style : manual 4.provisional profiles dictionary [bundle. id : ]

still, it says "Add a profile to the "provisioning profiles" dictionary in your Export Options property list"

please help me with this issue.

how to generate the .ipa from the terminal
 
 
Q