TL;DR - When setting up an AI agent for iOS development, the default approach is to have the agent run headless xcodebuild commands. To save disk space and time, you might point the agent at your active Xcode DerivedData folder. I found that this doesn't work. While they write to the same directory, xcodebuild and Xcode.app do not actually share their incremental build state. Instead, they overwrite each other's intermediate files, forcing rebuilds. To fix this, drive headless builds using the Xcode MCP bridge (xcrun mcpbridge). This allows your agent to use Xcode.app's internal build engine, safely sharing a single DerivedData folder, drastically reducing disk usage, and preserving fast incremental builds when switching between xcode and agent (terminal).
The Agentic Development Disk Space Trap
When doing AI driven iOS development, one of the most common approach is to have our agent operates via the command line (xcodebuild), while you might be doing some debugging / UI verification in the GUI (Xcode.app).
Because DerivedData folders frequently exceed 10GB–20GB for modern apps, maintaining separate build directories for the human and the agent wastes massive amounts of SSD space. It also wastes time, as the agent cannot benefit from the compilation work you just completed in Xcode.






