xenv
xenv is a local development environment and SDK activator.
It manages:
- SDK/toolchain discovery and activation, such as Go and Node.js
- Environment variables
PATH entries
- Project-local environment state through
.xenv.toml
- Shell integration for bash, zsh, PowerShell, and cmd/clink
Install
go install github.com/inhere/xenv/cmd/xenv@latest
Quick Start
Initialize configuration:
xenv config init
Enable shell integration.
Bash:
eval "$(xenv shell --type bash)"
Zsh:
eval "$(xenv shell --type zsh)"
PowerShell:
Invoke-Expression (& xenv shell --type pwsh)
Index locally installed SDKs:
xenv sdk index
Other equivalent commands:
xenv sdk refresh
xenv sdk scan
List configured SDKs:
xenv sdk list
Show or locate a specific SDK:
xenv sdk where go:1.22
xenv sdk which go:1.22
Check project tool requirements from .xenv.toml:
xenv check tools
Activate a version:
xenv use go:latest
xenv use node:20
Set environment variables:
xenv set APP_ENV local
xenv unset APP_ENV
Manage PATH:
xenv path add ./bin
xenv path remove ./bin
Project State
Use -s or --save to save changes to the nearest .xenv.toml file:
xenv use -s go:1.24
xenv set -s APP_ENV local
xenv path add -s ./bin
Example .xenv.toml:
paths = [
"./bin",
]
[sdks]
go = "1.24"
node = "20"
[envs]
APP_ENV = "local"
Optional project tool requirements:
[tools]
rg = "*"
golangci-lint = "latest"
Configuration
Default configuration path:
~/.config/xenv/config.yaml
Default state files:
~/.config/xenv/global.toml
~/.config/xenv/session/<session_id>.json
Local SDK index:
~/.config/xenv/sdks.local.json
Development
Run tests:
go test ./...
Build:
go build ./cmd/xenv