Build iOS Apps in Claude Code prompt
Set up the XcodeBuild MCP server in my Claude Code so you (Claude Code) can build, run,
and test my iOS app on the iOS Simulator by yourself - launch it, tap through the UI like
a real user, read the build and runtime errors directly, and fix them until the app works -
instead of me copying Xcode errors back into the chat by hand. XcodeBuild MCP is a free,
open-source MCP server (npm: xcodebuildmcp). Work in the order below and change nothing
until STEP 1.
Safety first: check whether it is already configured - run `claude mcp list` and look for
"XcodeBuildMCP" (any casing). If a server already runs `npx ... xcodebuildmcp@latest mcp`,
tell me, change nothing, and skip to VERIFY. Never overwrite my existing config.
(If a bare `claude ...` command is blocked inside this session, re-run just that command
with CLAUDECODE cleared: `CLAUDECODE= claude ...` on macOS/Linux, or
`$env:CLAUDECODE=''; claude ...` in PowerShell.)
STEP 0 - Check the prerequisites first, install nothing yet. This is Mac + Xcode only.
Confirm all three and tell me if any is missing:
1. macOS - this drives Xcode, so it does not work on Windows or Linux.
2. Xcode 16 or newer with command-line tools. Run `xcodebuild -version`; if that fails,
tell me to install Xcode from the App Store and run `xcodebuild -runFirstLaunch`.
3. Node 18 or newer (the server runs via npx). Run `node -v`.
If anything is missing, stop and tell me exactly what to install before continuing.
STEP 1 - Add the server at USER scope so it works in every project. The env var turns on the
simulator AND the ui-automation tools, so you can actually tap and type in the app - without
it you could only build, not "click around". Run this exactly:
claude mcp add --scope user XcodeBuildMCP -e "XCODEBUILDMCP_ENABLED_WORKFLOWS=session-management,project-discovery,simulator,ui-automation" -- npx -y xcodebuildmcp@latest mcp
That is the whole install - npx fetches the server on demand, no global install, no API key.
STEP 2 - Restart so it loads. MCP servers only load at startup, so tell me to fully quit and
reopen Claude Code now (and approve "XcodeBuildMCP" if it asks). Until I restart, the new
tools are not available to you - so hand this back to me and wait.
VERIFY (after I restart) - prove it works on a real app. Run `claude mcp list` and confirm
"XcodeBuildMCP" shows as connected. Then point at my iOS project (ask me for the path if you
do not know it) and, using the XcodeBuild MCP tools: find the scheme, build and run it on an
iOS simulator, take a screenshot, and read the captured runtime log. Tell me it built,
launched, and that you can see the running app. If the build fails, read the error from the
log yourself and tell me what is wrong - that is the whole point: you read the errors, not me.
Finally, summarize where it stands: whether XcodeBuildMCP is connected, that you can build and
run my app on the simulator and drive its UI, and remind me that to run on a physical iPhone
(not just the simulator) I would enable the "device" workflow and set up signing later.Claude Code is great at writing iOS code, but it cannot run what it writes. It has no way to build your project, launch it on a simulator, or see what actually happens - so the moment something breaks, you become the messenger: you build in Xcode, copy the red error, paste it back into the chat, wait for a fix, and do it all again. That copy-paste loop is where most of the time on an iOS project quietly disappears.
XcodeBuild MCP closes that loop. It is a free, open-source MCP server that gives Claude Code its own Xcode. Once it is wired in, Claude can find your scheme, build the app, boot an iOS simulator, install and launch it, take screenshots, read the on-screen UI, and tap and type through it like a real user - and every build and runtime error is captured automatically, so Claude reads the failures itself and fixes them until the app actually runs. You stop being the error courier.
The prompt below installs it in about 30 seconds. It adds the server at user scope so it works in every project, and turns on both the simulator and the UI-automation tools so Claude can genuinely click around, not just compile. It checks what you already have before changing anything, never overwrites your config, and finishes by building and running a real app to prove it works. You need a Mac with Xcode and Node; it is the free, open-source piece of the kind of setup ClockedCode curates for you.