When enabled, after extracting or locating the Xcode bundle the installer checks
/usr/bin/xcodebuild -checkFirstLaunchStatus (with DEVELOPER_DIR set)
and, if needed, runs sudo -n /usr/bin/xcodebuild -license accept (when
-license check fails) followed by sudo -n /usr/bin/xcodebuild -runFirstLaunch
non-interactively, then re-verifies status.
License notice: Enabling this option automatically accepts Apple's Xcode and SDK license agreements and installs bundled system packages (such as simulator/device support frameworks) on the macOS agent. Keep this disabled unless you accept those terms for your fleet.
Least-privilege sudoers setup: On the macOS agent, create a drop-in file using
visudo (do not include dots in the filename; visudo validates syntax and
applies the required 0440 root:wheel permissions):
sudo visudo -f /etc/sudoers.d/jenkins-xcode
Add these lines (replacing jenkins with your agent's macOS username; never grant
NOPASSWD: ALL or sudo rules for user-writable tool directories):
Defaults:jenkins env_keep += "DEVELOPER_DIR"
jenkins ALL=(root) NOPASSWD: /usr/bin/xcodebuild -license accept, /usr/bin/xcodebuild -runFirstLaunch
You can verify the rule as the agent user with sudo -l.
Security caveat: Because any process running as the agent user can invoke these
commands with a custom DEVELOPER_DIR, only use passwordless sudo on
trusted, single-tenant, or ephemeral macOS CI agents (not shared machines running untrusted
pull-request code).