Instead of going to Extension Builder > Build Package…, I'd like to built a .safariextz
package from the MyExtension.safariextension
folder.
I know I can unpack an extension with xar -xf
. I suspect the way back involves packing it with xar
, but then I'll need to do the code signing thing, which may or may not involve codesign(1).
Here are Omar Ismail's instructions, omitting the need for separate shell scripts. This will all occur in a directory
safari/
, where we will be signing the directorysafari/appname.safariextension/
to become the extensionsafari/appname.safariextz
. The first thing is to sign the extension the official way, with Extension Builder'sBuild Package
.Set up Xar:
1. Download and unzip/untar https://github.com/downloads/mackyle/xar/xar-1.6.1.tar.gz to wherever you want the executable xar-1.6.1 (xar 1.6dev doesn't support the options we need)
2. in xar-1.6.1/
Set up your certificates:
1. in safari/
2. open Keychain Access and export your Safari Developer certificate to safari/certs/certs.p12 (use a blank password for certs.p12, and then use your Mac's password to export the cert)
3. in safari/certs/
It's possible that you can get the certificates from
certs/cert.p12
, and not need the--extract-certs
step (and hence not need the extension built the official way), but I don't know openssl well enough, and it's only for the set up that you need that step anyway.Once everything is set up, to sign the extension:
In safari/
This was all on a 2006 Snow Leopard MacBook, so it's possible things may be different on a machine that's more up to date.
Looks like there is a way to patch XAR with a signature option. http://code.google.com/p/xar/issues/detail?id=76#c0