atmos toolchain env
Export the PATH environment variable for your toolchain tools in shell-specific formats. This command makes it easy to integrate toolchain paths into different shell environments (Bash, Fish, PowerShell) and configuration files (.env, JSON).
Usage
Execute the atmos toolchain env command like this:
atmos toolchain env
By default, the command outputs in Bash/Zsh export format. You can specify different output formats using the --format flag.
Examples
Bash/Zsh (default)
atmos toolchain env
# Output: export PATH='/path/to/tools/bin:/usr/local/bin:/usr/bin:/bin'
Source it directly in your shell:
eval "$(atmos toolchain env)"
Fish Shell
atmos toolchain env --format fish
# Output: set -gx PATH '/path/to/tools/bin' '/usr/local/bin' '/usr/bin' '/bin'
Source it in Fish:
atmos toolchain env --format fish | source
PowerShell
atmos toolchain env --format powershell
# Output: $env:PATH = "/path/to/tools/bin;C:\Windows\System32"
Execute it in PowerShell:
Invoke-Expression (atmos toolchain env --format powershell)
Dotenv Format
atmos toolchain env --format dotenv > .env
# Creates .env file with: PATH='/path/to/tools/bin:/usr/local/bin:/usr/bin:/bin'
JSON Format
atmos toolchain env --format json
Example output:
{
"tools": [
{
"tool": "terraform",
"version": "1.5.0",
"path": "/home/user/.tools/terraform/1.5.0/bin"
}
],
"final_path": "/home/user/.tools/terraform/1.5.0/bin:/usr/local/bin:/usr/bin:/bin",
"count": 1
}
Relative Paths
atmos toolchain env --relative
# Uses relative paths instead of absolute
Flags
--format,-f(optional)Output format:
bash,fish,powershell,json,dotenvDefault:
bashEnvironment variable:
ATMOS_TOOLCHAIN_ENV_FORMAT--relative(optional)Use relative paths instead of absolute paths
Environment variable:
ATMOS_TOOLCHAIN_RELATIVE
Common Use Cases
Shell Integration
Add to your shell profile to automatically use toolchain tools:
Bash/Zsh (~/.bashrc or ~/.zshrc):
eval "$(atmos toolchain env)"
Fish (~/.config/fish/config.fish):
atmos toolchain env --format fish | source
PowerShell ($PROFILE):
Invoke-Expression (atmos toolchain env --format powershell)
CI/CD Integration
GitHub Actions:
- name: Setup Atmos Toolchain
run: |
eval "$(atmos toolchain env)"
terraform version # Uses toolchain version
GitLab CI:
before_script:
- eval "$(atmos toolchain env)"
Docker Integration
RUN atmos toolchain env --format dotenv >> /etc/environment
Notes
- The command reads tools from your
.tool-versionsfile - Only installed tools are included in the PATH
- The generated PATH prepends toolchain paths to your existing PATH
- Each output format is optimized for its target environment:
- bash: Single-quoted export statement with proper escaping
- fish: Space-separated paths with
set -gxsyntax - powershell: Double-quoted assignment with PowerShell escaping
- dotenv: Compatible with
.envfile parsers - json: Structured data for programmatic use
- The command respects the
--toolchain-pathflag andATMOS_TOOLCHAIN_PATHenvironment variable