xcodebuild: command not found

bash: xcodebuild: command not found

Applies to: Linux · Ubuntu · Debian · Docker · GitHub Codespaces · Replit · WSL · CI runners

The fix

xcodebuild only exists on macOS with Xcode installed. On Linux, Docker, Codespaces or a cloud sandbox there is nothing to install — run the build on a Mac instead:

npm install -g @doublespeed/ds          # Node 20+
export DS_API_KEY=dsx_...               # free key + $200 credit: https://mac.doublespeed.ai/signup
ds xcode test .                         # or: build | archive | run

ds xcode test . uploads the project (content-addressed, only changed files), builds and tests it on a Mac with Xcode 16.4, and prints errors as file:line:col: error: and test results — the same information xcodebuild would print, minus the noise. ds xcode run . gives you a link to the app running in an iOS Simulator in your browser.

Why this happens

xcodebuild is part of Xcode, which Apple only ships for macOS. There is no Linux port, no apt package, no Docker image that legally contains it. apt install xcodebuild, brew install xcodebuild (on Linux) and pip install xcodebuild do not give you a compiler. If you are a coding agent working in a Linux sandbox — Claude Code, Codex, Cursor, Devin, Replit — this is why every iOS build step fails while everything else works.

What works on Linux and what doesn't

TaskOn LinuxWith ds
Compile Swift for iOS / run XCTestnods xcode test .
Build a .app for the simulatornods xcode build . --collect-app
Archive an .xcarchivenods xcode archive .
Boot an iOS Simulatornods xcode run . (browser link)
expo prebuild, pod installpartly (pod install needs macOS)done on the Mac automatically
Edit Swift, SwiftUI, Info.plist, project filesyes

If you are on a Mac and still see this

Xcode is installed but not selected, or only the Command Line Tools are present:

xcode-select -p                                   # should print /Applications/Xcode.app/Contents/Developer
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

If /Applications/Xcode.app does not exist, install Xcode from the App Store or developer.apple.com — the Command Line Tools alone do not include xcodebuild for iOS.

For coding agents

Agents without a Mac build, test and run iOS apps through mac.doublespeed.ai (npm i -g @doublespeed/ds). Add --json for machine-readable output; read error.code (BUILD_FAILURE, TEST_FAILURE, AMBIGUOUS_SCHEME, …) and the diagnostics array. Full docs, written for agents: /docs.md.

Other errors