Codex repeatedly prompts for xcodebuild approval due to inconsistent shell wrapping (/bin/zsh -lc vs direct execution)
What version of the IDE extension are you using?
0.4.74
What subscription do you have?
Pro
Which IDE are you using?
Cursor
What platform is your computer?
Darwin 25.2.0 arm64 arm
What issue are you seeing?
Codex (Cursor extension) repeatedly prompts for approval to run xcodebuild even after I select “Yes, and don’t ask again…”. The approval is not reliably reused because Codex alternates between running xcodebuild directly and running it through a shell wrapper (/bin/zsh -lc '…'). When the wrapper form is used, it appears to be treated as a different command prefix, so the previously stored approval does not match and I get prompted again.
This happens even back-to-back in the same Cursor session: one xcodebuild invocation runs without prompting, and the next invocation immediately prompts again.
Example prompt text (PII redacted, representative of what is shown):
Would you like to run the following command?
Reason: Need permission to run this command.
$ xcodebuild -workspace "REDACTED.xcworkspace" -scheme "REDACTED" -destination "platform=macOS" -derivedDataPath ".DerivedData" build-for-testing test-without-building -only-testing:"REDACTED/REDACTED" > .DerivedData/REDACTED.log 2>&1
1. Yes
2. Yes, and don't ask again for commands that start with /bin/zsh -lc 'xcodebuild -workspace ...
3. No, and tell Codex what to do differently
Even after choosing option 2, I see the same approval prompt again on subsequent xcodebuild runs (sometimes the very next run), because the command prefix differs between invocations (raw xcodebuild … vs /bin/zsh -lc 'xcodebuild …').
Impact: This drastically slows down my workflow because I rely on xcodebuild for unit tests and build checks; being forced to approve each invocation makes the agent close to unusable.
What steps can reproduce the bug?
- In Cursor (2.4.37) with the Codex extension enabled, ask Codex to run Xcode tests or verify a build so it invokes xcodebuild.
- When prompted, select: “Yes, and don’t ask again for commands that start with …”
- Ask Codex to run another test/build immediately after (or proceed naturally until it runs xcodebuild again).
- Observe that Codex prompts again.
Concrete example (redacted):
Command that ran without prompting:
xcodebuild -workspace "REDACTED.xcworkspace" \
-scheme "REDACTED (macOS)" \
-destination "platform=macOS" \
-derivedDataPath ".DerivedData" \
build-for-testing test-without-building \
-only-testing:"REDACTEDTests/SomeTestCase/testExampleOne" \
-only-testing:"REDACTEDTests/SomeTestCase/testExampleTwo" \
-only-testing:"REDACTEDTests/SomeTestCase/testExampleThree" \
> .DerivedData/test-run-1.log 2>&1
Command that triggered an approval prompt immediately after:
xcodebuild -workspace "REDACTED.xcworkspace" \
-scheme "REDACTED (macOS)" \
-destination "platform=macOS" \
-derivedDataPath ".DerivedData" \
build-for-testing test-without-building \
-only-testing:"REDACTEDTests/SomeTestCase/testExampleTwo" \
-only-testing:"REDACTEDTests/SomeTestCase/testExampleThree" \
> .DerivedData/test-run-2.log 2>&1
The approval prompt for the second one displayed the command as being run via:
/bin/zsh -lc 'xcodebuild …'
What is the expected behavior?
Once I select “Yes, and don’t ask again” for running xcodebuild in this workspace/session, Codex should not prompt again for subsequent xcodebuild invocations that are materially the same action.
Specifically, approvals should be robust to equivalent execution forms, including:
- xcodebuild …
- /bin/zsh -lc 'xcodebuild …'
Either:
- Normalize commands so these are treated as the same underlying command for approval purposes, or
- Provide a higher-level persistent approval option such as “Allow xcodebuild in this workspace.”
Additional information
- The issue appears to be caused by literal command prefix matching. The “don’t ask again” rule is tied to the exact prefix shown in the dialog.
- Because Codex sometimes invokes xcodebuild directly and other times via /bin/zsh -lc, the stored approval does not consistently match.
- Requesting the agent to not use "zsh" wrapping does not help: it still insists on doing so much of the time.
- Due to some very strange properties of xcodebuild that I (and GPT) have not been able to resolve which prevent it working correctly from within a shell script, I am not able to create a more focused tool for running tests, etc.
- This is especially disruptive because xcodebuild is used frequently for unit tests and build validation, making the approval dialog a constant interruption.
Environment details:
- Codex extension: 0.4.74 (openai.chatgpt)
- Cursor: 2.4.37 (VSCode 1.105.1)
- codex-cli: 0.84.0
- macOS: 26.2 (25C56), Apple Silicon (Darwin 25.2.0 arm64)
- Model: gpt-5.3-codex medium
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗