Building a Safari extension - but Safari doesn't see it

I'm trying to build a (personal) Safari extension, which should add an HTTP header when visiting a few websites. I'm a newbie at XCode.

Using XCode, the build runs and the app runs correctly (the standard boilerplate code tells me that the extension is currently off).

However, the extension doesn't appear in Safari>Settings>Extensions at all, so I cannot enable the extension.

There are two warnings (warnings? or errors? fatal? or not?):

NSBundle file:///System/Library/PrivateFrameworks/MetalTools.framework/ principal class is nil because all fallbacks have failed
Unable to create bundle at URL ((null)): normalized URL null

...I'm brand new to XCode so I don't really know whether these errors are fatal, and how to fix them if so.

These warnings appear when the app runs, not during the build cycle.

The plugin appears when issuing this command in Terminal:

pluginkit -mAvvv -p com.apple.Safari.web-extension

...part of that response is:

     podnewsllc.Podnews-Security.Extension(1.0)
	            Path = /Users/jamescridland/Library/(snip)MyApp.appex
	            UUID = EA41(snip)3519
	       Timestamp = 2024-10-06 03:54:37 +0000
	             SDK = com.apple.Safari.web-extension
	   Parent Bundle = /Users/jamescridland/Library/(snip)MyApp.app
	    Display Name = MyAppName Extension
	      Short Name = MyAppName Extension
	     Parent Name = MyAppName
	        Platform = macOS

...so it's visible to Safari, but it doesn't appear in Safari>Settings>Extensions.

The codesign command says:

--prepared:/Users/jamescridland/(snip)__preview.dylib
--validated:/Users/jamescridland/(snip)__preview.dylib
--prepared:/Users/jamescridland/(snip).debug.dylib
--validated:/Users/jamescridland/(snip).debug.dylib
/Users/jamescridland/(snip).appex: valid on disk
/Users/jamescridland/(snip).appex: satisfies its Designated Requirement

... so I think it's signed correctly.

Checking "Allow unsigned extensions" does not appear to change anything.

I've tried running a rebuild of LaunchServices, but that hasn't fixed it.

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

My questions are:

  1. Is there a log to help me know what is going wrong?
  2. Does anyone have any idea why I can't see the extension in Safari?
  3. What next?

Sorry for the dumb question.

Safari Web Extensions can only be distributed via the AppStore or ran locally to test. If you want to package an extension to run outside of the AppStore you will need to use a Safari App Extension.

You can see more information here.

Rico

WWDR - DTS - Software Engineer

Building a Safari extension - but Safari doesn't see it
 
 
Q