Xcode logging: "Metal API Validation Enabled"

Toggle Metal API Validation via your Xcode Scheme:

Scheme > Edit Scheme... > Run > Diagnostics > Metal API Validation.

It's a checkbox, so the possible options are Enabled or Disabled.

Disabling sets the key enableGPUValidationMode = 1 in your .xcscheme file.

After disabling, Xcode no longer logs the "Metal API Validation Enabled" log message.

Note: In Xcode 11 and below, the option appears in the "Options" tab of the Scheme Editor (instead of the "Diagnostics" tab).


I had the exact same message.

I had a .onDelete(perform: deleteLocations) at the end of a scrollview closure.

I changed the scrollview to a list and the message went away.


How to disable the message:

Select your scheme at the top of the window. Click Edit Scheme in the drop-down, go to Diagnostics and untick the Metal API Validation checkbox.

Is Metal being used in my app?

Yes, even if your code isn't interacting directly with the GPU, many high-level frameworks do -- specifically Core Image, SpriteKit, and SceneKit. For example, I narrowed the pesky "Metal API Validation Enabled" message in my app down to this line:

layer.backgroundColor = NSColor(patternImage: image).cgColor

Should I disable Metal API validation?

Enabling validation makes every Metal API call be checked, which causes a "small, but measurable, impact on CPU performance." The purpose of this validation is to

check for code that calls the Metal API incorrectly, including errors in resource creation, encoding Metal commands, and other common tasks.

There's a very low chance that Apple frameworks like Core Image are using the Metal API incorrectly, so if your app only uses those high-level Apple frameworks, then I'd say you should feel safe to disable API validation. Getting rid of that damn output message is worth the risk.