I asked this on Twitter the other day, but alas nobody came back with an answer.

Turns out it’s pretty easy to edit a Safari extension that you’ve downloaded. The downloaded file will have a .safariextz file extension. To extract the contents of the file, use the xar command. I’ll demonstrate with the BetterSource extension.

jerod@mbp:~/Downloads$ xar -xf BetterSource-1.0.safariextz

This will create a new directory called BetterSource-1.0.safariextension which has the plugin’s source files (plists, html, js, css, etc.). You can add this to Safari’s Extension Builder by:

  1. Selecting Develop -> Extension Builder from Safari's menu bar
  2. Clicking the + button in the lower-left corner of the editor window
  3. Pointing the open dialog box to the BetterSource-1.0.safariextension directory

And that’s all there is to it.