packaging.html revision 8ae428e0fb7feea16d79853f29447469a93bedff
1<div id="pageData-name" class="pageData">Packaging</div> 2<div id="pageData-showTOC" class="pageData">true</div> 3 4<p> 5This page describes how to package your extension. 6As the <a href="overview.html">Overview</a> explains, 7extensions are packaged as signed ZIP files 8with the file extension "crx" — 9for example, <code>myextension.crx</code>. 10</p> 11 12<p> 13<b>Note:</b> 14You might not need to package your extension. 15If you publish your extension using the 16<a href="https://chrome.google.com/extensions">gallery</a>, 17then the only reason to create your own <code>.crx</code> file 18would be to distribute a non-public version — 19for example, to alpha testers. 20</p> 21 22<!-- [PENDING: Refer to instructions on submitting an extension for inclusion in the gallery.] --> 23 24<p> 25When you package an extension, 26the extension is assigned a unique key pair. 27The public key is used as the identifier for the extension. 28The private key is kept private 29and used to sign each version of the extension. 30</p> 31 32 33<h2>Creating a package</h2> 34 35<p>To package an extension:</p> 36<ol> 37 <li> 38 Bring up the Extensions management page 39 by going to this URL: 40 <blockquote> 41 <b>chrome://extensions</b> 42 </blockquote> 43 </li> 44 45 <li> 46 If <b>Developer mode</b> has a + by it, 47 click the +. 48 </li> 49 50 <li> 51 Click the <b>Pack extension</b> button. 52 A dialog appears. 53 </li> 54 55 <li> 56 In the <b>Extension root directory</b> field, 57 specify the path to the extension's folder — 58 for example, <code>c:\myext</code>. 59 (Ignore the other field; 60 you don't specify a private key file 61 the first time you package a particular extension.) 62 </li> 63 64 <li> 65 Click <b>OK</b>. 66 The packager creates two files: 67 a <code>.crx</code> file, 68 which is the actual extension that can be installed, 69 and a <code>.pem</code> file, 70 which contains the private key. 71 </li> 72</ol> 73 74 75<p> 76<b>Do not lose the private key!</b> 77Keep the <code>.pem</code> file secret and in a safe place. 78You'll need it later if you want to do any of the following: 79</p> 80<ul> 81<li><a href="#update">Update</a> the extension</li> 82<li>Upload the extension to the 83<a href="https://chrome.google.com/extensions">Extensions Gallery</a> </li> 84</ul> 85 86<p> 87If the extension is successfully packaged, you'll see a dialog like this 88that tells you where to find 89the <code>.crx</code> and <code>.pem</code> files:</p> 90</p> 91 92<img src="images/package-success.gif" 93 width="554" height="208" /> 94 95 96<h2 id="update">Updating a package</h2> 97 98<p>To create an updated version of your extension:</p> 99<ol> 100 <li> 101 Increase the version number in <code>manifest.json</code>. 102 </li> 103 104 <li> 105 Bring up the Extensions management page 106 by going to this URL: <b>chrome://extensions</b> 107 </li> 108 109 <li> 110 Click the <b>Pack extension</b> button. 111 A dialog appears. 112 </li> 113 114 <li> 115 In the <b>Extension root directory</b> field, 116 specify the path to the extension's folder — 117 for example, <code>c:\myext</code>. 118 </li> 119 120 <li> 121 In the <b>Private key file</b> field, 122 specify the location of the 123 already generated <code>.pem</code> file for this extension — 124 for example, <code>c:\myext.pem</code>. 125 </li> 126 127 <li> 128 Click <b>OK</b>. 129 </li> 130</ol> 131 132<p>If the updated extension is successfully packaged, you'll see a dialog like this:</p> 133 134<img src="images/update-success.gif" 135 width="298" height="160" /> 136 137<h2>Packaging at the command line</h2> 138 139<p> 140Another way to package extensions 141is by invoking <code>chrome.exe</code> at the command line. 142Use the <code>--pack-extension</code> flag 143to specify the location of the extension's folder. 144Use <code>--pack-extension-key</code> 145to specify the location of the extension's private key file. 146For example: 147</p> 148 149<pre> 150chrome.exe --pack-extension=c:\myext --pack-extension-key=c:\myext.pem 151</pre> 152 153<p> 154To suppress the dialog, 155add <code>--no-message-box</code> to the command. 156</p> 157 158<h2 id="ruby">Ruby script</h2> 159 160<p> 161You can also use a Ruby script to create packages. 162See the following page for details: 163</p> 164 165<blockquote> 166<a href="http://github.com/Constellation/crxmake">github: crxmake</a> 167 168 169