Opening the Extension menu in the System Preferences

Hi there,

I have two extension in my App, a Finder Sync and a Share Extension. Because these are disabled by default and automatically enabling them is, according to my extensive research, not possible, I want to provide an easy way for the user to enable the extensions when the app is opened. I am currently displaying a popup, with a button to open the preferences. I have struggled with this a bit, by now I managed to open the main preferences window using

NSWorkspace.shared.open(URL(string: "x-apple.systempreferences:com.apple.preference")!)

which is rather suboptimal though, since the user has to select the extensions option manually and isn't directly redirected there.

What I have also found is that the menu of the FinderSyncExtension can be opened directly by using FIFinderSyncController.showExtensionManagementInterface() which is unfortunately suboptimal as well, because it only shows the managment interface of the finder extension and not the overview of all extensions.

Is there any way to either enable the extensions programatically, or if not, is there a way to show the "Added Extensions" portion of the Extensions menu in the system preferences?

Answered by Elia314 in 731596022

After searching through some old forum-posts where this problem is also described, I do not think it is possible. If you have multiple extensions you only have two options:

1 - Simply open the preferences (it is not possible to open the Extensions part of the preferences, for some reason) using the following code:

NSWorkspace.shared.open(URL(string: "x-apple.systempreferences:com.apple.preference")!)

You should display some instructions for the user, telling them where and how to enable your extensions (which is what I resulted to)

2- Result to opening only the config of the Finder Sync Extension using:

 FIFinderSyncController.showExtensionManagementInterface()

This is suboptimal though, because the user might only enable one of your extensions.

I really hope that some implementation of opening the extension preferences will be added soon, or that some of the older extension (e.g. Share Extension, in my case) get updated to also include a Controller similar to the FIFinderSyncController of the Finder Sync extension.

Accepted Answer

After searching through some old forum-posts where this problem is also described, I do not think it is possible. If you have multiple extensions you only have two options:

1 - Simply open the preferences (it is not possible to open the Extensions part of the preferences, for some reason) using the following code:

NSWorkspace.shared.open(URL(string: "x-apple.systempreferences:com.apple.preference")!)

You should display some instructions for the user, telling them where and how to enable your extensions (which is what I resulted to)

2- Result to opening only the config of the Finder Sync Extension using:

 FIFinderSyncController.showExtensionManagementInterface()

This is suboptimal though, because the user might only enable one of your extensions.

I really hope that some implementation of opening the extension preferences will be added soon, or that some of the older extension (e.g. Share Extension, in my case) get updated to also include a Controller similar to the FIFinderSyncController of the Finder Sync extension.

After some more research, I found that it is actually possible to achieve something like this. Opening the file under /System/Library/PreferencePanes/Extensions.prefPane will open the Extensions Pane at the uppermost level. A way to do this is using the NSWorkspace:

let prefpaneUrl = URL(fileURLWithPath: "/System/Library/PreferencePanes/Extensions.prefPane")
NSWorkspace.shared.open(prefpaneUrl)

Actually there are a quite a bunch of more specific URLs, although undocumented. You can find a list of the ones discovered so far here. You want to use

NSWorkspace.shared.open(URL(string: "x-apple.systempreferences:com.apple.preferences.extensions")!)
// or
NSWorkspace.shared.open(URL(string: "x-apple.systempreferences:com.apple.preferences.extensions?Share")!)

Unfortunately there is no URL publicly known that goes to the page required for finder sync extensions, although Keka has a button to open that page.

In general, URL schemes are not considered API unless explicitly documented. See this post for more of the backstory.

although undocumented

Interestingly [1], the x-apple.systempreferences URL scheme is documented, although obscurely. Check out the info in <EndpointSecurity/ESClient.h>.

Share and Enjoy

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

[1] And this was very surprising to me, to the point that I checked internally as to whether it was a mistake or not; it’s definitely kosher.

Quinn's should be the accepted answer (sorry, this should've been a comment on that—I clicked the wrong button and don't see how to fix it).

@eskimo Quinn, Any chance you could push to get the x-apple.systempreferences URL scheme properly documented? It seems like something that user-friendly apps need to be able to do, and people are doing it anyway, so it would be great to have it documented explicitly as stable API somewhere outside of a header file (which only gives two specific examples for Full Disk Access, which is not the location desired here). I understand that things tend to move around in System Settings, but it seems like some needs to commit to supporting a scheme or other API that will allow apps to direct people to where they need to go.

Any chance you could push to get the x-apple.systempreferences URL scheme properly documented?

The best first step here is for you to file a bug against the docs. Please post your bug number, just for the record.

Share and Enjoy

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

Thanks!!!I found it is useful for my app!!!

FIFinderSyncController.showExtensionManagementInterface()

This API is really difficult to find. I searched through the relevant API documentation and finally discovered this API from you!

Opening the Extension menu in the System Preferences
 
 
Q