| Crates.io | safehold |
| lib.rs | safehold |
| version | 0.0.2 |
| created_at | 2025-09-19 17:30:03.509477+00 |
| updated_at | 2025-09-23 09:57:41.698831+00 |
| description | A secure cross-platform environment variable manager with CLI and optional GUI for encrypted storage of secrets and config. |
| homepage | https://github.com/muhammad-fiaz/safehold |
| repository | https://github.com/muhammad-fiaz/safehold |
| max_upload_size | |
| id | 1846728 |
| size | 496,925 |
SafeHold is a secure, cross-platform environment variable manager with both CLI and GUI interfaces. It stores environment variables and secrets encrypted at rest, supporting unlocked projects (app-managed key) and locked projects (password-protected). Perfect for managing project-specific and global environment variables without exposing sensitive data.
.env files or inject into processes..env files.--force bypass options.CLI only:
cargo install safehold
CLI + GUI:
cargo install safehold --features gui
Download pre-built binaries for your platform from the Releases page:
safehold-windows-x64.exe.zip or safehold-windows-x64-gnu.exe.zipsafehold-macos-x64.tar.gz (Intel) or safehold-macos-arm64.tar.gz (Apple Silicon)safehold-linux-x64.tar.gz, safehold-linux-arm64.tar.gz, or safehold-linux-x64-musl.tar.gzEach release includes both CLI-only and GUI-enabled binaries.
Clone the repository:
git clone https://github.com/muhammad-fiaz/safehold.git
cd safehold
Build the CLI version:
cargo build --release
(Optional) Build with GUI support:
cargo build --release --features gui
Install locally (CLI only):
cargo install --path .
Install locally with GUI:
cargo install --path . --features gui
SafeHold includes scripts for building across multiple platforms:
Unix/Linux/macOS:
chmod +x build.sh
./build.sh
Windows:
build.bat
This will create binaries for Windows, macOS, and Linux in the dist/ directory.
Add to PATH:
setx PATH "%USERPROFILE%\.cargo\bin;%PATH%"export PATH="$HOME/.cargo/bin:$PATH" to your shell profile (e.g., ~/.bashrc).Verify installation:
safehold --help
Run initial setup:
safehold setup --add-path
SafeHold can be installed in two modes:
cargo install safeholdcargo install safehold --features guiIf you try to launch the GUI without installing it, the CLI will inform you how to reinstall with the GUI feature.
SafeHold can be run in a Docker container for isolated environments or server deployments.
Clone the repository:
git clone https://github.com/muhammad-fiaz/safehold.git
cd safehold
Start the container:
docker-compose up -d
Use SafeHold commands:
# Check version
docker-compose exec safehold safehold version
# Create a project
docker-compose exec safehold safehold create myproject
# Set environment variables
docker-compose exec safehold safehold set --project myproject MY_VAR "my_value"
# List variables
docker-compose exec safehold safehold list --project myproject
# Interactive shell
docker-compose exec safehold bash
View logs:
docker-compose logs safehold
Stop the container:
docker-compose down
SAFEHOLD_DATA_DIR: Data storage directory (default: /app/data)RUST_LOG: Logging level (default: info)For detailed Docker usage, see DOCKER.md.
SafeHold automatically checks for updates and includes built-in update management.
CLI:
safehold check-update
GUI: Update notifications appear automatically when a new version is available, with options to visit the release page.
SafeHold stores all your projects and credentials in a separate data directory (~/.safehold/ on Linux/macOS, or equivalent on Windows). Updating SafeHold will never delete or remove your existing data.
To update to the latest version:
From crates.io:
cargo install safehold --features gui # or without --features for CLI-only
From GitHub releases: Download the latest binary from the releases page
From source:
git pull
cargo build --release --features gui
cargo install --path . --features gui
Your projects, credentials, and settings will remain intact. The update only replaces the SafeHold executable with the latest version.
Important: While data loss is unlikely, it's always good practice to back up your ~/.safehold/ directory before major updates.
SafeHold’s CLI supports global switches to control colors and animations:
--color <auto|always|never>: force color usage. Default is auto (uses color only when attached to a TTY).--style <fancy|plain>: choose fancy to enable spinner animations and styled prefixes, or plain for simple text. Default is fancy.--quiet: suppress non-essential output.Examples:
safehold --color never --style plain list-projectssafehold --style plain create projectA --password secretsafehold --quiet export --project projectA --file .envSafeHold stores data in ~/.safehold/ (or equivalent on Windows/macOS). Run safehold setup for initial setup and PATH guidance.
safehold create <name> (aliases: new)safehold create <name> --lock (prompts for password) or safehold create <name> --password <pwd>safehold list-projects (aliases: ls, projects)safehold delete-project <id|name> [--force] (aliases: rm, remove)safehold add --project <id|name> --key <key> --value <value> (aliases: set)safehold get --project <id|name> --key <key> (aliases: show)safehold update --project <id|name> --key <key> --value <value> (aliases: modify, change, edit)safehold list --project <id|name> (aliases: keys)safehold delete --project <id|name> --key <key> [--force] (aliases: del, rm-key)safehold count [--project <id|name>] [--detailed] [--include-global] (aliases: total)safehold global-add --key <key> --value <value> (aliases: gadd, global-set)safehold global-get --key <key> (aliases: gget, global-show)safehold global-update --key <key> --value <value> (aliases: gupdate, global-modify)safehold global-list (aliases: glist, global-keys)safehold global-delete --key <key> [--force] (aliases: gdel, global-rm).env: safehold export --project <id|name> [--file <name>] [--force] [--temp]safehold export --global [--file <name>] [--force] [--temp]safehold run --project <id|name> [--with-global] -- <command> (aliases: exec)safehold show-all (prompts for locked sets) (aliases: all).env: safehold cleansafehold clean-cache [--force] (aliases: clear-cache, cache-clean)safehold about (aliases: info)safehold setup [--add-path] prints PATH guidance; --add-path attempts to add Cargo's bin folder to PATH automaticallysafehold launch --gui launches the GUI when installed with the gui feature; otherwise shows a hint to reinstall with GUIsafehold check-update (aliases: update-check, check-updates) checks for new releases from crates.iosafehold master-lock [--enable|--disable] (aliases: mlock, global-master)
SAFEHOLD_MASTER_PASSWORD to bypass prompts when master lock is enabledsafehold delete-all [--force] (aliases: clear-all, nuke)
--force to skip confirmation (DANGEROUS!)--force, requires typing "DELETE ALL MY DATA" to confirmIf built with --features gui, launch the graphical interface:
safehold launch --gui
.env, update/modify credentials.Create and populate a project:
safehold create project1
safehold add --project project1 --key GITHUB_TOKEN --value ghp_1234567890abcdef
safehold add --project project1 --key DB_PASS --value mysecretpassword
safehold list --project project1
Update and manage credentials:
safehold update --project project1 --key GITHUB_TOKEN --value new_token_value
safehold count --project project1
safehold count --detailed --include-global
Global credentials management:
safehold global-add --key COMMON_API_KEY --value shared_secret
safehold global-list
safehold global-update --key COMMON_API_KEY --value updated_secret
Create a locked project:
safehold create secureproj --lock
# Enter password when prompted
safehold add --project secureproj --key API_KEY --value supersecret
Export and run:
safehold export --project project1 --temp
safehold run --project project1 --with-global -- cargo run
Maintenance and information:
safehold about # Show comprehensive application information
safehold clean-cache # Clean temporary files (will prompt for confirmation)
safehold clean-cache --force # Clean without confirmation
Global Master Lock Security 🔐:
# Check current master lock status
safehold master-lock
# Enable Global Master Lock (ALL projects will require the same password)
safehold master-lock --enable
# Will prompt for master password creation
# Now ALL projects use the master password
safehold get --project myproject --key API_KEY # Uses master password
safehold global-get --key SHARED_KEY # Uses master password
# Disable Global Master Lock (return to individual project passwords)
safehold master-lock --disable
# Will prompt for master password verification
Emergency cleanup ⚠️:
# WARNING: These operations are DESTRUCTIVE and PERMANENT!
safehold delete-all # Will prompt for "DELETE ALL MY DATA" confirmation
safehold delete-all --force # Bypasses confirmation - USE WITH EXTREME CAUTION!
Force operations for automation:
# Delete project without confirmation (for scripts)
safehold delete-project myproject --force
# Delete credential without confirmation
safehold delete --project myproject --key API_KEY --force
# Delete global credential without confirmation
safehold global-delete --key SHARED_KEY --force
SafeHold stores persistent application preferences separately from your project data. Settings are automatically saved and restored across sessions.
auto, always, never)fancy (with spinners) or plain text outputSettings are stored in app_settings.json in your SafeHold data directory and are preserved across updates.
.env.enc; passwords never stored.--password in shared shells.We welcome contributions! Please see our Contributing Guide for detailed information on how to get started, development setup, and contribution guidelines.
See CHANGELOG.md for a complete list of changes and version history.
For questions, support, or feedback:
MIT License. See LICENSE for details.