LinuxCommandLibrary

plenv

Manage multiple Perl versions

TLDR

Show the currently selected Perl version and how it was selected

$ plenv version
copy

List all available installed Perl versions
$ plenv versions
copy

Set the global Perl version (used unless a local or shell version takes priority)
$ plenv global [version]
copy

Set the local application-specific Perl version (used in the current directory and all directories below it)
$ plenv local [version]
copy

Set the shell-specific Perl version (used for the current session only)
$ plenv shell [version]
copy

Display help
$ plenv
copy

Display help for a command
$ plenv help [command]
copy

SYNOPSIS

plenv command [options]

PARAMETERS

commands
    List all available plenv commands.

init
    Initializes plenv in your shell. Add the output to your shell's configuration file (e.g., .bashrc, .zshrc).

install
    Installs a Ruby version using ruby-build.

uninstall
    Uninstalls a specific Ruby version.

versions
    Lists all Ruby versions known to plenv.

version
    Displays the currently active Ruby version.

global
    Sets the global Ruby version.

local
    Sets the local Ruby version for the current directory.

shell
    Sets a shell-specific Ruby version (overrides local and global).

rehash
    Updates plenv's shims after installing new Ruby versions or gems.

prefix
    Display plenv install prefix.

doctor
    Verify plenv installation and environment

hooks
    Lists available hook scripts

help
    Displays help information.

DESCRIPTION

plenv is a lightweight Ruby version management tool.
It allows you to easily switch between multiple Ruby versions and manage gems on a per-project basis.
Unlike other Ruby version managers like RVM or rbenv, plenv does not hook into your shell; instead, it works by modifying the PATH environment variable.
This makes it faster and less intrusive than other solutions.
plenv intercepts Ruby commands using simple shell scripts, determines which Ruby version has been specified for the current directory, and then passes your commands along to the correct Ruby installation.
It relies on shim executables and version files to manage the ruby environment.
This keeps the base system Ruby installation clean and avoids conflicts between different projects.

CAVEATS

Requires ruby-build to be installed for installing new Ruby versions.
Requires shell restart or new terminal to load plenv initial configuration.

UNDERSTANDING SHIMS

Shims are lightweight executables that plenv places in your PATH. When you execute a Ruby command (like ruby or gem), plenv finds the appropriate shim, which then executes the command using the correct Ruby version for your project. This mechanism allows plenv to isolate different Ruby versions.

VERSION FILES

plenv uses version files (named .ruby-version) to determine the Ruby version for a project. This file should be placed in the root directory of your project. The plenv local command automatically creates or modifies this file.

HISTORY

plenv aims to provide a simple and less intrusive alternative to tools like RVM and rbenv. It focuses on minimalism and performance by directly manipulating the PATH instead of hooking into the shell.

SEE ALSO

ruby(1), gem(1)

Copied to clipboard