An AppImage is a self-contained, portable application format for Linux. It's essentially a single file that includes the application and all its dependencies. While AppImages are read-only by default (since they're often run directly without installation), you can modify an existing AppImage to add additional files.
⚠️ Important Notes Before You Proceed:
- Modifying an AppImage may break it if not done carefully.
- AppImages are usually compressed and sometimes appended with a filesystem image.
- Not all AppImages use the same internal structure (Type 1 vs Type 2).
- If you're just trying to bundle extra files with an AppImage, consider creating a new AppImage from scratch instead of modifying an existing one.
✅ Step-by-Step: How to Add Files to an AppImage
🔧 Tools Required:
appimagetool – used to repackage the modified AppImage
mount or 7z – to extract the contents
patchelf – optional, for fixing library paths if needed
You can get appimagetool from https://github.com/AppImage/AppImageKit.
📦 Step 1: Make the AppImage Writable
AppImages are typically marked as executable but not writable. First, make a copy and change permissions:
cp YourApp.AppImage your_modified_app.AppImage
chmod +w your_modified_app.AppImage
🔍 Step 2: Extract the Contents of the AppImage
Option A: Use mount (if FUSE is available)
mkdir /tmp/appimage
./your_modified_app.AppImage --appimage-mount /tmp/appimage
This will mount the embedded squashfs filesystem at /tmp/appimage.
Note: This locks the terminal until you unmount. You can do this in the background or another terminal.
Then copy out the contents:
cp -r /tmp/appimage app_contents
Unmount when done:
fusermount -u /tmp/appimage
Option B: Use 7z (for Type 2 AppImages)
Install p7zip if needed:
sudo apt install p7zip-full
Extract the AppImage:
7z x your_modified_app.AppImage -oapp_contents/
Some parts might be in the . squashfs part, so also try mounting that:
sudo mount -o loop app_contents/*.squashfs /mnt
cp -r /mnt/* app_extracted/
sudo umount /mnt
🛠️ Step 3: Modify the Contents
Now you can add or remove files inside the extracted directory (app_extracted/ or app_contents/):
cd app_extracted/
cp /path/to/your/file.txt ./
If you're adding binaries or libraries, make sure they're compatible and adjust rpaths or symlinks as necessary using patchelf.
📦 Step 4: Repackage the AppImage
Once modifications are complete, use appimagetool to repackage it:
cd ..
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage
./appimagetool-x86_64.AppImage app_extracted your_modified_app.AppImage
This will overwrite your original AppImage file with the new version containing your added files.
✅ Step 5: Test the New AppImage
Make it executable and test:
chmod +x your_modified_app.AppImage
./your_modified_app.AppImage
🧪 Optional: Create a New AppImage from Scratch
If you're adding many files or want more control, it's often easier to build a new AppImage using a desktop file and folder structure. See the AppImage documentation for details on how to create one from scratch using linuxdeploy, etc.
🧹 Cleanup
After testing, you can clean up temporary directories:
rm -rf app_extracted app_contents
✅ Summary
| Step | Action |
|---|
| 1 | Copy and make AppImage writable |
| 2 | Extract contents via 7z or --appimage-mount |
| 3 | Add/remove files in the extracted directory |
| 4 | Repackage with appimagetool |
| 5 | Test the new AppImage |
Let me know if you'd like help writing a script or automating this!