EnvWrap is a lightweight environment management tool for managing PATH environment variables across different projects (Maybe not only PATH in the future). It allows you to create independent environment configurations for different projects and quickly switch between them.
- Clone or download EnvWrap to a local directory
- Load EnvWrap in your shell:
source EnvWrap/env-init.shAdd the following line to your shell configuration file (~/.bashrc, ~/.zshrc, etc.):
source /path/to/EnvWrap/env-init.shewrap help- Show help informationewrap list- List all environmentsewrap current- Show current environmentewrap create <name>- Create a new environmentewrap activate <name>- Activate an environmentewrap deactivate- Deactivate current environment (return to base)ewrap addpath <path>- Add a path to the current environmentewrap removepath <path>- Remove a path from the current environmentewrap delete <name>- Delete an environmentewrap reset- Reset to base environment and clear all pathsewrap clone <source> <target>- Clone source environment to target environment (creates target if it doesn't exist, overwrites if it does)
ew- Alias forewrapewa- Alias forewrap activateewl- Alias forewrap listewc- Alias forewrap currentewd- Alias forewrap deactivate
# Create a new environment
ewrap create myproject
# Activate the environment
ewrap activate myproject
# Add paths to the environment
ewrap addpath /usr/local/myproject/bin
ewrap addpath /opt/myproject/tools
# Quick example: Add current directory to PATH
ewrap addpath $(pwd)
# View current environment
ewrap current
# List all environments
ewrap list
# Switch to another environment
ewrap activate another-project
# Deactivate environment (return to base)
ewrap deactivateA common use case is adding the current working directory to your environment's PATH:
# Create and activate a project environment
ewrap create myproject
ewrap activate myproject
# Add current directory to PATH (useful for development)
ewrap addpath $(pwd)
# Or using the shortcut
ewrap addpath .This is particularly useful when you have executable scripts or binaries in your current project directory that you want to run without specifying the full path.
You can customize EnvWrap's behavior by setting environment variables:
ENV_MANAGER_HOME- Specify the storage location for environment configuration filesXDG_CONFIG_HOME- Use XDG standard configuration directory
If these variables are not set, EnvWrap defaults to storing configuration files in the envs subdirectory of the installation directory.
To unload EnvWrap from the current shell session:
source EnvWrap/env-unload.shEnvWrap stores environment configurations in JSON files, with one file per environment. Configuration files contain the environment name and a list of paths.
By default, configuration files are stored in:
- If
ENV_MANAGER_HOMEis set: Use that directory - If
XDG_CONFIG_HOMEis set:$XDG_CONFIG_HOME/env-manager - Default:
EnvWrap/envs/
- EnvWrap only affects the PATH environment variable of the current shell session
- Environment configurations are persistent and remain available after shell restart
- When an environment is activated,
[environment_name]is displayed before the shell prompt - The base environment is the default environment and cannot be deleted