Skip to main content
On this page

Build an iOS .ipa from the Command Line on Windows

Go through the whole iOS workflow on Windows using only the terminal. Create a project, add your certificate, install and debug on your iPhone and build a Release .ipa. Linux and macOS work the same way.

Last updated

To build an iOS .ipa from the command line on Windows, you need two terminal commands, kxbuild and kxdevice. Install the toolchain with one line, create a project with kxbuild project create, put your .p12 certificate and profile in a keychain folder, run kxbuild build --install to build, sign and install on an iPhone connected over USB, then add -c Release --export app-store to get an .ipa ready for the App Store. Linux and macOS use the same commands with forward-slash paths.

1. How do I install the command-line tools?

Run the command for your OS and follow the prompts.

Windows · PowerShell

PS> irm https://www.kxbuild.net/install.ps1 | iex

Linux / macOS · Terminal

$ curl -fsSL https://www.kxbuild.net/install.sh | bash

When it finishes, open a new terminal and run kxbuild doctor. You're set when every check passes. Doctor also sets up the iOS SDK; if that download fails, follow install the iOS SDK on Windows and Linux. For other ways to install, see the install page.

2. How do I create an iOS project from the command line?

Create one from the SwiftUI template. Pass a project name, a bundle ID and the parent folder.

> kxbuild project create -t app_swiftui -n MyApp -b com.example.myapp -o D:\projects

The project lands in D:\projects\MyApp. Run kxbuild project templates to list all 11 templates, or see Project templates. For an existing Xcode project, skip this step and pass its .xcodeproj or .xcworkspace path to the commands below.

3. Where does the certificate go before building an .ipa?

Put your .p12 certificate and .mobileprovision profile in a keychain folder, either in the project root or under KXBUILD_HOME. In the same folder, add a password.properties file with one file=password line per certificate. The profile must be a development profile that includes this iPhone's UDID. See how to sign iOS apps on Windows.

development.p12=123456

4. How do I check that my computer sees the iPhone?

Connect the iPhone to your computer over USB and run the command below. If the phone is in the list, it's recognized.

> kxdevice device list

The first time, you need to do three things.

  • Install the driver. If the Apple device drivers are missing, the command above tells you to run kxdevice doctor. Install Apple Devices from the Microsoft Store, open it, and check that it shows your iPhone.
  • Trust the computer. Tap Trust when the iPhone asks.
  • Turn on Developer Mode. On the iPhone, go to Settings > Privacy & Security > Developer Mode, turn it on and restart.

5. How do I build and install on the iPhone in one command?

Add --install to the build command to build, sign and install in one step. It uses the Debug configuration by default. Then open the app on the iPhone.

> kxbuild build D:\projects\MyApp\MyApp.xcodeproj --install

6. How do I build a Release .ipa from the command line?

Add an Apple Distribution certificate and an App Store provisioning profile to the keychain folder, then build with the Release configuration and --export app-store.

> kxbuild build D:\projects\MyApp\MyApp.xcodeproj -c Release --export app-store

The build writes build\MyApp.ipa in the project folder. Upload it to App Store Connect with kxstore build upload build\MyApp.ipa. See publish to the App Store from Windows. These two kxbuild build commands are all it takes to build an iOS .ipa from the command line, and they drop straight into a CI script.

Next steps