If you’ve worked with Zeek for more than a few months, you’ve probably lived this: one ~/zeek install, one ~/.zkg, and a constant juggling act every time you need to test a package against a different Zeek version, try a dev branch, or keep a stable release untouched while you experiment. Switching means rebuilding, reconfiguring, or just crossing your fingers.
zenv fixes that by doing for Zeek what venv does for Python: it lets you keep multiple, fully isolated Zeek installs on one machine and pick which one is “active” per shell.
https://github.com/keithjjones/zenv
What it actually does
Each environment is just a directory with its own install prefix and its own zkg state:
zenv new dev
This creates ~/zenv/dev/zeek (an empty install prefix) and ~/zenv/dev/zkg (an empty zkg state directory), then prints the prefix so you know where to point --prefix.
You build Zeek exactly like you always do — zenv doesn’t run configure, doesn’t run make, and has zero opinion about your build flags:
./configure --prefix="$(zenv prefix dev)"
Once it’s built, zenv autoconfig dev wires zkg to that install, and zenv activate dev sets up your shell — PATH, PYTHONPATH, MANPATH, ZEEKPATH, ZEEK_PLUGIN_PATH, all pointed at that one environment. Activation is shell-local, so a second terminal can have a completely different environment active at the same time, with no symlink games.
Switching is a one-liner:
zenv activate default
zenv deactivate
deactivate restores your shell exactly as it was — including leaving variables unset if they started unset.
What it deliberately doesn’t do
zenv never builds Zeek. No configure, no build tool, no build-flag opinions. It’s purely the bookkeeping layer: create the directories, tell you the right --prefix, wire up zkg afterward, and manage your shell’s environment on activate/deactivate. Your build process stays entirely yours.
Already have installs lying around?
zenv adopt brings an existing ~/zeek and ~/.zkg under zenv’s management without touching them. And zenv doctor will diagnose common problems — the wrong zkg winning, packages that seem to have disappeared, plugins that won’t load — for one environment or all of them at once.
Getting started
./install.sh
That’s it — it installs the zenv binary, shell completions, and one clearly marked block in your rc file (with a backup made first). ./install.sh --dry-run shows you what would happen without changing anything.
If you’ve ever lost an afternoon to a Zeek install that quietly broke because two projects wanted different versions in the same ~/zeek, zenv is built to make that problem disappear.
Leave a Reply