A lightweight version manager for TinyTeX (minimal TeX Live) inspired by rbenv. It lets you install multiple TinyTeX releases side‑by‑side, select global or per‑project versions, expose TeX executables through shims, and freeze / restore package sets.
- Install specific TinyTeX release versions (including a rolling daily build).
- Maintain multiple versions concurrently under $HOME/.texenv/versions
- Set a global default or per‑directory local version via .tex-version
- Shims for TeX commands; automatic shim regeneration after tlmgr installs/updates/removals and explicit rehash command
- Execute tlmgr and other TeX tools inside the currently selected version
- Freeze installed package names to tex-require.txt or lock with TeX Live version in tex-require.lock
- Restore installs any missing packages from a requirements file (does not remove extras)
- Repository management for tlmgr:
- Auto-selects an appropriate repository based on TeX Live year (latest tlnet for current year, historic tlnet-final for past years)
- Show current repository and set per-version mirror overrides
- Spawn a shell scoped to a specific TinyTeX version
- Introspection helpers: which/where/whence, root, shims
- Pure Bash implementation; see Requirements
- No modification of system TeX installations
- Operating systems:
- macOS (Darwin): platform "universal-darwin", archives ".tgz"
- Linux x86_64: platform "x86_64-linux", archives ".tar.gz"
- Others are not supported (texenv exits with "unsupported OS").
- Shell:
- Bash >= 4.x
- zsh users can eval the init snippet in their shell profile.
- POSIX sh is not supported.
- Tools:
- curl
- perl with File::Find module (validated at startup)
- tar
- find, grep, awk, diff, cat, mkdir, uname, sort, rm
- Network:
- Internet access to GitHub Releases and API (for version list and archives)
Clone the repository somewhere on your PATH (recommended: $HOME/.texenv):
git clone https://github.com/redpeacock78/texenv.git ~/.texenvAdd texenv initialization lines to your shell profile (~/.bashrc, ~/.zshrc, etc.):
eval "$(~/.texenv/bin/texenv init -)"Open a new shell (or source your profile) then run:
texenv initThis will create the directory structure:
~/.texenv/
bin/texenv
shims/
versions/
config/
texmf/
version
Ensure ~/.texenv/bin and ~/.texenv/shims appear early in PATH (the init - output adds them).
Matches texenv help:
- commands List available commands
- init Initialize texenv environment
- install [version] Install specified TinyTeX version
- uninstall [version] Uninstall specified TinyTeX version
- version Show current TinyTeX version
- versions List installed TinyTeX versions
- shell [version] Spawn a new shell with specified TinyTeX version
- global [version] Set global TinyTeX version
- local [version] Set local TinyTeX version
- repo [options] Manage tlmgr repository
- exec [cmd] [args] Execute command in current TinyTeX version
- rehash Rebuild shims for installed TinyTeX versions
- freeze [options] Freeze installed TeX packages to requirements file
- restore Restore TeX packages from requirements file
- which [cmd] Show path to shim for specified command
- where [cmd] Show path to command in current TinyTeX version
- whence [cmd] Show path to command in all installed TinyTeX versions
- env Display texenv environment information
- root Show texenv root directory
- shims Show executable file(s) from texenv shims directory
- help Show this help message
cd ~/.texenv
git pull --ff-only
texenv rehashList available versions (queried from tinytex-releases):
texenv install --list
# show more (paginated by API):
texenv install --list --allInstall a specific version:
texenv install 2024.09Install / refresh the daily build:
texenv install dailyForce reinstall an already installed version:
texenv install --force 2024.09texenv versionsOutput marks the active one with an asterisk and indicates which file set it (global version or a local .tex-version).
Set the global default:
texenv global 2024.09Set a project‑local version (writes .tex-version in the current directory):
texenv local 2024.11Check the current version:
texenv versionUse texenv exec to run any TeX program inside the active version:
texenv exec pdflatex main.tex
texenv exec tlmgr info geometryBehavior with tlmgr:
- Before tlmgr install/update/info/search, texenv ensures repository configuration (
texenv repo). - After tlmgr install/update/uninstall/remove, shims are regenerated (
texenv rehashinvoked).
Shims let you call commands directly (e.g. pdflatex) once generated. texenv resolves the correct version via TinyTeX-Version and source metadata.
After installs, removals, or tlmgr operations that change available binaries:
texenv rehashShow current repository:
texenv repo -sAuto-selection (default):
- If TeX Live year equals the current year, uses the latest tlnet:
- Otherwise uses the historic archive for that year:
Set a per-version mirror override (persisted):
texenv repo -m https://mirror.example.org/tex-archive/systems/texlive/tlnetMirror overrides are stored at:
- config/[version]/mirror_repo.txt
If the requested repository matches the current setting, the command is a no-op.
Generate a requirements file of currently installed packages:
texenv freezeCreate a lock file including the TeX Live version (first line comment):
texenv freeze --lock
# file header example:
# TeX Live: 2024Files produced:
- tex-require.txt
- tex-require.lock
Restore from whichever requirements file exists (prefers lock):
texenv restoreNotes:
- Installs packages that are listed but not currently installed.
- Does not remove extra packages.
- If the lock file requires a newer TeX Live than the active one, restore aborts to protect compatibility.
texenv envShows:
- Active TinyTeX version
- TEXMF path variables (via kpsewhich)
- Active configured repositories
- texenv-related PATH entries
- Installed versions summary
Spawn a new subshell with a specified version (exports TEXENV_VERSION for the shell):
eval "$(texenv shell 2024.09)"If no version is provided and no shell-specific version is set, it reports the state.
texenv uninstall 2024.09- Local .tex-version in the current or parent directories overrides global version.
- Global version stored in ~/.texenv/version used when no local file found.
- resolveVersion outputs both TinyTeX-Version and TinyTeX-Path (for shell-scoped versions, the path indicates the shell origin).
- versions/[ver] contains the extracted TinyTeX tree (bin/[platform]/... etc.)
- shims/[cmd] are small Bash launchers pointing back to bin/texenv exec
- texmf/ is assigned to TEXMFHOME for user-level additions
- config/ stores internal data:
- cmd_list_cache.txt
- [version]/mirror_repo.txt
- TEXENV_ROOT (default: $HOME/.texenv)
- TEXENV_DIR (defaults to current working directory, used for local version resolution)
- TEXENV_PLATFORM (detected: universal-darwin or x86_64-linux)
- TEXENV_DEBUG=1 enables shell tracing
- TEXMFHOME overridden to texenv’s managed texmf directory
- Delete ~/.texenv
- Remove initialization lines from your shell profile
- Remove PATH entries referencing ~/.texenv/bin and ~/.texenv/shims
- Open issues for bugs or enhancement ideas.
- Submit pull requests with concise commits and description.
- Keep code Bash-compatible; avoid external dependencies.
MIT License. See LICENSE file.
texenv manages TinyTeX distributions non-destructively. It does not replace full TeX Live installations; for advanced scenarios (custom schemes, system-wide install) use official TeX Live tools directly.