Packaging
This page describes how to package your extension.
As the Overview explains,
extensions are packaged as signed ZIP files
with the file extension "crx"—for example,
myextension.crx
.
Note:
You do not need to package your own extension.
If you publish your extension using the
Chrome Developer Dashboard,
then the only reason to create your own .crx
file
would be to distribute a non-public version—for example,
to alpha testers.
You can find information on publishing extensions and apps in the
Chrome Web Store getting started tutorial, starting at
Step 5: Zip up your app.
When you package an extension, the extension is assigned a unique key pair. The extension's ID is based on a hash of the public key. The private key is used to sign each version of the extension and must be secured from public access. Be careful not to include your private key within your extensions!
Creating a package
To package an extension:
-
Bring up the Extensions management page
by going to this URL:
chrome://extensions
- Ensure that the "Developer mode" checkbox in the top right-hand corner is checked.
- Click the Pack extension button. A dialog appears.
-
In the Extension root directory field,
specify the path to the extension's folder—for example,
C:\myext
. (Ignore the other field; you don't specify a private key file the first time you package a particular extension.) -
Click Package.
The packager creates two files:
a
.crx
file, which is the actual extension that can be installed, and a.pem
file, which contains the private key.
Do not lose the private key!
Keep the .pem
file secret and in a safe place.
You'll need it later if you want to do any of the following:
If the extension is successfully packaged, you'll see a dialog like this
that tells you where to find
the .crx
and .pem
files:
Updating a package
To create an updated version of your extension:
-
Increase the version number in
manifest.json
. - Bring up the Extensions management page by going to this URL: chrome://extensions
- Click the Pack extension button. A dialog appears.
-
In the Extension root directory field,
specify the path to the extension's folder—for example,
C:\myext
. -
In the Private key file field,
specify the location of the
already generated
.pem
file for this extension—for example,C:\myext.pem
. - Click OK.
If the updated extension is successfully packaged, you'll see a dialog like this:
Uploading a previously packaged extension to the Chrome Web Store
You can use the Chrome Developer Dashboard to upload an extension that you've previously packaged yourself. However, unless you take special steps, the extension's ID in the Chrome Web Store will be different from its ID in the package you created. This different ID might be a problem if you've distributed your extension package, because it allows users to install multiple versions of your extension, each with its own local data.
If you want to keep the extension ID the same, follow these steps:
- Rename the private key that was generated
when you created the
.crx
file tokey.pem
. - Put
key.pem
in the top directory of your extension. - Compress that directory into a ZIP file.
- Upload the ZIP file using the Chrome Developer Dashboard.
Packaging at the command line
Another way to package extensions
is by invoking chrome.exe
at the command line.
Use the --pack-extension
flag
to specify the location of the extension's folder.
Use --pack-extension-key
to specify the location of the extension's private key file.
For example:
chrome.exe --pack-extension=C:\myext --pack-extension-key=C:\myext.pem
Package format and scripts
For more information on the format, as well as pointers to scripts you can use
to create .crx
files, see CRX Package Format.