$npx -y skills add fayazara/macos-app-skills --skill buildBuild a native macOS app using xcodebuild from the command line. Use this skill whenever the user asks to build, compile, or check if their macOS project compiles successfully. Also use it when the user asks to fix build errors, verify changes compile, or run a debug build. Trigg
| 1 | # Build macOS App |
| 2 | |
| 3 | Build any native macOS Xcode project from the command line using `xcodebuild`. |
| 4 | |
| 5 | ## Finding the Project |
| 6 | |
| 7 | Before building, locate the Xcode project or workspace: |
| 8 | |
| 9 | ```bash |
| 10 | find . -maxdepth 2 -name "*.xcodeproj" -o -name "*.xcworkspace" | head -5 |
| 11 | ``` |
| 12 | |
| 13 | Then list available schemes: |
| 14 | |
| 15 | ```bash |
| 16 | xcodebuild -list -project "YourApp.xcodeproj" 2>/dev/null | grep -A 20 "Schemes:" |
| 17 | ``` |
| 18 | |
| 19 | ## Build Command |
| 20 | |
| 21 | Use this command template, replacing the project path and scheme: |
| 22 | |
| 23 | ```bash |
| 24 | DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcodebuild build \ |
| 25 | -project "YourApp.xcodeproj" \ |
| 26 | -scheme "YourApp" \ |
| 27 | -configuration Debug \ |
| 28 | -destination "platform=macOS" \ |
| 29 | 2>&1 | grep -E "(BUILD SUCCEEDED|BUILD FAILED|error:)" | head -20 |
| 30 | ``` |
| 31 | |
| 32 | For workspaces (projects with SPM dependencies or CocoaPods): |
| 33 | |
| 34 | ```bash |
| 35 | DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcodebuild build \ |
| 36 | -workspace "YourApp.xcworkspace" \ |
| 37 | -scheme "YourApp" \ |
| 38 | -configuration Debug \ |
| 39 | -destination "platform=macOS" \ |
| 40 | 2>&1 | grep -E "(BUILD SUCCEEDED|BUILD FAILED|error:)" | head -20 |
| 41 | ``` |
| 42 | |
| 43 | ## Interpreting Results |
| 44 | |
| 45 | - **BUILD SUCCEEDED** -- the build passed, report success to the user. |
| 46 | - **BUILD FAILED** with `error:` lines -- read each error, identify the source file and line, and help the user fix them. After fixing, re-run the build to verify. |
| 47 | - If the output is empty or unclear, re-run without the grep filter to get full output for diagnosis. |
| 48 | |
| 49 | ## When to Build |
| 50 | |
| 51 | - After making code changes, if the user asks to verify they compile |
| 52 | - When the user explicitly says "build", "compile", or "check if it builds" |
| 53 | - After fixing build errors, to confirm the fix worked |
| 54 | |
| 55 | ## Xcode Beta Toolchains |
| 56 | |
| 57 | If the project targets a beta SDK (e.g., macOS 26 Tahoe), you may need to point to the beta Xcode: |
| 58 | |
| 59 | ```bash |
| 60 | DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer xcodebuild build ... |
| 61 | ``` |
| 62 | |
| 63 | Check which Xcode is available: |
| 64 | |
| 65 | ```bash |
| 66 | ls /Applications/ | grep -i xcode |
| 67 | ``` |
| 68 | |
| 69 | ## Common Build Failures |
| 70 | |
| 71 | | Error | Fix | |
| 72 | |-------|-----| |
| 73 | | `no such module 'Sparkle'` | SPM dependency not resolved. Try `xcodebuild -resolvePackageDependencies` first | |
| 74 | | `no signing identity found` | Set `CODE_SIGN_IDENTITY=""` and `CODE_SIGNING_ALLOWED=NO` for command-line builds | |
| 75 | | `SDK "macosx" cannot be located` | Wrong `DEVELOPER_DIR`. Check Xcode installation path | |
| 76 | | `scheme not found` | Run `xcodebuild -list` to see available schemes | |