sandbox: allow writing xcrun db - #23748
Merged
Merged
Conversation
carlocab
approved these changes
Sep 2, 2026
Contributor
There was a problem hiding this comment.
馃煛 Changes recommended
The regex permits broader writes than intended and lacks regression coverage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Allows sandboxed macOS builds to write xcrun cache database files, preventing compiler failures.
Changes:
- Adds a targeted writable-path regex for temporary
xcrun_dbfiles.
File summaries
| File | Description |
|---|---|
Library/Homebrew/extend/os/mac/sandbox.rb |
Adds the macOS sandbox permission. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Balanced
馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Without permission, clang outputs multiple errors like:
```
clang: error: couldn't create cache file
'/var/folders/*/*/T/xcrun_db-*' (errno=Operation not permitted)
```
Sometimes these are non-impacting, but other times they will fail the
build. One example is building nokogiri gem which fails with
```
gumbo.c:32:10: fatal error: 'nokogiri_gumbo.h' file not found
32 | #include "nokogiri_gumbo.h"
| ^~~~~~~~~~~~~~~~~~
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without permission, clang outputs multiple errors like:
Formula in following PR can reproduce this behavior
deny_network_access!and fetch聽homebrew-core#301831Sometimes these are non-impacting, but other times they will fail the build. One example is building nokogiri gem which fails with
This had been covered by following regex when not using
def fetchbrew/Library/Homebrew/extend/os/mac/sandbox.rb
Line 50 in a8820d0
For now, went with more restrictive regex to avoid unnecessary permissions until someone confirms it is needed.
brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?