`go vet ./...` fails on macOS because `~/Library/Caches` is not allowed to be used in the codex sandbox
Resolved 💬 4 comments Opened Sep 16, 2025 by ZerGo0 Closed Nov 26, 2025
What version of Codex is running?
codex-cli 0.36.0
Which model were you using?
gpt-5-codex
What platform is your computer?
Darwin 25.0.0 arm64 arm
What steps can reproduce the bug?
- Create a simple hello world golang project
- Tell codex to run
go vet ./...
The command should fail and the model sometimes sets the 'GOCACHE` env var to a directory in the current directory or just tells you to run the command yourself.
What is the expected behavior?
The command should run without a problem
What do you see instead?
~/Library/Caches should be on the allowed list on macOS, since Apple recommends that developers use that directory to cache stuff: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html
Additional information
Current fix:.zshrc
# Codex go vet ./... fix
export GOCACHE="/tmp/go-cache"
4 Comments
I actually don't really mind this sandbox limitation. I actually think that it is good that it works like this, but it would be nice if it at least showed some sort of message to the user that the sandbox prevent a command from running because it tried to access a resource outside the sandbox instead of just showing that red dot/the command just failing.
Because in this case it could be a genuine error or just the sandbox preventing it. Codex sometimes just doesn't tell you.
does this work for you? this is found in codex's doc, however it doesn't seem to be working for me... although the purpose of this config looks exactly the same as what we want
Oh I just figured that out. We must set
at the TOP of the config.toml file (I misplaced it above my sandbox_workspace_write section and it didn't work)
now go test works!
Yes that works, but everyone would have to do this when they work with go. I feel like that's not really user friendly, especially because this is pretty similar to /tmp.