How do I access Linux binaries from Windows when using WSL?

1.2k views Asked by At

I'm experimenting with the new Windows Subsystem for Linux as a way to develop Rails applications in Windows. I have WSL installed and I have Ruby in it but how do I use that Ruby from a Windows GUI application, specifically, RubyMine:

enter image description here

This is so I can easily start rails, run tests, etc.

2

There are 2 answers

1
belzebu On

If anyone is wondering how this can be done at this time with the latest version of Ruby, there is a WSL connector for the remote repo of ruby.

Ruby in WSL accessed from RubyMine on Win10Pro

3
Rich Turner On

[Update 2020-10-30] Updating the response below as a lot has changed and improved since my initial reply in 2017

The awesome team at JetBrains have enabled RubyMine to talk to WSL via SSH and to use the "remote" Ruby interpreter, and even debug Ruby code running in WSL! :)

Also, in Windows 10 1903, WSL provides the ability to access Linux distros' filesystems from Windows via the \\wsl$\ pseudo-UNC path.

In Windows 10 2004, WSL added a Linux icon to File Explorer making it easier to discover this pseudo-UNC path.

So, in Windows 10 >= 1903, Windows apps, editors, IDEs, etc. can also access files stored in, for example, \\wsl$\Ubuntu\...!

Notes:

  1. Accessing files in Linux via \\wsl$\... will be slower than accessing files locally because file IO requests have to be marshalled back and forth via a 9P fileserver. If you intend on accessing files intensively, we recommend storing the files in the filesystem closest to whatever you'll be using to access those files most intensively.
  2. Thus ... while you can access files directly via the pseudo-path, using WSL integrations built-in to tools like RubyMine, VSCode, Visual Studio, etc. should be preferred if available.