A Rust-based CLI tool for system maintenance.
- Backup: Saves global package lists (e.g., brew, npm, cargo, bun, uv) and configuration files using registry-based management.
- Biometric Sudo [macOS]: Configures Touch ID authentication for sudo commands.
- Clean: Removes system junk (caches, logs, etc) and runs package manager cleanup.
- Delete [macOS]: Removes applications and their related files with interactive selection.
- Install: Sets up automated services for backups, cleaning, and system updates.
- Link: Creates symlinks for dotfiles (e.g., .mntn, .zshrc, .vimrc, .config, VSCode settings).
- Package Registry: Centralized management of package managers for backup operations.
- Purge: Deletes unused services with user confirmation.
- Registry: Centralized management of configuration files and directories to backup and link.
- Restore: Restores configuration files from backups using the registry system.
cargo install mntn# Create your first backup
mntn backup
# Set up automated maintenance
mntn install --with-clean
# Link your dotfiles to your system files (requires ~/.mntn/backup to exist)
mntn link
# Clean system junk
mntn clean
# Enable Touch ID for sudo (macOS only)
mntn biometric-sudoThe backup command saves your system's package lists and configuration files to ~/.mntn/backup/:
mntn backupWhat gets backed up:
- Package lists: Managed through the package registry system - Homebrew packages (
brew.txt,brew-cask.txt), npm global packages (npm.txt), Yarn global packages (yarn.txt), pnpm global packages (pnpm.txt), Bun global packages (bun.txt), uv packages (uv.txt), and Cargo installed packages (cargo.txt) - Configuration files: Managed through the configuration registry - VS Code settings and keybindings, Ghostty terminal config, shell configurations, and other dotfiles
Backup location: ~/.mntn/backup/
To restore your configuration files from a previous backup:
mntn restoreThis will restore VS Code settings, keybindings, and Ghostty configuration from your backup.
Note: Package restoration must be done manually using the generated package lists. The package registry system ensures only enabled and platform-compatible package managers are backed up. For example:
# Restore Homebrew packages
brew install $(cat ~/.mntn/backup/brew.txt)
# Restore npm global packages (parse npm ls output format)
npm install -g $(cat ~/.mntn/backup/npm.txt | grep -E '^[├└]' | sed 's/^[├└]── //' | cut -d'@' -f1 | tr '\n' ' ')
# Restore cargo packages
while read -r line; do
cargo install "$(echo "$line" | cut -d' ' -f1)"
done < ~/.mntn/backup/cargo.txt-
Initialize git repository in the mntn directory:
# Create your first backup to set up the folder structure mntn backup # Initialize git repository in the mntn directory (includes full context) cd ~/.mntn git init git remote add origin https://github.com/yourusername/dotfiles.git # mntn will automatically create a .gitignore with mntn.log excluded
-
Your mntn directory structure will look like:
~/.mntn/ ├── .git/ # Git repository ├── .gitignore # Automatically created (excludes mntn.log) ├── registry.json # Configuration registry ├── package_registry.json # Package manager registry ├── mntn.log # Log file (ignored by git) ├── symlinks/ # Backup of original files └── backup/ # Your dotfiles and configs ├── .zshrc # Shell configuration ├── .vimrc # Vim configuration ├── config/ # This becomes ~/.config │ ├── nvim/ │ └── git/ ├── vscode/ │ ├── settings.json │ └── keybindings.json ├── brew.txt # package managers, etc. ├── npm.txt └── cargo.txt -
Commit and push your configurations:
cd ~/.mntn git add . git commit -m "Initial mntn setup with full context" git push -u origin main
Once your backup repository is set up, use mntn link to create symlinks:
mntn linkWhat it does:
- Links
~/.mntn/backup/.zshrc→~/.zshrc - Links
~/.mntn/backup/.vimrc→~/.vimrc - Links
~/.mntn/backup/config→~/.config - Links
~/.mntn/backup/vscode/settings.json→~/Library/Application Support/Code/User/settings.json - Links
~/.mntn/backup/vscode/keybindings.json→~/Library/Application Support/Code/User/keybindings.json
Safety features:
- Automatically backs up existing files to
~/.mntn/symlinks/ - If source doesn't exist but target does, copies target to source first
- Won't overwrite existing correct symlinks
# Install mntn
cargo install mntn
# Clone your mntn repository (includes full context and registries)
git clone https://github.com/yourusername/dotfiles.git ~/.mntn
# Create symlinks for your configurations
mntn link
# Run backup to update with any new package installations
mntn backup
# The repository now includes your registries and full mntn contextThe package-registry command provides centralized management of package managers used during backup operations. This system allows you to configure which package managers to include, customize their commands, and control platform-specific behavior.
# List all package manager entries
mntn package-registry list
# List only enabled entries
mntn package-registry list --enabled-only
# List only entries compatible with current platform
mntn package-registry list --platform-onlyDefault Package Managers:
brew- Homebrew packages (macOS/Linux)brew_cask- Homebrew casks/applications (macOS only)npm- npm global packages (all platforms)yarn- Yarn global packages (all platforms)pnpm- pnpm global packages (all platforms)bun- Bun global packages (all platforms)cargo- Cargo installed packages (all platforms)uv- uv installed tools (all platforms)pip- pip packages (disabled by default)
# Add a new package manager
mntn package-registry add pipx \
--name "pipx Applications" \
--command "pipx" \
--args "list" \
--output-file "pipx.txt" \
--description "pipx installed Python applications"
# Add with platform restrictions
mntn package-registry add winget \
--name "Windows Package Manager" \
--command "winget" \
--args "list" \
--output-file "winget.txt" \
--platforms "windows"# Enable or disable a package manager
mntn package-registry toggle npm --enable
mntn package-registry toggle pip --disable
# Remove a package manager from the registry
mntn package-registry remove custom_managerThe package registry is stored as JSON at ~/.mntn/package_registry.json. You can edit it manually if needed, but using the CLI commands is recommended for consistency.
Example package manager entry:
{
"name": "Homebrew Packages",
"command": "brew",
"args": ["leaves"],
"output_file": "brew.txt",
"enabled": true,
"description": "Homebrew installed packages (leaves only)",
"platforms": ["macos", "linux"]
}The registry command provides a centralized way to manage what configuration files and folders are backed up and linked. The registry stores metadata about each configuration entry including source paths, target locations, and categories.
# List all entries in the registry
mntn registry list
# List only enabled entries
mntn registry list --enabled-only
# List entries in a specific category
mntn registry list --category editorRegistry Categories:
shell- Shell configuration files (.zshrc, .bashrc, etc.)editor- Text editors and IDEs (vim, vscode, etc.)terminal- Terminal emulators and related toolssystem- System-wide configurationdevelopment- Development tools and environmentsapplication- Application-specific configs
# Add a new configuration file to track
mntn registry add my_app_config \
--name "My App Config" \
--source "myapp/config.json" \
--target "~/.config/myapp/config.json" \
--category application \
--description "Configuration for My App"Target Path Types:
~/path- Home directory relative paths.config/path- Config directory relative paths/absolute/path- Absolute paths- Automatic detection based on path patterns
# Enable or disable an entry
mntn registry toggle my_app_config --enable
mntn registry toggle my_app_config --disable
# Remove an entry from the registry
mntn registry remove my_app_configThe registry is stored as JSON at ~/.mntn/registry.json. You can edit it manually if needed, but using the CLI commands is recommended for consistency.
Example registry entry:
{
"name": "Zsh Configuration",
"source_path": ".zshrc",
"target_path": {
"Home": ".zshrc"
},
"category": "Shell",
"enabled": true,
"description": "Main Zsh shell configuration file"
}The install command sets up automated maintenance tasks using your system's scheduler:
# Basic installation (backup every hour)
mntn install
# Include daily cleaning
mntn install --with-cleanWhat gets installed:
- macOS: Creates LaunchAgents in
~/Library/LaunchAgents/ - Linux: Creates systemd user services and timers
- Windows: Creates scheduled tasks
Scheduled tasks:
mntn-backup: Runsmntn backupevery hourmntn-clean: Runsmntn cleandaily (with--with-cleanflag)mntn-topgrade: Runstopgradedaily (if topgrade is installed)
Task logs:
- macOS:
/tmp/mntn-*.outand/tmp/mntn-*.err - Linux: Use
journalctl --user -u mntn-*.service
The clean command removes unnecessary files and frees up disk space:
# Clean user-level files only
mntn clean
# Also clean system files (requires sudo)
mntn clean --system
# Preview what would be cleaned without actually deleting
mntn clean --dry-runWhat gets cleaned:
User-level cleanup (default):
- Cache directories (
~/Library/Cacheson macOS,~/.cacheon Linux) - Temporary files
- Application logs and saved states (macOS)
- Quick Look cache reset (macOS)
System-level cleanup (with --system):
- System caches (
/Library/Caches,/var/cache) - System logs (
/private/var/log,/var/log) - Diagnostic reports (macOS)
- Volume trash folders (macOS)
Package manager cleanup:
- Homebrew:
brew cleanup - npm:
npm cache clean --force - pnpm:
pnpm cache delete
Safety features:
- Skips files modified in the last 24 hours
- Skips symbolic links
- Skips system-critical directories (
.X11-unix,systemd-private, etc.)
Remove unused services and startup programs interactively:
# List and remove user services
mntn purge
# Include system services (requires sudo)
mntn purge --system
# Preview what would be removed
mntn purge --dry-runWhat it manages:
- macOS: LaunchAgents (
.plistfiles) in~/Library/LaunchAgents/and/Library/LaunchAgents/ - Linux: systemd user services and autostart programs
- Windows: Windows services and startup programs (planned)
Interactive selection:
- Lists all found services/programs
- Multi-select interface to choose what to delete
- Shows full paths for transparency
- Confirmation before deletion
Enable Touch ID authentication for sudo commands:
mntn biometric-sudoWhat it does:
- Backs up
/etc/pam.d/sudoto/etc/pam.d/sudo.bak - Adds Touch ID PAM module (
pam_tid.so) to the sudo configuration - Enables Touch ID authentication for all sudo commands
After setup:
- Use Touch ID instead of typing your password for sudo commands
- Fallback to password if Touch ID fails
- Works with Terminal, VS Code integrated terminal, and other applications
Requirements:
- macOS with Touch ID capability
- Administrator privileges (will prompt for password during setup)
- Permission denied: Ensure you have read access to config directories
- Missing package managers: Commands will be skipped if tools aren't installed
- Symlink conflicts: Use
mntn purgeto clean up old services, then retry - Permission issues: Ensure write access to target directories
- System clean fails: Use
mntn clean --systemand enter password when prompted - Space not freed: Some applications may recreate caches immediately
- Files not found: Run
mntn backupfirst to create initial backups - Permission denied: Ensure write access to target config directories
MIT