If you install a Safari Extension, are you able to see its source code? It is great to verify that the extension does not contain malware.

One can do it with Chrome as described in this blog

  • Please read: apple.stackexchange.com/help/self-answer – Solar Mike Aug 8 '20 at 7:46
  • @anki I haven't answered my question. Please read carefully. I'm asking about Safari, my example refers to Chrome. – adamsfamily Aug 8 '20 at 13:41
  • 1
    Since safari 13, all extensions are like apps with .appex files which are used as extensions. So if you can view source code of any other app (executable) you can see code for those apps too. For extensions released as safariextz files, see georgegarside.com/blog/macos/… – anki Aug 8 '20 at 14:59

Source of information:

  1. 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.

  2. To extract the extension’s files, use this command (replacing the '/path/to' with the correct path and the 'extension.safariextz' with the correct name) xar -xf /path/to/extension.safariextz The extension will be extracted into a folder, with the source and resources contained within.

  3. If you want to change something and then package it back up for reinstallation, you can xar the folder back into a single file using xar -c -f output.safariextz extensionFolder.

I'm running 10.15.6 and these steps worked for me.

Since Safari 13, all extensions must be downloaded from the App Store as .app bundles with .appex files inside them. Both of them are built in Xcode thus you only get the final executable. So if the extension is not open source, you cannot see what's in the binary

A simple way to understand how the app and extension interact, see the following. (Note that it's an Xcode extension, not Safari. )

  • 2
    This doesn't list extensions which come in .app bundles from the App Store like grammaly, or adguard. I only see the legacy extensions there. – anki Aug 8 '20 at 18:15
  • It might not but that was not part of OP's question so I didn't address it. Feel free to edit my answer to add the missing info. – fsb Aug 8 '20 at 18:16
  • I confirm that ~/Library/Safari/Extensions seems to contain only a small subset of the extensions. Two examples of well known extensions not being present there: Night Eye, AdBlock. – adamsfamily Aug 10 '20 at 6:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .