With the release of the Windows 10 Anniversary Update, running Ruby, and by extension, Rails under Windows just got significantly easier thanks to Windows Subsystem for Linux (WSL). WSL provides a Linux environment similar to ubuntu without the need for a virtual machine. The advantages to using WSL are typically better performance along with better gem compatibility. In addition, many of your favorite Linux commands work on WSL. In this article we will show you how to install and configure Ruby using WSL. Before we begin, just remember WSL is still in beta so you might run into issues, but it works great! Let's get started.

WSL Installation

The first thing we need to do is make sure that we are running the Windows 10 Anniversary Update. To determine this, simply push the Windows key + r The run dialog will pop up. Type winver and push enter. The version listed should be equal or greater than Version 1607 (OS Build 14393.10). See the screenshot below for an example. If yours is lower, run Windows Update and grab the latest updates for your machine. Once the version is equal or greater, you are ready to continue.

Windows Version 1607

Next, you will need to enable developer mode. To do this, open up the Settings application and click Updates & Security. Then click the link on the left that says For developers. Next click the Developer mode radio button. See the screenshot below for details. You may be prompted to reboot. Once rebooted, continue the directions below to install and configure bash and the Linux subsystem.

Windows Version 1607

Bash Setup

Windows Version 1607

Now we need to configure bash and the Linux subsystem. To do this, open up the run dialog using Windows key + R and type cmd and then push enter. In the command prompt that pops up, type bash. You will then be prompted to agree to the license agreement. Push y if you accept the terms.

After a bit of time, things will be set up and you will be prompted to pick a username and password. After that, you should get a bash prompt. We are now ready to install RVM, and then Ruby!


For this article we will install RVM in order to more easily manage Ruby. You could also use Rbenv or even just do apt-get install ruby if you wanted, but in this article we will use RVM to make maintaining our Ruby installation much easier. To install RVM, simply run the commands listed below in your bash terminal window:

Terminal Commands:

gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL | bash -s stable

After a bit of time RVM will be installed. Next we need to add a line to our .bashrc file to initialize RVM when we load bash. To do this, run the command listed below.

Terminal Commands:

echo "[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*" >> ~/.bashrc

Great, now it's time for Ruby. Run the following commands to install Ruby 2.3.1.

Terminal Commands:

source ~/.bashrc
rvm install 2.3.1

RVM will do some stuff, and ask you for your password. Enter the password you set up earlier, then push enter. You will likely be prompted 2-3 times to enter your password. The prompts might be hard to read (they were on my machine due to a weird terminal corruption glitch) so if it appears stuck, try typing your password and pressing enter. Eventually Ruby should be installed. Now run the following commands to set Ruby 2.3.1 as the default and update RubyGems.

Terminal Commands:

rvm use 2.3.1 --default
gem update --system
gem update

Once those commands are finished, we are ready to install Rails! Yay!

Rails Installation

Installing Rails is pretty straightforward. Just run gem install rails and wait for it to complete and you are off to the races! One gotcha to look out for, if you have an issue with bundler blowing up, running the following command should fix it:

Terminal Commands:

chmod +t -R ~/.bundle

Some other notes:

  • You can install git with sudo apt install git
  • You have to use a javascript runtime. You can use therubyracer, just uncomment out the gem 'therubyracer', platforms: :ruby line (should be around line 17) in your Gemfile and run a bundle install.
  • You will probably have issues with Rails 5's new evented file checker (the error manifests itself when you start a Rails server or console), to fix this, edit config/environments/development.rb and comment out the line that says config.file_watcher = ActiveSupport::EventedFileUpdateChecke. It is at the very bottom of the file.
  • It's best to disable spring, since it doesn't appear to work as of this writing. To do this, you can comment the gem out of the gem file and regenerate your binstubs if necessary by running rails app:update:bin
  • You can access the Windows filesystem via /mnt/c or you can substitute c with any drive letter to access your other drives.
  • You may wish to create a symlink to your Documents folder in your Windows environment. To do so run the following command: ln -s /mnt/c/Users/<USERNAME>/Documents ~/Documents. Make sure to replace <USERNAME> with your username.
  • The WSL is powered by Ubuntu, you can sudo apt install whatever you want.
  • Sunspot Solr doesn't appear to work at the moment. I am currently looking into this. In addition, you may have issues with certain gems.

Feel free to leave a comment if you have any questions or concerns, thanks for reading!