# macOS: Enumerate GPUs first; prefer low-power non-removable; fall back to system default \(\#38164\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/bb514c158e1604916b32fc8c9bbe602a78727742)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: bb514c158e1604916b32fc8c9bbe602a78727742

Requested commit: bb514c158e1604916b32fc8c9bbe602a78727742

Commit: bb514c158e1604916b32fc8c9bbe602a78727742

Tree: 9fdfe9892c84f0e2dad31378045bcd6810b21c00

Author: cacaosteve

Committer: GitHub

## Message

```
macOS: Enumerate GPUs first; prefer low-power non-removable; fall back to system default (#38164)

Problem: Some macOS environments report no devices via
MTLCopyAllDevices, causing startup failure with “unable to access a
compatible graphics device,” especially on Apple Silicon.
Change: Prefer MTLCreateSystemDefaultDevice
(metal::Device::system_default()) first. If None, enumerate devices and
select a non‑removable, low‑power device by preference.
Why this works: On Apple Silicon the system default is the unified GPU;
on Intel, the fallback keeps a stable policy and avoids accidentally
picking removable/high‑power devices.
Impact: Fixes startup on affected ASi systems; improves selection
consistency on Intel multi‑GPU. Behavior unchanged where
system_default() succeeds.
Risk: Low. Aligns with Apple’s recommended selection path. Still fails
early with a clearer message if no Metal devices exist.

Closes #37689.

Release Notes:
- Fixed: Startup failure on some Apple Silicon machines when Metal
device enumeration returned no devices by falling back to the system
default device.

---------

Co-authored-by: 张小白 <364772080@qq.com>
Co-authored-by: Kate <work@localcc.cc>
```

## Parents

- [550442e10000c63de1f083c3f7f1aab0ab41ed8e](https://git.cafe/gitcafe/zed/commit/550442e10000c63de1f083c3f7f1aab0ab41ed8e?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/bb514c158e1604916b32fc8c9bbe602a78727742?format=markdown)
