Run on Safari
A Safari dev session runs on the same local bridge as every other browser, so an agent can build, open, reload and read your extension there. Reach for it when you develop on macOS with Xcode and want the Safari build checked while you edit.
Quick start
With a project open, ask the agent:
Run my extension in SafariThe agent calls extension_dev with browser: "safari". The build converts your extension into a macOS app, signs it with xcodebuild, and opens it. Turn the extension on once in Safari > Settings > Extensions. From then on every save reloads it, and its background and content lines land in the session log.
To let the agent read pages too, run safaridriver --enable once and turn on Safari > Settings > Developer > "Allow remote automation" (Safari > Develop > Allow Remote Automation on older Safari).
How it works
The session needs Extension.js 4.1.21 or newer in the project. On 4.1.33 or newer the run opens the app in the background, leaves your own Safari alone, and quits only that app on stop.
The control channel is on by default, so the bridge tools work as soon as the extension is enabled: extension_storage, extension_reload, extension_open for surfaces, extension_dom_snapshot by tab id, extension_logs, and the assertions.
Safari has no CDP or RDP, and its MV3 background CSP blocks eval. So extension_eval in background fails, and extension_inspect has no Safari path. Read the background through its log lines instead.
Pages ride a safaridriver automation session. On Extension.js 4.1.32 or newer, with remote automation on, the dev session opens one and records webdriverPort and webdriverSessionId in ready.json. extension_open with url and extension_eval with context: "page" use it. extension_doctor reports it as the safari-window check.
Without that session, extension_open with url rides the bridge's navigate verb (Extension.js 4.1.29 or newer), and extension_eval in content or page needs a tab already open at the url.
Apple ships its own MCP server as safaridriver --mcp (Safari 27, or Safari Technology Preview 247 and later). It reads pages in an isolated automation window, has no extension-aware tool, and runs beside a dev session. extension_browsers reports whether your safaridriver has --mcp.
App Store screenshots
App Store Connect does not take a Mac app for review without 1 to 10 macOS screenshots at 1280x800, 1440x900, 2560x1600 or 2880x1800, PNG with no alpha, and more than half must show the app in use. The rule is App Review guideline 2.3.3 and the sizes are Apple's screenshot specifications.
With the Safari dev session running and a page open in its automation window, capture each view:
extension_screenshot store:"safari"The call resizes the automation window to 1440x900 through WebDriver and captures it at 2x, a 2880x1800 image, written to store/screenshots/safari/01.png, 02.png and so on, one call per view. Safari lets the driver capture only web pages in that window, so the popup and the extension's own pages cannot be captured there. width, height or deviceScaleFactor beside store are refused.
Then push the set:
extension_submit action:"sync-listing" browsers:["safari"]With no screenshots argument it reads that folder in filename order and refuses before any approval when a file is off those sizes or there are more than 10. A safari file captured on a Chromium session carries the warning "The safari file was captured on chrome, not Safari: Apple's review wants the extension running in Safari, so capture it again with store:"safari" on a Safari dev session (extension_dev browser:"safari") before the listing push." store:"all" on Safari writes only the safari file and warns. The public page then shows the set under "In Safari" on the Safari build page.
Reference
| Tool | On Safari | Extension.js |
|---|---|---|
extension_dev with browser: "safari" | Builds the app, opens it, reloads on every save, streams background and content logs | 4.1.21 or newer |
extension_logs | Works once the extension is enabled | 4.1.21 or newer |
extension_storage, extension_reload | Work over the bridge | 4.1.21 or newer |
extension_open with surface | Opens the extension's surfaces; the devtools surface is refused | 4.1.21 or newer |
extension_dom_snapshot | Works by tab id | 4.1.21 or newer |
extension_assert | content-script-injected, background-worker-booted, storage-key-present and console-errors-empty work; surface-rendered reads through the relay and can pass or fail | 4.1.21 or newer |
extension_open with url | Over the safaridriver session; without one, over the bridge's navigate verb | 4.1.32 (safaridriver), 4.1.29 (navigate) |
extension_eval with context: "page" | Over the safaridriver session; without one, the tab must already be open at the url | 4.1.32 or newer |
extension_screenshot with store: "safari" | Resizes the automation window over the safaridriver session and captures the web page in it as a 2880x1800 App Store screenshot; popup and extension pages cannot be captured | 4.1.32 or newer |
extension_eval with context: "content" | Needs a tab already open at the url | 4.1.21 or newer |
extension_eval with context: "background" | Fails: Safari's MV3 background CSP blocks eval | none |
extension_inspect | No Safari path: Safari has no CDP or RDP | none |
extension_doctor | Adds the safari-window check: pass, fail when the window is gone, skip with the engine's reason when none was opened | 4.1.32 or newer |
extension_start | Not supported: the framework's start and preview commands refuse Safari targets | none |
When it fails
extension_logsanswersE_LOGS_MISSING: the extension is not enabled yet, or the project runs an engine older than 4.1.21. Turn it on in Safari > Settings > Extensions, check the project'sextensionversion, then read again.extension_doctorshowssafari-windowasskip: the dev session opened no safaridriver session, and the detail carries the engine's reason. Runsafaridriver --enable, turn on remote automation, then restartextension_dev. Page eval and open by url fall back to the bridge until then.safari-windowisfail: the automation window or the driver is gone. Stop and restartextension_devwithbrowser: "safari".extension_evalinbackgroundfails: Safari's CSP blocks it. Have the background write one line on start and assertbackground-worker-booted, or readextension_logs.- The extension is enabled but a content script does nothing: Safari grants website access separately from the enable switch. Allow the site under Permissions in the same Extensions panel.
extension_startrefuses the Safari target: the framework does not runstartorpreviewfor Safari. Useextension_devfor the loop andextension_buildfor the app.extension_submitpreflight listsScreenshots for safari: the App Store set is missing. The hint readsScreenshots for safari: extension_screenshot store:"safari" on a Safari dev session, one call per view, then sync-listing browsers:["safari"] picks them up from store/screenshots/safari/.and is thenextStepwhen nothing else fails.- A safari screenshot warns it was captured on chrome, not Safari: it came from a Chromium session. Start
extension_devwithbrowser: "safari"and capture it again withstore: "safari"before the listing push.
Next
- Safari guide on extension.js.org: requirements, signing and the enable step
extension_dev,extension_doctorandextension_browsersextension_screenshotandextension_submit: the App Store screenshot set and the listing push- MCP server: install and the session gates
- Publishing when the build is ready for the stores