Safari App Extension – conflicting Bundle Identifier

Sometimes the Safari App Extension i'm developing does not show up in my Safari Extensions unless i change mu bundle identifier to some unique name.

Even if I delete all other apps i've built with the same (and different) bundle ID, the extension is still does not show up.

The only solution for me is to always change the bundle ID. For example: Now it is "kopyl.tab-finder-10" If i change it to "kopyl.tab-finder-11", the extension does show up in the Safari extensions settings page again.

Is there any other way to fix it?

Just found out a way to reproduce it.

  1. Build an extension (you can use mine: https://github.com/kopyl/safari-tab-switcher)
  2. Make sure the extension is in the Safari Extensions settings page
  3. Archive the extension in Xcode (don't open, just archive)
  4. Now the extension is gone from Safari Extensions settings page

Now if you remove the archived app in the Finder, the extension appears in the Safari Extensions settings page. But it does not work.

After this if you try to restart Safari, then it crashes unless you hold down the option key. And if you try to open the extensions page, the Safari crashes unless you reboot your computer 🤡

So the question is how am I supposed to build Safari Extensions?

I just recorded a video showcasing this bug, if you will https://youtu.be/abpf3q6ah98

Launch Services gets confused. See my blog post, especially the appendix about Safari extensions: https://lapcatsoftware.com/articles/2024/12/2.html

It's really best to use a different bundle identifier during development. I append ".debug" to mine.

@jeffjohnson

You said that this bug was "fixed in macOS 13 Ventura", but i'm currently on macOS Ventura now and experience this bug.

The thing is that i have this bug even if there is only one app is located on the system.

And when at some point the amount of apps with the same bundle id gets to 2 or bigger, macOS just makes the extension disappear instead of giving any preference to any of the apps. I attached a video in the comments showcasing the bug: https://youtu.be/abpf3q6ah98

You said that this bug was "fixed in macOS 13 Ventura", but i'm currently on macOS Ventura now and experience this bug.

No, that's not what I said. I said, "One notorious bug was the case of the disappearing Safari extensions, introduced in macOS 11 Big Sur and finally fixed in macOS 13 Ventura. In this blog post, I'll discuss a current bug [emphasis added] involving multiple versions of the same app installed on one Mac."

@jeffjohnson ah, sorry, my bad.

So what's your best recommendation to this problem? Appending something to a bundle identifier?

Not sure that this is the best solution because my bundle identifiers are present in multiple places and in multiple files:

  • In Info.plist: CFBundleIdentifier
  • In ... .xcodeproj/project.pbxpro: PRODUCT_BUNDLE_IDENTIFIER (Extension)
  • In ... .xcodeproj/project.pbxpro: PRODUCT_BUNDLE_IDENTIFIER (Main app)

I just set a user-defined variable and use it everywhere, but i don't think it's the best solution so far. Do you?

You said in the article that you might unregister the app. Can this be a fix to my problem?

I would use Generate Info.plist File in your build settings. And you can build-configuration-specific values for Product Bundle Identifier.

Unregistering the app is a temporary solution, but the problem will likely recur.

I'm experiencing this now on Mac Sonoma 14.7.2/Safari 18.2. I have not changed code for a while, but my problems started when a clean and build removed the extension from Safari settings a couple of weeks ago. After going through a long process to get it to appear there again, the same thing happened again. I restored a previous version of the project that was deployed in App Store a month ago and built and ran it, and it wouldn't show up in Safari settings either. A solution for years when there was inconsistency was to do a clean and then build - now that breaks everything. Anybody have any ideas?

Safari App Extension – conflicting Bundle Identifier
 
 
Q