Agent Wranglers

DSK-38Recommended

Ship the Safari version inside a signed Apple app

Build the Safari version of a web extension from the same source as the Chrome and Firefox versions. Wrap it in a Mac or iOS app made with Apple's packager. Test it in Safari on each release, and sign and submit it like any other app.

How to do it

Safari web extensions run only inside a containing app, so there is no separate extension file to upload. Apple's xcrun safari-web-extension-packager, formerly named safari-web-extension-converter, makes an Xcode project from the extension folder. It warns about manifest keys it thinks Safari does not support, so read each warning and test the feature. Keep one manifest and add the Safari wrapper in the build, so the three versions never drift apart. Safari asks the user to allow the extension per website, so test the flow where the user has not yet allowed it. The containing app is signed and notarised as sign and notarise every Mac build says, or goes through App Store review.

Examples

Shell example

xcrun safari-web-extension-packager dist/extension \
  --project-location build/safari --app-name "Ledgerly Clipper" \
  --bundle-identifier com.example.ledgerly.clipper --no-open

How to check

CI runs the packager and builds the Safari app on every release. An end-to-end test runs the extension's main flow in Safari on that build. The Safari build's extension version equals the Chrome build's version.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/desktop-apps/browser-extensions/safari-extension-packaging">Agent Wranglers desktop apps and extensions playbook</a>. In code you write, add a comment next to it with the same link.