Using direnv to manage tool versions

2019-01-30 17:08:00 +0000

At Electric Imp, we use a variety of different languages, and each project might be using a different mix of versions.

Until recently, we’ve been using kerl to manage Erlang versions, kiex to manage Elixir versions, rvm to manage Ruby versions and nvm to manage node versions. We’ve also been using virtualenv to manage Python 2.x virtual environments. We don’t deliberately manage Go versions (yet).

Yes, we do use all of those languages – and more – at Electric Imp.

For experimentation, I also have Rust, Haskell and OCAML installed on my development PC. These are out of scope (for now).

But: kerl, kiex and nvm only manage the installation of different versions. They don’t automatically switch to the correct version as you switch between projects.

For this, I’ve been using direnv.

But: direnv and rvm don’t play well together.

Our operations – #DevOps – team recently switched from rvm to rbenv, but that only covers Ruby versions. So I decided to try asdf for managing versions for everything.

That … didn’t work out so well.

So I’m going back to direnv, but with some knobs on.

This forms the first of a series of blog posts:

Resources

My .direnvrc file is in my dotfiles repo: https://github.com/rlipscombe/dotfiles/blob/master/direnvrc