Recently I have come across an issue which Xcode 6 keep crashing when exporting ipa or validate the app. I got no choice but have to export the ipa on command line.

1. Clearn the project

1
$ xcodebuild clean -project /path/to/project.xcodeproj -configuration Release -alltargets

2. Create archive

Xcode - Scheme

1
$ xcodebuild archive -project /path/to/project.xcodeproj -scheme "Scheme name" -archivePath /path/to/output

See the image above, the scheme name you can refer to Xcode project.

E.g. Warranty Reminder

3. Export the archive to ipa

Xcode - Build Settings

1
$ xcodebuild -exportArchive -archivePath /path/to/output.xcarchive -exportPath /path/to/output -exportFormat ipa -exportProvisioningProfile "Provisioning Profile Name"

Regarding the provisioning profile, follow exactly the same as what you see in Xcode.

E.g. iOSTeam Provisioning Profile: com.jslim89.Warranty-Reminder

Note that the output file name without the ipa extension.

You're done.

I have make this into a shell script, you can download here.

Usage: Just edit the file, instruction is inside. Then run in your terminal

1
2
$ chmod ugo+x export.sh
$ ./export.sh

References: