<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/automating-ios-builds-from-command-line-with-xcodebuild-rs14zlcd4" -->

---
title: Automating iOS Builds from Command Line with xcodebuild
description: A step-by-step walkthrough of using xcodebuild to archive and export iOS apps from the command line instead of through Xcode's GUI. It covers the archive...
canonical: https://daily.dev/posts/automating-ios-builds-from-command-line-with-xcodebuild-rs14zlcd4
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Automating iOS Builds from Command Line with xcodebuild | daily.dev
og:description: A step-by-step walkthrough of using xcodebuild to archive and export iOS apps from the command line instead of through Xcode's GUI. It covers the archive...
og:url: https://daily.dev/posts/automating-ios-builds-from-command-line-with-xcodebuild-rs14zlcd4
og:image: https://api.daily.dev/og/posts/rs14Zlcd4.png
og:image:alt: Automating iOS Builds from Command Line with xcodebuild
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Automating iOS Builds from Command Line with xcodebuild

**[Medium](https://daily.dev/sources/medium_js)** · 5 min read · 0 upvotes · 0 comments

## Summary

A step-by-step walkthrough of using xcodebuild to archive and export iOS apps from the command line instead of through Xcode's GUI. It covers the archive command with workspace, scheme, configuration, and signing flags, the export command with an ExportOptions.plist file, and chaining both into a single npm script for automated build-to-distribution workflows, including notes on Expo-specific gotchas like expo prebuild --clean deleting the ios/ folder.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://medium.com/@hasini2020/automating-ios-builds-from-command-line-with-xcodebuild-db5456d04803>

## Questions this post answers

### How do I archive an iOS app from the command line using xcodebuild?

Run xcodebuild archive with -workspace pointing to your .xcworkspace file, -scheme for the target scheme, -configuration Release, -destination generic/platform=iOS, and -archivePath for where to save the .xcarchive. Optional flags -allowProvisioningUpdates and DEVELOPMENT_TEAM=YOUR_TEAM_ID let xcodebuild auto-update provisioning profiles and certificates during signing.

_Developers scripting mobile release pipelines can find command-by-command breakdowns like this one on daily.dev._

### How do I export an .ipa file from an xcarchive using xcodebuild?

Run xcodebuild -exportArchive with -archivePath pointing to the .xcarchive, -exportPath for the output directory, and -exportOptionsPlist pointing to a manually created plist specifying method (release-testing, app-store-connect, debugging, or enterprise), teamID, and signingStyle (automatic or manual). Setting destination to upload in the plist uploads directly to App Store Connect instead of saving locally.

_Anyone automating TestFlight or App Store uploads can track workflow details like this via daily.dev._

### How can I chain xcodebuild archive and export into a single automated command?

Chain the archive and export commands with && so the export only runs if the archive succeeds, then wrap the combined command as an npm script in package.json (e.g. a build:ios script). This lets a single command produce a signed .ipa ready for Firebase App Distribution, TestFlight, or another distribution service.

_Teams building CI scripts for mobile release can keep up with practical automation patterns on daily.dev._

## Similar posts on daily.dev

- [Building and Shipping Mac and iOS Apps Without Ever Opening Xcode](https://daily.dev/posts/building-and-shipping-mac-and-ios-apps-without-ever-opening-xcode-hniefalt7) · Hacker News · 2 upvotes · 0 comments
- [How to install your own apps on your iPhone with Xcode](https://daily.dev/posts/how-to-install-your-own-apps-on-your-iphone-with-xcode-rrp1uvbm9) · Flavio Copes · 1 upvotes · 0 comments

---

Tags: [#ios](https://daily.dev/tags/ios), [#cicd](https://daily.dev/tags/cicd), [#xcode](https://daily.dev/tags/xcode)

[View this post on daily.dev](https://daily.dev/posts/automating-ios-builds-from-command-line-with-xcodebuild-rs14zlcd4)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Automating iOS Builds from Command Line with xcodebuild","url":"https://daily.dev/posts/automating-ios-builds-from-command-line-with-xcodebuild-rs14zlcd4","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/automating-ios-builds-from-command-line-with-xcodebuild-rs14zlcd4"},"datePublished":"2026-08-17T19:03:31.338Z","dateModified":"2026-09-14T06:42:48.265Z","description":"A step-by-step walkthrough of using xcodebuild to archive and export iOS apps from the command line instead of through Xcode's GUI. It covers the archive...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d6ab0a9a223ee01bc82d647f54feb2d2?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d6ab0a9a223ee01bc82d647f54feb2d2?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Medium","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Medium","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/medium","url":"https://daily.dev/sources/medium_js"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/automating-ios-builds-from-command-line-with-xcodebuild-rs14zlcd4","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ios,cicd,xcode","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Medium","item":"https://daily.dev/sources/medium_js"},{"@type":"ListItem","position":3,"name":"Automating iOS Builds from Command Line with xcodebuild"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/automating-ios-builds-from-command-line-with-xcodebuild-rs14zlcd4#faq","mainEntity":[{"@type":"Question","name":"How do I archive an iOS app from the command line using xcodebuild?","acceptedAnswer":{"@type":"Answer","text":"Run xcodebuild archive with -workspace pointing to your .xcworkspace file, -scheme for the target scheme, -configuration Release, -destination generic/platform=iOS, and -archivePath for where to save the .xcarchive. Optional flags -allowProvisioningUpdates and DEVELOPMENT_TEAM=YOUR_TEAM_ID let xcodebuild auto-update provisioning profiles and certificates during signing. Developers scripting mobile release pipelines can find command-by-command breakdowns like this one on daily.dev."}},{"@type":"Question","name":"How do I export an .ipa file from an xcarchive using xcodebuild?","acceptedAnswer":{"@type":"Answer","text":"Run xcodebuild -exportArchive with -archivePath pointing to the .xcarchive, -exportPath for the output directory, and -exportOptionsPlist pointing to a manually created plist specifying method (release-testing, app-store-connect, debugging, or enterprise), teamID, and signingStyle (automatic or manual). Setting destination to upload in the plist uploads directly to App Store Connect instead of saving locally. Anyone automating TestFlight or App Store uploads can track workflow details like this via daily.dev."}},{"@type":"Question","name":"How can I chain xcodebuild archive and export into a single automated command?","acceptedAnswer":{"@type":"Answer","text":"Chain the archive and export commands with && so the export only runs if the archive succeeds, then wrap the combined command as an npm script in package.json (e.g. a build:ios script). This lets a single command produce a signed .ipa ready for Firebase App Distribution, TestFlight, or another distribution service. Teams building CI scripts for mobile release can keep up with practical automation patterns on daily.dev."}}]}
```

