Adopted for Elixir from Scott Hanselman's blog post for Rails
Now that WSL 2 is available (currently via Windows Insider Program), we can us it in combination the VSCode Remote-WSL plugin to develop in Ubuntu, and not worry about all the things that make developing on Windows frustrating.
Setting up Windows 10
First, you need to make sure you're running Windows 10 Version 18945 or greater. As of this writing, you need to join the Windows Insider Program and follow the instructions to enable it in Windows 10. I chose the "fast" Insider setting for my machine. This step takes a little while to download and reboot.
Enable WSL 2 and Ubuntu
Open PowerShell in admin mode (Right click and "Run as Administrator"). Then, run:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Open the Windows Store and install Ubuntu or your Linux distribution of choice if you're feeling saucy.
Once that's done, you should be able to see it in PowerShell using:
PS C:\Users\Aaron> wsl --list -v NAME STATE VERSION * Ubuntu-18.04 Running 2
Also, go install Windows Terminal. It's pretty and gives you a nice shell for installed distros.
Now to install all the things
Now in your beautiful new Ubuntu terminal, start by installing Elixir! From the Elixir install page:
wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && sudo dpkg -i erlang-solutions_2.0_all.deb sudo apt-get update sudo apt-get install esl-erlang sudo apt-get install elixir
To test it out, run
mix new myapp . You can actually run
code myapp from this folder and it should launch VSCode with the Remote-WSL enabled.
Extra: install Phoenix dependencies
Now we can use iex straight from the built in VSCode terminal, all with tab-completion, pretty colors, and much less
iex --werl -S mix flags!
I wrote down all these steps from memory, so if I forgot something please let me know!