Skip to content
This repository has been archived by the owner on Jul 2, 2020. It is now read-only.

schultyy/avm

Repository files navigation

avm Build Status

Motivation

If you want to install multiple versions of node.js or Ruby on your machine, there are mostly tools available written in Shell (nvm, rvm, rbenv). On the one hand that's nice because it's easy to install on Unix machines, but on the other hand it's not usable on Windows machines and Shell code is not easy to understand. At least for me. Especially the latter reason is important for me. It is not that easy to find a person who can maintain Shell code and also it's not that easy to figure out where to look when something goes wrong. Since Rust has become stable, I took the opportunity and began to write a replacement tool. It's called avm as abbreviation for "All version manager". Right now it manages:

  • ✅ node.js
  • ✅ Ruby

The other advantage is since Rust runs on many platforms, there's also the possibility to run avm on machines without Bash e.g. Windows.

Installation

If you use Cargo 0.6.0 (ships with Rust 1.5) you can install avm via:

$ cargo install avm

After installation you need to add avm to your PATH variable as described in After Installation.

Required Packages for installing Ruby

  • zlib development packages (Ubuntu: zlib1g-dev)
  • readline support (Ubuntu: libreadline6 libreadline6-dev)
  • C Compiler (Ubuntu: build-essential)
  • OpenSSL (Ubuntu: libssl-dev, RHEL: openssl-dev, Mac: openssl)

By default, avm uses /usr/include/openssl as a lookup path. If you want to use a custom path, for example to link against an OpenSSL version installed via homebrew, export OPENSSL_INCLUDE_DIR:

export OPENSSL_INCLUDE_DIR="$(brew --prefix openssl)/include"

After installation

After installation finished, you need to make sure that avm is in your PATH. For that you need to append the following line to either ~/.zshrc or ~/.bash_profile:

export PATH=~/.avm/:~/.avm/node/bin:~/.avm/ruby/bin:$PATH

Supported platforms

Right now, it is possible to run avm on the major Linux distributions and Mac OS X. There is no support for Windows right now. See #33 for details.

Upgrading to avm 1.x from 0.6 or before

See https://github.com/schultyy/avm/blob/master/upgrade_notice.md for instructions.

Usage

node.js

Install a new node version:

$ avm install node 4.1.2

Please note, that right now avm installs precompiled versions of Node.js. There is no supported yet for installing from source.

Use 4.1.2 by default:

$ avm use node 4.1.2

Use your system node version:

$ avm use node system

List all installed versions:

$ avm node ls

Uninstall a version:

$ avm uninstall node 4.1.2

Select the node version based on the package.json in the current directory:

$ avm autoselect node

Note that this depends on the engines property set in the package.json. If engines specifies a node version < 4.x, then it checks for strict equality only. It does not support any modifiers like ^ or ranges for these versions.

Ruby

Install a new Ruby version:

$ avm install ruby 2.3.0

Please note, that it installs from source only. It grabs the source tarballs from ruby-lang.org. Right now it installs versions only which do not have a -pxyz suffix in their url.

Use 2.3.0 by default:

$ avm use ruby 2.3.0

List all installed versions:

$ avm ls ruby

Uninstall a version:

$ avm uninstall ruby 4.1.2