What does OSErr -13066 mean?

While debugging my app in Xcode, my app calls SetFrontProcess which is returning an OSErr of -13066.

What does -13066 mean?

Possibly means "SetFrontProcess was deprecated in 10.9, why are you still using it?" But I thought I'd check.

I don't know what that error means, but I'm pretty sure that it's not just that the function is deprecated. I'm still successfully using SetFrontProcessWithOptions in conjunction with GetProcessForPID on Sonoma.

I did some digging internally and error -13066 is effectively a permission error. You can get it in two cases:

  • If the target process is a background-only process.

  • If the system has denied the switch.

I suspect you’re hitting the second one. There’s detailed info about this change in the App Activation section of the AppKit Release Notes for macOS 14 (it doesn’t cover SetFrontProcess because that API is deprecated).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

What does OSErr -13066 mean?
 
 
Q