View/modify Safari extension source code

Guides | Tutorial By 3 years ago

If you want to see how a Safari extension is working, or even change its functionality, it’s quite easy.

First, locate the extension. It should be living in your library folder. Note this is a hidden folder so in the finder use Command-Shift-G to put in this location.

~/Library/Safari/Extensions

Here you’ll see the Safari extensions you have installed. They have a .safariext file extension, but this is really just a xar file.

To extract the extension’s files, use this command

xar -xf /path/to/extension.safariextz

The extension will be extracted into a folder, with the source and resources contained within.

If you want to change something and then package it back up for reinstallation, you can xar the folder back into a single file.

xar -c -f output.safariextz extensionFolder
  • Nice! TY for sharing this 🙂

  • Ranganadh Paramkusam

    Thanks Tom!