A utility to manage LM Studio's home directory location via environment variables and filesystem junctions/symlinks.
LM Studio is a popular desktop application for running local LLMs. Unlike most developer tools, it hardcodes its data directory location and doesn't respect environment variables for configuration.
| Tool | Configurable? | Environment Variable |
|---|---|---|
| Ollama | ✅ Yes | OLLAMA_MODELS |
| Cargo (Rust) | ✅ Yes | CARGO_HOME |
| pip | ✅ Yes | PIP_CACHE_DIR |
| uv | ✅ Yes | UV_CACHE_DIR |
| LM Studio | ❌ No | None |
- Disk Space Management: LLM models are massive (7-70GB+ each). Users with small C: drives (SSDs) need to store them elsewhere.
- Multi-Drive Setups: Many users have fast SSD (C:) for OS/apps and large HDD (D:, E:) for data.
- Session Cache Bloat: LM Studio's
.session_cachefolder can grow to 100-300GB without user awareness.
Related GitHub Issue: lmstudio-ai/lmstudio-bug-tracker#230
This tool provides a workaround by:
- Managing filesystem junctions (Windows) or symlinks (Unix) to redirect LM Studio's data directory
- Monitoring and cleaning up session cache that can grow very large
- Providing a launcher that ensures proper setup before starting LM Studio
# Clone the repository
git clone https://github.com/savagelysubtle/lmstudio-home-manager.git
cd lmstudio-home-manager
# Build the release binary
cargo build --release
# The binary is at: target/release/lmstudio-home-manager.exe (Windows)
# Or: target/release/lmstudio-home-manager (Linux/macOS)# Windows (PowerShell) - Add to user PATH
$env:PATH += ";D:\Coding\LmStudioDev\target\release"
# To make permanent, add to your PowerShell profile:
notepad $PROFILE
# Add: $env:PATH += ";D:\path\to\lmstudio-home-manager\target\release"# 1. Set your preferred LM Studio data location
setx LM_STUDIO_HOME "D:\ProgramData\LM Studio"
# 2. Run setup to create the junction
lmstudio-home-manager setup
# 3. Check status
lmstudio-home-manager status
# 4. Launch LM Studio (ensures junction is valid first)
lmstudio-home-manager launch# Use the path from config/env var
lmstudio-home-manager setup
# Or specify a custom target
lmstudio-home-manager setup --target "E:\AI\LMStudio"lmstudio-home-manager statusOutput shows:
- Junction/symlink status and target
- LM Studio installation location
- Disk space usage by category (models, cache, etc.)
- Whether LM Studio is running
# Launch and return immediately
lmstudio-home-manager launch
# Launch and wait for exit
lmstudio-home-manager launch --wait# Check cache size
lmstudio-home-manager cache-status
# Preview what would be cleaned (dry run)
lmstudio-home-manager cleanup-cache --dry-run
# Clean files older than 7 days (default)
lmstudio-home-manager cleanup-cache --force
# Clean files older than 3 days
lmstudio-home-manager cleanup-cache --force --older-than-days 3# View current config
lmstudio-home-manager config --show
# Edit config file
lmstudio-home-manager config --edit# Remove junction only (preserves data)
lmstudio-home-manager uninstall
# Remove junction AND all data (DANGEROUS!)
lmstudio-home-manager uninstall --remove-dataConfiguration is stored in:
- Windows:
%APPDATA%\lmstudio-home-manager\lmstudio-home-manager\config.toml - Linux/macOS:
~/.config/lmstudio-home-manager/config.toml
[paths]
# Main LM Studio data directory (where data will actually be stored)
home = "D:\\ProgramData\\LM Studio"
# Optional: Override path for models only
# models = "D:\\ProgramData\\LM Studio\\models"
# Optional: Override path for session cache only
# cache = "D:\\ProgramData\\LM Studio\\cache"
[cleanup]
# Maximum allowed size of session cache in GB
session_cache_max_gb = 50
# Automatically clean up when threshold exceeded
auto_cleanup = false
# Days after which old cache files can be deleted
cache_retention_days = 7
[lmstudio]
# Custom path to LM Studio executable (auto-detected if not set)
# executable_path = "C:\\Users\\Me\\AppData\\Local\\Programs\\LM Studio\\LM Studio.exe"
[updates]
# Check for LM Studio version changes
check_lmstudio_version = true
# Automatically update junctions after LM Studio updates
auto_update_junctions = true| Variable | Description |
|---|---|
LM_STUDIO_HOME |
Main data directory (overrides config) |
LM_STUDIO_MODELS |
Models directory (optional override) |
LM_STUDIO_CACHE |
Session cache directory (optional override) |
On Windows, this tool creates directory junctions (similar to symlinks but for directories). These are transparent to applications:
~\.lmstudio\ (junction) → D:\ProgramData\LM Studio\
LM Studio thinks it's writing to ~\.lmstudio\, but the data actually goes to your chosen location.
On Unix systems, standard symbolic links are used:
~/.lmstudio (symlink) → /data/lm-studio/
When you run setup, if LM Studio data already exists in the default location, the tool will:
- Check if target has data - If yes, merge (skip existing files)
- Copy data to the new location
- Remove original directory
- Create junction/symlink pointing to the new location
This ensures no data loss during migration.
- Install LM Studio from https://lmstudio.ai/
- Or set the path manually in config:
[lmstudio] executable_path = "C:\\path\\to\\LM Studio.exe"
Run setup to migrate existing data and create the junction:
lmstudio-home-manager setupOn older Windows versions, you may need to run as Administrator. Windows 10+ should work without elevation.
- Check current size:
lmstudio-home-manager cache-status - Clean old files:
lmstudio-home-manager cleanup-cache --force - Enable auto-cleanup in config:
[cleanup] auto_cleanup = true session_cache_max_gb = 50
# Run with logging
RUST_LOG=debug cargo run -- status
# Run tests
cargo test
# Build release
cargo build --releaseContributions welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a Pull Request
MIT License - see LICENSE for details.