MPS under codex sandbox is not working
What version of Codex is running?
0.92.0
What subscription do you have?
Pro
Which model were you using?
gpt-5.2-codex
What platform is your computer?
Darwin 25.2.0 arm64 arm
What terminal emulator and version are you using (if applicable)?
iTerm2 3.6.6
What issue are you seeing?
Hi Codex team,
In a Codex session on macOS 26.2 (Apple M3), PyTorch MPS reports unavailable and MPS tensor creation fails, even though the system
supports Metal and macOS version is detected correctly.
System:
- macOS 26.2 (Build 25C56), Apple M3, Metal supported
- Python: 3.12.11 (arm64) in .venv
- torch: 2.11.0.dev20260129 (also tested 2.10.0)
- torch.backends.mps.is_macos_or_newer(14,0) => True
- torch.backends.mps.is_built() => True
- torch.backends.mps.is_available() => False
Repro:
source .venv/bin/activate
python - <<'PY'
import os, sys, platform, torch
print('python', sys.version)
print('executable', sys.executable)
print('platform', platform.platform())
print('machine', platform.machine())
print('torch', torch.__version__)
print('torch_file', torch.__file__)
print('mps_built', torch.backends.mps.is_built())
print('mps_available', torch.backends.mps.is_available())
print('PYTORCH_MPS_DISABLE', os.getenv('PYTORCH_MPS_DISABLE'))
print('PYTORCH_ENABLE_MPS_FALLBACK', os.getenv('PYTORCH_ENABLE_MPS_FALLBACK'))
try:
x = torch.ones(3, device='mps')
print('mps tensor ok', x.device)
except Exception as e:
print('mps tensor error', type(e).__name__, e)
PY
Output:
- mps_available False
- torch.ones(device="mps") raises:
RuntimeError: The MPS backend is supported on MacOS 14.0+...
Also verified:
- sw_vers => macOS 26.2
- system_profiler SPDisplaysDataType => Metal supported
Tried:
- Reinstalling torch (pip/uv nightly)
- Fresh venvs, conda envs
- MPS still unavailable
This suggests MPS backend init is failing despite OS detection being correct, possibly related to macOS 26.2 or the environment Codex
is using. Please advise.
Thanks!
What steps can reproduce the bug?
source .venv/bin/activate
python - <<'PY'
import os, sys, platform, torch
print('python', sys.version)
print('executable', sys.executable)
print('platform', platform.platform())
print('machine', platform.machine())
print('torch', torch.__version__)
print('torch_file', torch.__file__)
print('mps_built', torch.backends.mps.is_built())
print('mps_available', torch.backends.mps.is_available())
print('PYTORCH_MPS_DISABLE', os.getenv('PYTORCH_MPS_DISABLE'))
print('PYTORCH_ENABLE_MPS_FALLBACK', os.getenv('PYTORCH_ENABLE_MPS_FALLBACK'))
try:
x = torch.ones(3, device='mps')
print('mps tensor ok', x.device)
except Exception as e:
print('mps tensor error', type(e).__name__, e)
What is the expected behavior?
mps:0 for the device
Additional information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗