Skip to content

Instantly share code, notes, and snippets.

@lidgnulinux
Last active March 31, 2025 01:38
Show Gist options
  • Save lidgnulinux/6f9baa7023a97bcd739631f761c55382 to your computer and use it in GitHub Desktop.
Save lidgnulinux/6f9baa7023a97bcd739631f761c55382 to your computer and use it in GitHub Desktop.
Build firefox appimage for musl based distro.

Build Firefox Appimage for Musl Based Distro.


Preparation.

  • Musl based distro archive.
  • Appimagetool.
  • Text editor.

Steps.

  1. Download Musl based distro archive / rootfs ! I use alpine linux minirootfs.

  2. Make a directory called Firefox.Appdir !

    $ mkdir Firefox.Appdir
  3. Extract the rootfs into Firefox.Appdir !

    $ tar -xf /path/to/rootfs -C Firefox.Appdir 
  4. Enter chroot and install Firefox package and its dependencies !

    $ sudo chroot Firefox.Appdir /bin/bash
    # apk update
    # apk upgrade
    # apk add firefox -i
  5. Exit chroot and enter the Firefox.Appdir directory !

  6. Copy firefox desktop file and icon to Firefox.Appdir !

    $ cp -r usr/share/applications/firefox.desktop .
    $ cp -r usr/share/icons/hicolor/scalable/apps/firefox.svg .
  7. Create AppRun file which contains script to launch Firefox ! Don't forget to do chmod +x !

    $ touch AppRun
    $ vim AppRun
    $ chmod +x AppRun

    The AppRun file contains these lines :

    #!/bin/bash
    
    HERE="$(dirname "$(readlink -f ""${0})")"
    exec env MOZ_LEGACY_PROFILES=1 LD_LIBRARY_PATH=${HERE}/usr/lib:${HERE}/lib:${HERE}/usr/lib/firefox ${HERE}/usr/lib/firefox/firefox "$@"
  8. Test the AppRun file by running it with ./AppRun !

  9. Change directory to one upper level by running cd .. !

  10. Build the appimage using appimagetool !

    $ /path/to/appimagetool-x86_64.AppImage -v -n Firefox.Appdir/
  11. Test the appimage !

    $ chmod +x ./Firefox-x86_64.AppImage
    $ ./Firefox-x86_64.AppImage

Known Issue(s).

After testing for several times, we found some issues :

  • By default, the appimage will use default profile, it leads to Welcome to Firefox tab always appear everytime we launch the appimage. Also, the default profile seems to make bookmark(s), histories seem unsaved. In fact, all bookmark and history will be saved to random profile. It will be safe to use default release profile, just launch the appimage using -P option and choose default profile. We also can specify the profile using --profile ~/.mozilla/firefox/the_id.default-release. We also can use MOZ_LEGACY_PROFILES=1 to prevent per installation profiles.
  • Some sites will have ugly font appearance, unless you uncheck Allow pages to choose their own fonts, instead of your selections above on font setting.
  • Huge appimage size, the appimage is shipped not only with firefox, but also its dependencies. The uncompressed appimage size is about 680 MB and the appimage size is about 200 MB.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment