A launcher script for managing and running LM Studio AppImage on Ubuntu/Linux systems with automatic version management.
LM Studio is distributed as an AppImage for Linux. This launcher script provides:
- Automatic version management - Detects new downloads and updates installation
- Clean installation directory - Maintains LM Studio in
/opt/lmstudio - Version tracking - Tracks installed version for update comparison
- Auto shell configuration - Automatically adds PATH and
lmstudioalias to your shell - Graceful cleanup - Handles signals and cleans up processes on exit
- Ubuntu (or other Linux distribution)
- LM Studio AppImage downloaded from lmstudio.ai
If you have an AMD Ryzen AI MAX+ 395 (or similar Strix Point APU with Radeon 8060S graphics), the ROCm backend will not work. The gfx1151 GPU architecture is too new and not yet supported by the bundled llama.cpp ROCm binaries.
Symptoms: Model crashes immediately with "Exit code: null" error when trying to load any model.
Solution: Switch to the Vulkan backend instead:
- Close LM Studio completely
- Edit
~/.lmstudio/.internal/backend-preferences-v1.json:[ { "model_format": "gguf", "name": "llama.cpp-linux-x86_64-vulkan-avx2", "version": "1.62.0" } ] - Restart LM Studio
Alternatively, you can change the backend in LM Studio Settings → Runtime (if accessible before crash).
The script requires /opt/lmstudio to exist with user write permissions:
sudo mkdir -p /opt/lmstudio
sudo chown $USER:$USER /opt/lmstudioDownload the latest LM Studio AppImage from lmstudio.ai to your ~/Downloads folder.
The file should match the pattern: LM-Studio-X.Y.Z-N-x64.AppImage
Example: LM-Studio-0.3.34-1-x64.AppImage
git clone <repository-url> ~/Projects/strix-lmstudio
# or copy run_lmstudio.sh to your preferred locationchmod +x run_lmstudio.sh./run_lmstudio.shThe script will:
- Configure shell PATH and alias (first run only)
- Check
~/Downloadsfor new LM Studio AppImage files - Compare versions with currently installed version
- Install/update if a newer version is found
- Launch LM Studio with required parameters
After the first run, you can use the lmstudio alias from anywhere:
lmstudioPress Ctrl+C in the terminal. The script will:
- Gracefully terminate LM Studio
- Clean up any remaining processes
- Remove temporary files and lock files
/opt/lmstudio/
├── LMStudio.AppImage # The installed AppImage (renamed for consistency)
└── lmstudio.version # Text file containing version string (e.g., "0.3.34-1")
~/Downloads/
└── LM-Studio-X.Y.Z-N-x64.AppImage # New downloads detected here
The script extracts version information from the AppImage filename:
LM-Studio-0.3.34-1-x64.AppImage
^^^^^^^^
Version: 0.3.34-1 (semver + build number)
Version comparison logic:
| Scenario | Current | New | Action |
|---|---|---|---|
| Major update | 0.3.34-1 | 0.4.0-1 | Update |
| Minor update | 0.3.34-1 | 0.3.35-1 | Update |
| Build update | 0.3.34-1 | 0.3.34-2 | Update |
| Same version | 0.3.34-1 | 0.3.34-1 | Skip (remove duplicate) |
| Older version | 0.3.34-1 | 0.3.33-1 | Skip |
On first run, the script automatically configures your shell:
| File | What's Added |
|---|---|
~/.bashrc |
PATH + lmstudio alias |
~/.profile |
PATH only (login shells) |
~/.zshrc |
PATH + lmstudio alias |
The configuration is idempotent - it only adds entries if they don't exist. After configuration, reload your shell or run:
source ~/.bashrc # or source ~/.zshrc┌─────────────────────────────────────────────────────────────┐
│ 0. Configure shell PATH/alias (first run only) │
│ 1. Scan ~/Downloads for LM-Studio-*-x64.AppImage │
│ 2. Extract version from filename │
│ 3. Compare with /opt/lmstudio/lmstudio.version │
│ 4. If newer: │
│ ├─ Remove old AppImage │
│ ├─ Move new AppImage to /opt/lmstudio/LMStudio.AppImage │
│ ├─ Set executable permission │
│ ├─ Update version file │
│ └─ Clean up old downloads │
│ 5. Launch /opt/lmstudio/LMStudio.AppImage --no-sandbox │
└─────────────────────────────────────────────────────────────┘
LM Studio (built on Electron) requires the --no-sandbox flag when running as an AppImage on Linux. This is due to how AppImage bundles work with Chrome's sandbox requirements. The script handles this automatically.
All configuration is at the top of run_lmstudio.sh:
INSTALL_DIR="/opt/lmstudio" # Installation directory
VERSION_FILE="$INSTALL_DIR/lmstudio.version" # Version tracking
APPIMAGE_NAME="LMStudio.AppImage" # Canonical name after install
DOWNLOADS_DIR="$HOME/Downloads" # Where to look for new versions
DOWNLOAD_PATTERN="LM-Studio-*-x64.AppImage" # Filename pattern to matchCreate the directory with proper permissions:
sudo mkdir -p /opt/lmstudio
sudo chown $USER:$USER /opt/lmstudioFix permissions:
sudo chown $USER:$USER /opt/lmstudioDownload LM Studio from lmstudio.ai to ~/Downloads.
The script detects running instances and prompts to kill them:
WARNING: LM Studio appears to be already running.
Do you want to kill existing instances and continue? (y/N):
Ensure your DISPLAY environment variable is set (shown in startup output). For Wayland users, you may need additional configuration.
| Path | Purpose |
|---|---|
/opt/lmstudio/ |
Installation directory |
/opt/lmstudio/LMStudio.AppImage |
The executable AppImage |
/opt/lmstudio/lmstudio.version |
Installed version string |
~/.lmstudio/ |
LM Studio user configuration |
~/.config/LM Studio/ |
LM Studio cache and settings |
/tmp/.mount_LM-Stu* |
Temporary AppImage mount (cleaned on exit) |
The script sets up signal handlers for SIGINT (Ctrl+C) and SIGTERM to:
- Terminate the LM Studio process gracefully
- Force kill if graceful shutdown fails after 3 seconds
- Kill any remaining related processes
- Remove temporary mount directories
- Remove lock files
This launcher script is provided as-is. LM Studio itself is a separate product - see lmstudio.ai for its licensing terms.