You might have dabbled between various version managers of the programming languages that you use. If you have to manage multiple versions of these laguages, you would need to switch between tools, rvm, nvm and gvm or use the
direnv. But with
"Late but latest" -- Rajinikanth
asdf is a pure shell script, and installtion is as simple as put it in a directory, and source it.
$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.4.3 $ # for bash $ echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bash_profile $ echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile $ source .bash_profile $ # for zsh $ echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zshrc $ echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc $ source .zshrc
I use the zsh as the default user shell, so at places where you see this
source ~/.zshrc, and say you use bash, replace it with
Run it to see what Rajinikanth has to say :)
$ asdf version: v0.4.3 MANAGE PLUGINS asdf plugin-add <name> [<git-url>] Add a plugin from the plugin repo OR, add a Git repo as a plugin by specifying the name and repo url asdf plugin-list List installed plugins asdf plugin-list --urls List installed plugins with repository URLs asdf plugin-list-all List plugins registered on asdf-plugins repository with URLs asdf plugin-remove <name> Remove plugin and package versions asdf plugin-update <name> Update plugin asdf plugin-update --all Update all plugins MANAGE PACKAGES asdf install <name> <version> Install a specific version of a package or, with no arguments, install all the package versions listed in the .tool-versions file asdf uninstall <name> <version> Remove a specific version of a package asdf current Display current version set or being used for all packages asdf current <name> Display current version set or being used for package asdf where <name> <version> Display install path for an installed version asdf which <name> Display install path for current version asdf local <name> <version> Set the package local version asdf global <name> <version> Set the package global version asdf list <name> List installed versions of a package asdf list-all <name> List all versions of a package UTILS asdf reshim <name> <version> Recreate shims for version of a package asdf update Update asdf to the latest stable release asdf update --head Update asdf to the latest on the master branch "Late but latest" -- Rajinikanth
Isn't that cool? ;)
asdf works with a plugin model; so the reason it calls itself an extensible version manager. You would first need to install the
$ asdf plugin-add ruby
Once that is done, you could choose the version of ruby you would want to install, lets try to install 2.2.5 and 2.1.9.
$ asdf install ruby 2.2.5 $ asdf install ruby 2.1.9 $ asdf list ruby 2.1.9 2.2.5
You could either set that ruby version as being global or being local to a particular working directory.
global means it is common to all workspaces, its overridden by a
local setting, which could be set at a directory level. Like the following as it is no my system.
$ asdf global ruby 2.2.5 $ cd needs225 $ ruby -v ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-linux] $ cd ../needs219 $ asdf local ruby 2.1.9 $ ruby -v ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux] $ cd .. $ ruby -v ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-linux]
You get the point, I presume?
asdf Nodejs Version
$ brew install coreutils gpg
Install the nodejs plugin, the following worked for me.
$ asdf plugin-add nodejs $ # If the above does not work, try this $ asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git
Import the Node.js release team's OpenPGP keys to main keyring:
$ bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring
Now go ahead, install any version of nodejs, the latest LTS version is 8.11.2, and 6.10.3, so lets pick them up.
$ asdf install nodejs 8.11.2 $ asdf install nodejs 6.10.3 $ asdf list nodejs 6.10.3 8.11.2
As explained for ruby above you could a
global default, and a
local for every directory.
asdf for Go
The installation and setup is pretty similar to above, thats the magic of
asdf, whatever the programming environment, it does work the same. So here are the set of commands, for installing the plugin, install the latest version of go, and slighly more standard version of 1.8.6.
$ # Install the plugin $ asdf plugin-add golang $ # Install golang version 1.10.2 $ asdf install golang 1.10.2 $ # Install golang version 1.8.6 $ asdf install golang 1.8.6 $ # List the installed versions $ asdf list golang 1.10.2 1.8.6 $ # Set the global version to latest version $ asdf global golang 1.10.2 $ go version $ # Set blip's local version as 1.8.6 $ cd blip $ asdf local golang 1.8.6 $ go version
There are at times
asdf will not play well with other version managers, so it best to asdf only, and remove other version managers references.
asdf might not load the right version, and you might have to run the