skip to Main Content

I’m developing a Safari Web Extension for Mac using Xcode, and I’m encountering a frustrating issue that I can’t seem to resolve.

The Problem:

When I archive and export my app and install it, the extension works flawlessly in Safari—no errors, and all resources load correctly. However, when I run the app directly from Xcode (for development and debugging), Safari shows the following error in the extension preferences:

  • "Unable to find ‘popup.html’ in the extension’s resources."

Sometimes it also shows:

  • "Unable to find ‘background.js’ in the extension’s resources."

Additionally, the extension doesn’t appear in Safari’s Extensions list when running from Xcode, even though the app launches.

This used to work and then it just stopped working randomly when I exported a copy of the app by archiving and opened that app to test it. After that I was not able to get it to work by running from Xcode.

What I’ve Tried So Far:

  • Checked File Inclusion:
    • Verified that popup.html and all other resource files are included in the extension target and are present in the Copy Bundle Resources phase.
    • Confirmed that the files are physically present in the extension bundle under Contents/Resources/.
  • Validated manifest.json**:**
    • Ensured that the paths to popup.html and other resources are correct.
    • Verified that there are no syntax errors.
  • Cleaned Build Artifacts:
    • Performed Clean Build Folder in Xcode.
    • Deleted Derived Data.
    • Restarted Xcode and rebuilt the project.
  • Uninstalled Previous Versions:
    • Removed all instances of the app and extension from /Applications, ~/Applications, and ~/Library/Safari/Extensions/.
    • Cleared Safari caches and preferences related to extensions.
    • Restarted my Mac to ensure all processes are reset.
  • Code Signing and Entitlements:
    • Checked that both the app and extension are properly code-signed with automatic signing enabled.
    • Verified that necessary entitlements are present.
  • Bundle Identifiers and Versions:
    • Confirmed that the bundle identifiers for the app and extension are correct.
    • Incremented the build number.
  • Build Configurations:
    • Tried running the app with both Debug and Release configurations.
    • Adjusted the scheme to ensure the build configuration matches.
  • Tested Moving the App to /Applications**:**
    • Built the app and manually moved it to /Applications.
    • Launched it from there, but the extension still doesn’t appear in Safari when running from Xcode.

Additional Observations:

  • The issue seems to occur only when running the app from Xcode. The archived/exported app works without any issues.
  • Safari might be expecting the extension to be in a specific location or have certain properties when the app is run from Xcode.
  • No errors related to popup.html are found when inspecting the built app and extension; the files are present and paths are correct.

Questions:

  • Has anyone experienced similar issues with Safari Web Extensions not loading properly when running the host app from Xcode?
  • Are there specific steps or configurations required to ensure Safari recognizes and loads the extension during development?
  • Could this be related to code signing, entitlements, or macOS security settings when running from Xcode?

Environment:

  • macOS Version: macOS Sequoia 15.2
  • Xcode Version: Xcode 16.1
  • Safari Version: Safari 18.2
  • Development Setup:
    • Safari Web Extension with a macOS host app
    • Using Swift and JavaScript for development

Any insights or suggestions would be greatly appreciated!

Thanks in advance for your help!

2

Answers


  1. You can try with a lower version of Xcode, sometimes it happens in very recent versions that it generates some strange errors. You can download it and try if that solves the problem 🙂

    Login or Signup to reply.
  2. I’m seeing the same thing with Safari 18.1.1, Xcode 16.2 (16C5032a), macOS 15.1.1 (24B91). Duplicating the Xcode project folder and running from that new copy will help to get the latest build running within the extension preference pane. I’m still trying to figure out this new issue that started happening today with all the "unable to find" errors.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search