Elixir version manager for Windows?

Background

I am trying to develop an elixir desktop app for windows. While installing a static version of Elixir can help me for a while, I often try new versions and I like to keep my projects up to date. So clearly I need several versions of Elixir as I have multiple projects.

Problem? I use Windows…

Research

Normally I would code in some Linux variant, install asdf and be happy with it.
However asdf does not have support for Windows. If it supports Windows then it is not documented in their official webpage.

https://asdf-vm.com/#/core-manage-asdf\

To try an find an alternative I read a few posts about which Version Managers were the most popular within the community:

However, most of them offer solutions for Linux and MacOS only.

To be fair, there was a PR to add support to asdf for Windows, however I found no documentation online on how to make use of this to setup a windows machine:

For those of you wondering, I have installed Elixir in my machine via chocolatey:

Which is the closest thing to Linux I can get on a Windows system. If chocolatey had more versions of Elixir perhaps I could consider this an option, unfortunately they only offer one.

Questions

  • Does anyone know of a working version manager for Windows?
  • If not, how can I install asdf in Windows?
1 Like

You say you’re working on a Windows desktop app, so I guess that might be why you’re not using WSL.

If (and I realise this is really more than one biggish ‘if’ so may not be relevant) your main need for Windows Elixir/Erlang is a single desktop app project, you could stay on the latest stable versions on Windows, and use WSL (where you can install asdf) for everything else.

Using WSL is not an option here, as I need to compile and release everything for Windows. If Linux was an option, I would have used a VM. Unfortunately, it is not.

I did write a Scoop manifest for something of mine a long time ago. I don’t know much about it but remember that it was pretty straightforward json, and Scoop supported some common installers (at least msi & innosetup). Perhaps that could be an option for you if you’re lucky the erlang & elixir install packages are fairly standard. It’s a bit of a rabbit hole to have to go down, but might be worth considering if nothing better crops up.

Scoop custom elixir manifest:

{
    "homepage": "https://elixir-lang.org/",
    "version": "v1.12.0-rc.0",
    "depends": [
        "erlang",
        "vcredist2013"
    ],
    "url": "https://repo.hex.pm/builds/elixir/v1.12.0-rc.0-otp-23.zip",
    "hash": "3ed75a05fe5733b30e9cafa6f59b8591c43ff64eee12c8e5d27ddfb9e25bee73",
    "env_add_path": "bin",
    "checkver": {
        "github": "https://github.com/elixir-lang/elixir"
    },
    "autoupdate": {
        "url": "https://repo.hex.pm/builds/elixir/v$version-otp-24.zip"
    }
}

install & uninsall with Scoop is a charme.
But it doesn’t really help out of the box to use different Elixir vesions per project basis.

Teaking the scoop used shims which are added to path could probably be a fast way to change global used version. Same for Elixir & Erlang.

Having in mind scoop will not help with multiple version management, I’d say this is also not a tool that would solve my problem.

Scoop will not solve it out of the box.

But if you maintain a set of custom manifests with the desired versions
and if you tweak somehow which version will be abailable in path,
it could possibly be the thing that let you change the versions globally most quickly.

Correct me if I am wrong, but wouldn’t that be the equivalent of installing a different elixir version from scratch every time I have a project that needs a different one?

No. Not in my point of view.
You should be able to install multiple versions from custom scoop manifest files.
And then only, as example now, rename the desired version within the scoop shims folder.
Then in a new shell the desired version should be available,
as scoop added the shims folder to windows path.

But different approuches would probably work also.
Scoop does only symlink the latest installed versions to a current link folder.
So it does not uninstall old versions automatically, as its always only a linked potable installation.

I’ve got half a dozen Erlang installations & builds that I switch between manually by setting the windows PATH variable. Not very convenient either. Let me know @Fl4m3Ph03n1x if you find a good windows tool.

2 Likes

Just in case anyone revisits this via a search.

Scoop does handle multiple versions quite nicely (see FAQ · ScoopInstaller/Scoop Wiki · GitHub). Whoever looks after the scoop elixir & erlang manifests is doing a great job of keeping it up to date.

The major limitation compared to asdf is that scoop doesn’t handle per-project version configuration, so you have to scoop reset [app]@[version] to switch the version globally.

5 Likes