1 <div id="pageData-name" class="pageData">Packaging</div> 2 <div id="pageData-showTOC" class="pageData">true</div> 3 4 <p> 5 This page describes how to package your extension. 6 As the <a href="overview.html">Overview</a> explains, 7 extensions are packaged as signed ZIP files 8 with the file extension "crx" — 9 for example, <code>myextension.crx</code>. 10 </p> 11 12 <p> 13 <b>Note:</b> 14 You might not need to package your extension. 15 If you publish your extension using the 16 <a href="https://chrome.google.com/webstore/developer/dashboard">Chrome Developer Dashboard</a>, 17 then the only reason to create your own <code>.crx</code> file 18 would be to distribute a non-public version — 19 for example, to alpha testers. 20 </p> 21 22 <!-- [PENDING: Refer to instructions on submitting an extension for inclusion in the gallery.] --> 23 24 <p> 25 When you package an extension, 26 the extension is assigned a unique key pair. 27 The public key is used as the identifier for the extension. 28 The private key is kept private 29 and 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> 77 Keep the <code>.pem</code> file secret and in a safe place. 78 You'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 using the 83 <a href="https://chrome.google.com/webstore/developer/dashboard">Chrome Developer Dashboard</a></li> 84 </ul> 85 86 <p> 87 If the extension is successfully packaged, you'll see a dialog like this 88 that tells you where to find 89 the <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> 140 Another way to package extensions 141 is by invoking <code>chrome.exe</code> at the command line. 142 Use the <code>--pack-extension</code> flag 143 to specify the location of the extension's folder. 144 Use <code>--pack-extension-key</code> 145 to specify the location of the extension's private key file. 146 For example: 147 </p> 148 149 <pre> 150 chrome.exe --pack-extension=c:\myext --pack-extension-key=c:\myext.pem 151 </pre> 152 153 <p> 154 To suppress the dialog, 155 add <code>--no-message-box</code> to the command. 156 </p> 157 158 <h2>Package format and scripts</h2> 159 <p> 160 For more information on the format, as well as pointers to scripts you can use 161 to create <code>.crx</code> files, see <a href="crx.html">CRX package format</a>. 162 </p> 163