| Crates.io | set_env_perm |
| lib.rs | set_env_perm |
| version | 2.0.1 |
| created_at | 2026-01-18 16:08:49.654063+00 |
| updated_at | 2026-01-18 16:12:57.830468+00 |
| description | Sets environment variables permanently across all major platforms |
| homepage | |
| repository | https://github.com/TobiasGrothmann/set_env_perm |
| max_upload_size | |
| id | 2052576 |
| size | 19,288 |
This crate allows you to permanently set environment variables
// Check if DUMMY is set, if not set it to 1
// export DUMMY=1
set_env_perm::check_or_set("DUMMY", 1).expect("Failed to find or set DUMMY");
// Append $HOME/some/cool/bin to $PATH
// export PATH= "$HOME/some/cool/bin:$PATH"Cancel changes
set_env_perm::append("PATH", "$HOME/some/cool/bin").expect("Couldn't find PATH");
// Sets a variable without checking if it exists.
// Note you need to use a raw string literal to include ""
// export DUMMY="/something"
set_env_perm::set("DUMMY", r#""/something""#).expect("Failed to set DUMMY");
This crate simply appends to your .bash_profile or .bash_login or .profile
in that order.
It will create a .bash_profile file if none of the above are
found in your home directory.
ie. /Users/me/.bash_profile.
On windows, this crate will modify the HKEY_CURRENT_USER\Environment registry items