LAM - Launch Agent Manager
๐ Overview
LAM (Launch Agent Manager) is a modern, feature-rich terminal user interface (TUI) application built with Rust and Ratatui for managing macOS LaunchAgent plist files. Inspired by systemctl-tui, LAM provides an intuitive, vim-style interface for viewing, editing, and managing launch agents across User, Global, and Apple directories.
โจ Features
๐ฏ Service-Style Agent Browser
- Three-tab interface: User (
~/Library/LaunchAgents), Global (/Library/LaunchAgents), and Apple (/System/Library/LaunchAgents)
- Real-time status indicators:
- โ Running (green) / โ Stopped (red) / โ Error (magenta) / ? Unknown (gray)
- โ Enabled (cyan) / โ Disabled (gray)
- Agent count display: Shows total number of LaunchAgents in each category
๐ Smart Search & Filtering
- Real-time search: Filter agents by filename or label as you type
- Live counter: Shows filtered results (e.g., "LaunchAgents (3/15)")
- Case-insensitive: Searches both filename and internal agent labels
โก Status Integration
- launchctl integration: Live status detection using macOS launchctl
- Automatic refresh: Status updates after save operations
- Multi-state support: Running, stopped, error, and unknown states
๐ Plist Editor
- Structured form interface: Edit plist properties in organized form fields
- Editing: Navigate and edit values with vim-style keybindings
- Comprehensive property support: Common LaunchAgent properties
- Save functionality: Save changes with Ctrl-S and automatic agent reload
๐จ Modern Design
- OneHalfDark theme: Professional color scheme with excellent readability
- Rounded borders: Modern UI elements with consistent styling
- Focus indicators: Clear visual feedback for current selection
- Loading screen: Animated startup with progress indicators
โจ๏ธ Vim-Style Navigation
- j/k navigation: Move through agent lists and form fields
- g/G shortcuts: Jump to first/last items
- Tab cycling: Switch between Search โ Sidebar โ Form panels
- Intuitive keybindings: Familiar patterns for efficient workflow
๐ Installation
Prerequisites
- macOS (required for LaunchAgent functionality)
Homebrew (Recommended)
# Add the tap
brew tap hollanddd/homebrew-tap
# Install LAM
brew install lam
Build from Source
Prerequisites: Rust toolchain (latest stable)
git clone https://github.com/hollanddd/lam.git
cd lam
cargo build --release
./target/release/lam
Development Build
cargo run
๐ Usage
Navigation
- Tab: Cycle focus between Search โ Sidebar โ Form
- 1/2/3: Switch between User/Global/Apple tabs
- /: Jump to search bar
- q/Esc: Show exit confirmation
Search Bar
- Type: Filter agents by name or label
- Backspace: Remove filter characters
- Enter: Move focus to sidebar
Sidebar Navigation
- j/k or Arrow keys: Navigate agent list
- g: Go to first agent
- G: Go to last agent
- Enter: Load selected agent for editing
Form Editor
- j/k or Arrow keys: Navigate form fields
- Enter: Start editing current field
- Ctrl-S: Save changes and reload agent
- PgUp/PgDn: Scroll through long forms
Edit Mode
- Type: Modify field values
- Enter: Save field changes
- Esc: Cancel editing
- Backspace: Delete characters
Exit
- q/Esc/Ctrl-C: Show exit confirmation
- Y: Confirm exit
- N: Cancel exit
๐ง Supported LaunchAgent Properties
LAM supports editing all common LaunchAgent plist properties:
| Property |
Type |
Description |
| Label |
String |
Unique identifier for the agent |
| Program |
String |
Path to executable program |
| ProgramArguments |
Array |
Command and arguments to execute |
| StartInterval |
Integer |
Run interval in seconds |
| ThrottleInterval |
Integer |
Minimum seconds between launches |
| RunAtLoad |
Boolean |
Start at system boot |
| KeepAlive |
Boolean |
Restart if process exits |
| AbandonProcessGroup |
Boolean |
Prevent process group management |
| StandardOutPath |
String |
Path for stdout logging |
| StandardErrorPath |
String |
Path for stderr logging |
| WorkingDirectory |
String |
Working directory for process |
| POSIXSpawnType |
String |
Process spawn method |
| EnablePressuredExit |
Boolean |
Allow system-initiated termination |
| EnableTransactions |
Boolean |
Enable transaction support |
| EventMonitor |
Boolean |
Monitor system events |
| LimitLoadToSessionType |
String/Array |
Session type restrictions |
| AssociatedBundleIdentifiers |
Array |
Related bundle identifiers |
| EnvironmentVariables |
Dictionary |
Custom environment variables |
๐ฏ Auto-reload Process
When you save changes with Ctrl-S, LAM automatically:
- Saves the XML file to the appropriate LaunchAgents directory
- Unloads the agent using
launchctl unload
- Loads the agent using
launchctl load
- Refreshes status indicators to show new state
- Provides feedback in the status bar
Error Handling:
- Unload failures (agent not loaded) are ignored
- Load failures display error messages in status bar
- File saves always succeed, even if reload fails
๐ Architecture
Core Technologies
- Rust: Systems programming language for performance and safety
- Ratatui: Terminal UI framework for rich text interfaces
- Crossterm: Cross-platform terminal manipulation
- Tokio: Async runtime for responsive UI
- Serde: Serialization for plist data handling
- Quick-XML: Fast XML parsing with serde integration
Key Components
- Single-file application: Entire logic in
src/main.rs
- Event-driven architecture: Async event handling with Crossterm
- State management: Centralized app state with focus tracking
- Real-time integration: Live launchctl status checking
- Theme system: Consistent OneHalfDark color palette
๐งช Development
Running Tests
cargo test
Code Quality
# Format code
cargo fmt
# Run linter
cargo clippy
# Check compilation
cargo check
Project Structure
lam/
โโโ src/
โ โโโ main.rs # Complete application logic
โโโ assets/
โ โโโ lamb.png # Application logo
โโโ Cargo.toml # Rust dependencies and metadata
โโโ README.md # This documentation
โโโ LICENSE # MIT license
โโโ CLAUDE.md # AI assistant instructions
๐ค Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature)
- Commit your changes (
git commit -m 'Add amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Pull Request
๐ License
Copyright (c) Darren me@darrenholland.com
This project is licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT)
Built with โค๏ธ in Rust for macOS power users