Introduction & Concepts

menv is a modern, performant, and human-friendly alternative to the traditional module save command. Designed for High-Performance Computing (HPC) environments, it allows you to freeze Lmod/Tcl module states with unprecedented granularity and transparency.

Zero Overhead

Written in static Go, menv uses no daemon. It communicates directly with Lmod at native speed for instantaneous execution.

Atomic Snapshots

Your environments are stored in readable YAML in ~/.menv/. No more opaque binary files.

Installation

Deployment is designed for the user space, requiring no root privileges on the cluster.

# Automatic download and installation
curl -sSL https://raw.githubusercontent.com/Thedtk24/menv/main/install.sh | bash

The binary is installed in ~/.local/bin/menv. Make sure this directory is in your $PATH.

Auto-Load & Shell Hooks

The "magic" of menv lies in its ability to recognize your working context. By enabling the hook, menv will automatically load the environment linked to a project as soon as you enter its directory.

# Add the hook to your shell (Bash or Zsh)
menv hook >> ~/.zshrc
source ~/.zshrc

During a cd, menv looks for a .menv.lock file. If it exists, it restores the entire software stack without manual intervention.

Snapshot Structure (YAML)

Here is what a project's frozen state looks like. This file guarantees the scientific reproducibility of your computations.

example_project.yaml YAML
name: DeepLearning-V1
created_at: 2026-03-29T22:15:00Z
menv_min_version: 0.1.0

modules:
  - gcc/11.2.0
  - cuda/12.1
  - openmpi/4.1.5
  - python/3.10.8

env:
  OMP_NUM_THREADS: "16"
  PYTHONPATH: "/home/user/custom_libs"
  CC: "gcc"

Command Reference

menv save & load

Freeze and restore your environments.

menv save training-gpu

Captures the current modules in a snapshot named "training-gpu".

menv load training-gpu --script

Restores the environment. The --script flag generates shell commands without executing them.

Snapshot Management

Command Description
list Displays a table of available environments.
delete [name] Permanently deletes a YAML snapshot.
rename [old] [new] Renames a snapshot file.
edit [name] Opens the snapshot with $EDITOR.

Diagnostics & Portability

menv doctor simulation-v3

Checks if each module in the snapshot is available on the current system. Crucial before launching a SLURM job on another partition.

menv diff production-env

Compares your current session with the snapshot. Displays missing modules or different versions.

Collaboration & Git

The recommended workflow for research teams.

Share
menv export simulation

Creates a local .menv.lock. To be tracked with Git.

Retrieve
menv import

Imports the current .menv.lock into your global storage.

Quality of Life

# Generate shell completion for Zsh
menv completion zsh > /usr/local/share/zsh/site-functions/_menv