Install WebExtensions on Firefox from the command line

Please see:

The question you link on askubuntu: How to install Firefox addon from command line in scripts? is several years out of date, but does have some good information.

At this point, most Mozilla add-ons, including all Firefox WebExtension add-ons, are installed manually by placing the add-on’s .xpi file in the appropriate directory with the correct name for the extension without unpacking (unzipping) the contents. [You can also install them by downloading them in Firefox, drag-and-drop the .xpi onto Firefox/Thunderbird, etc.]

You can determine those add-ons that must be unpacked by unpacking the add-on’s .xpi file and looking at the install.rdf file to see if it has <em:unpack>true</em:unpack>. All WebExtensions don’t have this file and are installed without unpacking.

The .xpi file must be called [extensionID].xpi. You can find the extension ID from either the install.rdf file (non-WebExtension add-ons). In that file, you are looking for <em:id>ThisEntireStringIsTheAddOnsID</em:id>

For a WebExtension, the ID is in the manifest.json file under the applications property:

"applications": {
    "gecko": {
        "id": "ThisEntireStringIsTheAddOnsID"
    }
},

For both of the above examples the .xpi file must be renamed to ThisEntireStringIsTheAddOnsID.xpi

If the install.rdf file includes <em:unpack>true</em:unpack>, then the files in the .xpi must be unpacked (unzipped) and placed in a subdirectory under the extensions directory. In the above install.rdf example (again WebExtensions are not unpacked), the directory would be named: ThisEntireStringIsTheAddOnsID

Extension directories:

The extension directories where you put the .xpi file or unpacked directory are (information partially copied from MDN):

For all users running a particular version of Firefox:
[Firefox install directory]/browser/extensions/

Firefox will ask the user to confirm installation of the add-on when that version of Firefox is run. The user will not have the ability to remove the extension, only disable it. The extension will not be automatically updated.

For all users running a particular version of Firefox:
[Firefox install directory]/distribution/extensions

The extension will be installed for all users/profiles the first time the profile is run with that version of Firefox. The extension will be copied into the profile’s extensions directory and the user will be able to remove it in addition to disabling it. The user will not be asked to confirm installation. The extension copied to each profile will be automatically updated along with all other extensions installed for that profile. You should not unpack any .xpi files in this directory. If the file needs to be unpacked, it will be done automatically by Firefox when the extension is installed in each profile.

For a particular User’s specific profile:
[profile directory]/extensions/

On Windows:
All profiles for a specific user:
<I>%appdata%\\Mozilla\\Extensions\\{ec8030f7-c20a-464f-9b0e-13a3a9e97384}\</I>

Profile directories are located at:
<i>\\Mozilla\\Firefox\\Profiles\\*</i>

OSX:
For all users:
/Library/Application Support/Mozilla/Extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/

Just for a specific user, place it in that user’s library folder hierarchy:
~/Library/Application Support/Mozilla/Extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/

Linux:
For all users:
/usr/lib/Mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/

or
/usr/lib64/Mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/

or
/usr/share/Mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/

Just for a specific user:
~/.Mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/

NOTE:

The -install-global-extension option mentioned in the question/answer you linked was removed from Firefox as of Gecko 1.9.2 ( a long time ago).

Leave a Comment