Give Cursor's cloud agents a Mac for iOS work
Cursor's cloud agents run on Ubuntu machines. Store a NoMac API key as a Cursor secret, or add NoMac as an MCP server, and an agent can build and test an iOS app on a cloud Mac with Xcode.
· 5 min read
Need a Mac for this? NoMac gives your agent full macOS with Xcode for $0.80 an hour, billed by the minute. Start now →
Cursor's cloud agents, formerly called background agents, work on your repository in the cloud while you do something else. Cursor's setup docs say they “run on isolated Ubuntu machines”. Xcode runs only on macOS, so an agent there can edit Swift but cannot compile the app, run its tests or boot the iOS Simulator. With a NoMac API key it can start a cloud Mac with Xcode, do those steps there and stop it.
Not tested end to end: we have not run this setup in Cursor's cloud agents. The steps follow Cursor's documentation as of October 2026 and NoMac's own requirements. If you restrict the agents' network, it must allow the domains below.
Step 1: make an API key
Sign in at nomac.app/keys and create a key. It starts with nmk_. Anyone holding it can start Macs on your credit, so keep it in Cursor's secrets, never in the repository.
Step 2: store it as a Cursor secret
Open the Cloud Agents dashboard at cursor.com/dashboard/cloud-agents, go to Secrets and add NOMAC_API_KEY. Cursor says secrets there are “exposed to the cloud agent as environment variables”, which is where the NoMac CLI looks for the key.
Choose the Runtime Secret type. Cursor's security docs say a runtime secret is still loaded as an environment variable, but its value is redacted from the agent's tool call results, the chat transcript and commits. Secrets are injected when an agent starts, so start a new agent after adding one.
Step 3: choose how the agent reaches the Mac
The CLI in the agent's terminal
npx -y @nomac/cli@latest start --json npx -y @nomac/cli@latest sync . npx -y @nomac/cli@latest exec --wait 600 -- xcodebuild -scheme MyApp \ -destination 'generic/platform=iOS Simulator' build npx -y @nomac/cli@latest stop --json
sync sends the agent's working tree to ~/drive/src on the Mac, and exec runs the build there. The environment needs Node 20 or newer, the OpenSSH client and rsync: start creates a key with ssh-keygen, and sync uses ssh and rsync. If your environment lacks them, add them to its install step.
NoMac as an MCP server
Cursor's capabilities docs say cloud agents can use HTTP and stdio MCP servers, added through the MCP dropdown at cursor.com/agents, or by team admins under Dashboard, Plugins & MCPs. Add NoMac's hosted server as an HTTP server:
URL: https://mcp.nomac.app/mcp Header: Authorization: Bearer nmk_...
Cursor also supports OAuth for MCP servers, and NoMac's hosted server offers OAuth sign-in, so the header is one of two ways. For HTTP servers, Cursor says the configuration is “never present in the cloud agent's VM environment” and tool calls “are proxied through the backend”, so the key stays out of the VM.
Over MCP alone, the Mac gets the code from your Git host: the agent pushes its branch and clones it into ~/drive/src with exec_mac. For a private repository, keep a read-only token for it as a NoMac secret, such as GH_TOKEN, which the GitHub CLI on the Mac reads.
Step 4: the network
Cursor's docs say “the agent has internet access by default.” If you have not restricted it, there is nothing to add.
If you chose Default + allowlist or Allowlist only (on the Cloud Agents dashboard, under Security), add nomac.app for the CLI, and registry.npmjs.org if your list does not already allow npm. The CLI's exec, ssh, sync and pull also connect to NoMac's session gateway over HTTPS on port 443 (ssh and sync as a WebSocket). It is a separate host, not under nomac.app: the API returns it for each session, as the gateway field of POST /api/v1/mac/sessions/:id/access. Add it too.
Step 5: tell the agent how to use the Mac
Cursor reads AGENTS.md. Add a section like this and adjust the scheme:
## iOS builds - For anything that needs Xcode (builds, tests, the Simulator), use a NoMac cloud Mac. NOMAC_API_KEY is set. https://nomac.app/llms.txt explains NoMac. - Start one Mac per task and reuse it: npx -y @nomac/cli@latest start --json - npx -y @nomac/cli@latest sync . before each build. - Builds and tests: npx -y @nomac/cli@latest exec --wait 600 -- xcodebuild ... - Read the full compiler output before changing code. - Before you finish, always run: npx -y @nomac/cli@latest stop --json
Costs and limits
- ·$0.80 an hour while the Mac is ready, billed by the minute. Queue and setup time are free. A five-minute build costs about 7 cents.
- ·A session stops after two hours or $5 by default.
--max-durationand--max-costonstartchange that. - ·One Mac at a time by default: a
startwhile a Mac runs uses that Mac. - ·Stopping deletes the VM and everything outside
~/drive. The 50 GB drive keeps the project and build caches, so the next task's build is incremental.
Working in Cursor on your own computer instead? See Cursor on Windows, or open the cloud Mac in Cursor directly with Remote-SSH. Every command is in the CLI reference.