I am on a Windows machine and I am looking to install the latest version of elixir in it. This is being harder than expected.
Research
Initially I searched for something similar to asdf for Windows, but there is nothing similar for this platform. Scoop is the tool that comes closest, but it requires me to do custom scripts and to learn another tool, both things I am not a fan of right now:
Then I turned to chocolatey:
Which looks perfect, but it is severely outdated, being only in version 11.X
No signal of any updates to come, so this one is out as well.
It looks like there is a version of 12.X, which hopefully uses OTP 24 (my goal):
Questions
However, I am not convinced yet. My only experiences with Docker containers were brutally painful. I understand things have changed in the meantime and that Docker seem to be a solution most developers fight for.
However, I am not sure if investing in this tool (remember, I discarded scoop because I didnât want to invest in it) is going to pay off:
Will I be able to create releases for Windows using a container?
Will I be able to create releases for Ubuntu as well? (I am fairly sure I wonât be able to because my host is Windows, but just confirming)
Do you guys recommend any guides for Windows?
Alternatives
I feel like I am reaching for the bottom of the barrel here. I am honestly running out of options. Any ideas would be welcome.
I donât feel qualified answering all of your questions, but for this one: Using a tool like Docker Desktop you can run both windows images and unix images on a Windows host. As far as I know you cannot manage them at the same time but I frequently switch between âusing windows containersâ and âusing Linux containersâ depending on my current needs
The question you refer to was about installing and managing multiple elixir versions. Here youâre asking about installing the latest version. Iâm a WSL2 user myself, so am not familiar with the windows native tooling, but doesnât the downloadable win32 setup wizard install the latest version as you require?
Elixirâs official site does claim to have a win32 installer. If for some reason itâs problematic, I donât think âuse an entirely different platformâ is the best response.
No, it wont. I develop on windows because I need to compile and release for windows. I can have Ubuntu all day long in a dual boot if I want to. This is not what the discussion is about.
Will I be able to create a release for Ubuntu (that works on Ubuntu) if I use this method?
Can you link me to some resources if you donât mind?
As I explain, the question I refer to was my first attempt at solving this issue. This is another question, therefore I created another post. It doesnât mean however that the knowledge gained from the previous post is not useful. It means I need to refine it more.
Regarding the setup wizzard you mention,it does install a version of elixir 1.12.3, but with OTP 22 (it installs to C:\Program Files\erl10.7):
The latest precompiled erlang version for windows from Erlang Programming Language seems to be 24.0, so if you want a later point release I suspect youâll have to either wait or compile it yourself (which doesnât sound very appealing Iâd agree).
But even if I install Erlang with OTP 24.0, I still think I wouldnât be able to install Elixir from the setup wizzard, as it doesnât give me the choice of selecting which erlang version I want to use. Right?
As in, for example, installing Elixir 1.12.3 with OTP 24.0.
As far as I can understand, the installer simply asks me to install Erlang 10.7 (with OTP 22.X).
The installer is just a convenience to hide the complexities involved for windows users and the (pre-)build versions only support the lowest supported otp version.
Extract and set the bin folder to your windows path
Edit:
Of course you have to take care of the runtime Erlang version installation separately.
No, creating a release on native Windows for Ubuntu wonât work.
But creating a release for Windows within a Docker container wonât work ether in my view.
Been there, done that. There is a fair amount of documented friction running Elixir on Windows - but you can search the forum and make your own opinions about it. IMHO the current experience on *NIX is far better and if you donât have to target Windows, just use WSL instead.
BTW: The question didnât imply he wanted to compile/ release just for Windows. So I think since WSL is part of Windows tooling itâs in fact a valid answer.
Are you doing Phoenix? What are your constraints on compiling a release for Windows if I may ask?
Another option could be reevaluating Docker if you just want to run your code without caring about the platformâs limitations. But this depends on what you need, if itâs an application that youâll have to deploy constantly or if its just a one-off thing.
PS.: I used to use Chocolatey, the maintainer of the Elixir package was looking into adding a CI to generate releases dynamically but I donât know whatâs the status on that. If this is important to you, check with him if you can help.
For elixir-desktop I also needed recent windows binaries, so I did contribute a GitHub CI job for windows some time ago. So you can get the most recent Erlang binaries directly from the official OTP GitHub Repo. Just go to the commit of the release you want, click on the green CI checkmark and choose âartifactsâ from there. E.g. this is the link for the 24.0.5 build:
For Elixir, Iâm not sure whether it changed but if I remember correctly it will just use whatever Erlang version is in your System PATH variable. So if you use windows native just set the path environment variable to the folder where your erl.exe is.
If youâre using msys2 (which I recommend) then you can make the change in your .bashrc
I absolutely agree. However, I do have to target Windows for this project, which is why this discussion was created.
Perhaps I could have made my point more clear. I will take this into consideration next time, thanks for pointing out.
I am doing Phoenix, yes. My constraint is I would have to do it for every new release of erlang/elixir and I am not sure this would be manageable on my side. Compilations rarely go without issues.
There are a lot of good suggestions here, I will try to check some of them.
After that, I downloaded the official version of Elixir for Windows, and configured it to use my already installed version of Erlang/OTP (which it does by default):