| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A command-line tool for manipulating Xcode project files (.xcodeproj) using Swift. This tool provides comprehensive functionality to create, modify, and manage Xcode projects programmatically. This is especially handy when writing code with coding agent such as Claude Code, Gemini CLI, or Codex.
This project was inspired by a YouTube video that recommended using command-line tools instead of Model Context Protocol (MCP) servers for certain workflows. While MCP servers can take advantage of context and are excellent for interactive use, CLI tools offer distinct advantages:
By converting the functionality from an MCP server to a standalone CLI, we get the best of both worlds: the comprehensive Xcode project manipulation capabilities with the speed and simplicity that developers expect from command-line tools.
Cross-platform installation for any environment:
npm install -g @ainame/xcodeproj-cliSupported platforms:
Perfect for CI/CD pipelines, Docker containers, AI coding assistants, and development machines. The appropriate binary is automatically downloaded during installation.
brew tap ainame/xcodeproj-cli https://github.com/ainame/xcodeproj-cli
brew install xcodeprojgit clone https://github.com/ainame/xcodeproj-cli.git
cd xcodeproj-cli
swift build -c release
# Option 1: Copy to a directory in your PATH
cp .build/release/xcodeproj /path/to/your/bin/
# Option 2: Add to PATH in your shell profile
echo 'export PATH="$PATH:/path/to/xcodeproj-cli/.build/release"' >> ~/.zshrc
source ~/.zshrc
# Option 3: Create an alias
echo 'alias xcodeproj="/path/to/xcodeproj-cli/.build/release/xcodeproj"' >> ~/.zshrc
source ~/.zshrc# Create a new Xcode project
xcodeproj create MyApp --organization-name "My Company" --bundle-identifier "com.mycompany.myapp"
# List all targets in a project
xcodeproj list-targets MyApp.xcodeproj
# Add a file to a target
xcodeproj add-file MyApp.xcodeproj MyApp Sources/NewFile.swift
# Create a new target
xcodeproj add-target MyApp.xcodeproj MyFramework framework com.mycompany.myframework
# Add a dependency between targets
xcodeproj add-dependency MyApp.xcodeproj MyApp MyFramework
# Add a framework dependency
xcodeproj add-framework MyApp.xcodeproj MyApp UIKit
# Add a Swift Package dependency
xcodeproj add-swift-package MyApp.xcodeproj https://github.com/apple/swift-argument-parser "from: 1.0.0" --target-name MyApp
# Set build settings
xcodeproj set-build-setting MyApp.xcodeproj MyApp SWIFT_VERSION 5.9
# Add a run script build phase
xcodeproj add-build-phase run-script MyApp.xcodeproj MyApp "SwiftLint" "swiftlint"
# Duplicate a target
xcodeproj duplicate-target MyApp.xcodeproj MyApp MyApp-Staging --new-bundle-identifier com.mycompany.myapp.stagingThe tool supports various Swift Package version requirement formats:
# Exact version
xcodeproj add-swift-package MyApp.xcodeproj https://github.com/realm/realm-swift "10.45.0"
# From version (up to next major)
xcodeproj add-swift-package MyApp.xcodeproj https://github.com/realm/realm-swift "from: 10.0.0"
# Up to next minor version
xcodeproj add-swift-package MyApp.xcodeproj https://github.com/realm/realm-swift "upToNextMinor: 10.45.0"
# Branch reference
xcodeproj add-swift-package MyApp.xcodeproj https://github.com/realm/realm-swift "branch: main"
# Specific revision
xcodeproj add-swift-package MyApp.xcodeproj https://github.com/realm/realm-swift "revision: abc123"Add custom build phases with various types:
# Run script build phase
xcodeproj add-build-phase run-script MyApp.xcodeproj MyApp "Code Generation" "scripts/generate_code.sh"
# Copy files build phase
xcodeproj add-build-phase copy-files MyApp.xcodeproj MyApp "Copy Resources" resources --files config.plist assets.bundle# General help
xcodeproj --help
# Command-specific help
xcodeproj create --help
xcodeproj add-swift-package --helpRun local macOS tests:
scripts/test.shOn Linux (CI/CD or native Linux development):
scripts/test-linux-native.shOn macOS/Windows (local development with Docker):
scripts/test-linux.shRun all tests (macOS + Linux) with automatic environment detection:
# Run all tests (automatically chooses native or Docker-based Linux tests)
scripts/test-all.sh
# Skip Linux tests if needed
scripts/test-all.sh --skip-linuxPrerequisites for Linux Testing:
The Linux tests verify full compatibility by:
Environment-aware testing:
To release a new version:
# Release with full testing (macOS + Linux)
scripts/release.sh 0.1.4
# Release without Linux tests (if Docker unavailable)
scripts/release.sh 0.1.4 --skip-linuxThe release script automatically:
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
This project is available under the MIT License. See the LICENSE file for more details.
This project builds upon the excellent work of these open-source projects and their contributors:
| Back | FazBrowse Home | New Git URL |