Building Mac and iOS Apps Without Opening Xcode
A guide to app development using only command line tools, bypassing Xcode's interface.
1Is Xcode-Free Development Possible?
Many developers complain about Xcode's complex interface. However, with Xcode installed, it's possible to develop apps entirely via command line tools without ever opening Xcode's GUI. This approach is ideal for automation-focused developers.
2Basic Requirements
Xcode.app must be installed as build tools come with this package. Tools like xcodebuild, notarytool, stapler and devicectl can be run directly from terminal. Only a few one-time GUI operations are required.
3Command Line Setup
Ensure your active development environment is set to Xcode using xcode-select command. The standalone CommandLineTools package isn't sufficient as iOS SDK and other necessary tools only come with Xcode.app.
4Project Management with XcodeGen
Use XcodeGen to manage Xcode projects automatically. This tool keeps your project settings in YAML format and regenerates the .xcodeproj file on each build. This means you only need to track the YAML file in git.
5One-Time Xcode Configurations
Accept Xcode license and install additional components. Add your Apple Developer account to Xcode and create a Developer ID Application certificate. This certificate will be used to sign your apps.
6Key Management
The generated Developer ID certificate and private key are stored in your login keychain. This private key is crucial for signing and cannot be re-downloaded, so make sure to back it up.
7Notarization Process
Before distributing your app, it needs to pass Apple's malware scan. Store your credentials once using notarytool. You'll need to use an app-specific password for this step.
8Automated Build Script
A single release.sh script can automate the entire process: archive → sign → notarize → staple → install to /Applications. Don't store any secrets in the script - keep everything secure in keychain.
9Additional Steps for iOS
iOS apps may require additional steps like provisioning profile management. Tools like devicectl help manage these processes from command line. You can get assistance from LLM tools for these tasks.
10Continuous Integration
This method is ideal for CI/CD pipelines. You can build and distribute without Xcode on services like GitHub Actions. Just ensure necessary certificates and profiles are available in the environment.
11Pros and Cons
Avoiding Xcode's interface may boost productivity, especially for repetitive tasks. However, you might lose access to some debugging features. This method works best for final builds and distribution.
12Future Outlook
Apple is expected to make developer tools more command-line friendly. Adopting this method now prepares you for future changes. Xcode-free development aligns perfectly with modern software engineering practices.