SystemExtension activation status without popup

I have a system extension, it's not meant to be activated by user, i.e. this should be done by MDM. I'd like to verify if the extension is already active, but don't want to cause system popup because this is an error condition, i.e. something went wrong with MDM and we really don't want to confuse users with weird system popups coming out of nowhere. In short - not active, fine, give me an error, but please don't pop. Is there way to do this? Kind of what systemextensionsctl list command does.

Accepted Reply

You could, but it has a few drawbacks:

  • The tool is not designed to be used as an API. Note the lack of a --xml or --json flag. The output format could change at any time in a way that breaks your parser.

  • It’ll only tell you whether the system thinks that the sysex is working, not whether the sysex is actually working.


Oh, one other thing: Have you seen the new-in-macOS 12 propertiesRequest(forExtensionWithIdentifier:queue:) method?

Share and Enjoy

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

  • (instancetype)propertiesRequestForExtension:(NSString *)identifier queue:(dispatch_queue_t)queue; Looks very promising. I'll check it out!
  • I had not, and agree it looks very promising. Will have to share with the rest of the team. Thanks, Quinn.

Add a Comment

Replies

I'd like to verify if the extension is already active

I’d do this by having your app talk to the sysex via XPC. If that works, you know that the sysex is installed and fully functional. If not, you have a problem.

Share and Enjoy

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

  • If it responds over XPC it's definitely activated, we are good on this part. I'm not sure though that an activated extension is always running, for whatever reason. Can we assume that even if it's not running (there is no process) macOS will always start it up for me just because I issued an XPC request over its Mach service?

Add a Comment

Couldn't you just run systemextensionsctl list | grep <your extension name> in an NSTask and parse the output, if any?

You could, but it has a few drawbacks:

  • The tool is not designed to be used as an API. Note the lack of a --xml or --json flag. The output format could change at any time in a way that breaks your parser.

  • It’ll only tell you whether the system thinks that the sysex is working, not whether the sysex is actually working.


Oh, one other thing: Have you seen the new-in-macOS 12 propertiesRequest(forExtensionWithIdentifier:queue:) method?

Share and Enjoy

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

  • (instancetype)propertiesRequestForExtension:(NSString *)identifier queue:(dispatch_queue_t)queue; Looks very promising. I'll check it out!
  • I had not, and agree it looks very promising. Will have to share with the rest of the team. Thanks, Quinn.

Add a Comment