Can Windows Replace Your Macbook for Dev? Yes! And it’s quite nice.

Travis Reeder
Travis on Development
5 min readNov 8, 2016

The other day I saw the Microsoft Surface Studio and the new Macbook Pro and I thought: “Macbook Pro for ~$2k that’s almost the same as my current Macbook Pro or that frikin amazing Surface Studio for $3k?”. This sparked my interest in trying out Windows again for development. It’s been a while since I am well aware of the horror involved with modern development on a Windows machine. Windows and modern development (besides .NET and Microsoft tech) do not mix. Or do they?

I started looking around to find out about running Linux on Windows and low and behold, I found the Windows Subsystem for Linux. WSL gives you a full on Linux bash shell inside Windows. So obviously I had to give this a try.

I had a Dell XPS Developer Edition (ships with Ubuntu) that was sitting around collecting dust, mostly because Linux desktops leave a lot to be desired. And when it comes to choosing between a Linux desktop and a Mac desktop, I almost always choose my Macbook. I give Linux a try every couple of years, hoping it’ll be awesome, maybe some new distro will be “the one”, but sadly it’s never quite there. It’s really the little things that get to me, like inconsistent font sizes. Anyways, back to the topic at hand…

I decided to install Windows 10 on that Dell.

Installing Windows

You don’t need a Windows license key to try this out, you can try it for free.

First, sign up for the Windows Insider program at https://insider.windows.com/ . This will allow you to get the latest and greatest Windows, which I don’t think you need, but it will ensure you get the latest Ubuntu for your bash shell.

Download Windows 10 and write it to a USB drive: https://www.microsoft.com/en-us/software-download/windows10ISO

Boot your USB drive (for the Dell XPS, keep pressing the F12/brightness key, without pressing the Fn key) until it brings up the boot menu, choose your USB drive to continue the install process, which is pretty straight forward.

Upgrade Windows so you get Ubuntu 16.04

Now that you have Windows installed, let’s upgrade it to the bleeding edge. This may be an optional step, but I’d recommend doing it, otherwise you’ll get Ubuntu 14.04.

Hit the Windows key and search for “insider”, choose Windows Insider Program Settings then choose Get Insider Builds(you have to have signed up for the program, see above). Then change your Insider level to the Fast ring to ensure you get the latest and greatest. WARNING: Don’t do this unless you are aware of the consequences and are OK with taking risks.

Then you’ll have to wait a bit for it to register. I slept on it and got the update in the morning.

Enabling the Bash Shell

This is where the magic happens. You can find the full instructions to enable the Linux Subsystem here: https://msdn.microsoft.com/en-us/commandline/wsl/install_guide, but the quick version is the following:

  1. Hit Windows key, search for developer, choose use developer features
  2. Click Developer Mode radio button
  3. Now hit Windows key again and search for turn and choose Turn Windows features on or off
  4. Check off Windows Subsystem for Linux then OK
  5. You’ll be asked to restart your computer which you need to do.

After your computer restarts, open a command prompt or PowerShell and run: bash. The first time you run it, it will install the shell. It will ask you what username you want to use, I just put used root to keep it simple and not have to use sudo.

Boom! You have a Linux shell on Windows! Pretty awesome. Type bash whenever you want to use it from now on and it will put you in a bash prompt in the current directory. You can swap in and out of bash really easily.

Now try installing something with apt, like build-essential since you’ll probably be doing some development in this shell.

apt-get install build-essential

Installing Go on Bash on Windows

Download the Linux binary from here then just follow the normal install instructions.

Add the PATH and GOPATH exports to /root/.bashrc.

Put your GOPATH under /mnt/c/Users/WINDOWS_USERNAME/go dir (or something under your username), then you can edit the files with your favorite editor in Windows and use the bash shell to build and run.

Try go version to see that it works:

From there, everything just seems to work.

Using Docker

Docker does not work in the bash shell, so you’ll have to use Docker for Windows. To use Docker for Windows, you need to have Windows Pro because Docker needs HyperV which isn’t included in Home. If you already have Windows Pro, then great, skip the next section.

Upgrade to Windows 10 Pro

If you are just using the Windows Home trial and haven’t activated it, you can upgrade for free.

WARNING: Do not do this if you bought your Windows Home edition, see comments on the article linked below for why.

Follow the instructions here to upgrade to Pro: http://betanews.com/2015/12/21/upgrade-from-windows-10-home-to-pro-using-this-product-key/

Install Docker

Download and install Docker for Windows: https://docs.docker.com/docker-for-windows/

That’s it, pretty straight forward. Run docker info to verify.

Using Docker and the bash shell together

To use these together isn’t too much different than on Mac or Linux, except you’ll have to use the bash shell AND the Windows command prompt or PowerShell.

For instance, you can vendor, build and run your code in the bash shell, then build your Docker containers with PowerShell. The following works in PowerShell just like it does on Linux/Mac.

# Build the binary
docker run --rm -v ${pwd}:/go/src/github.com/treeder/myapp -w /go/src/github.com/treeder/myapp iron/go:dev go build -o bin/bots
# Build the Docker image using the binary
docker build -t treeder/myapp:latest .

The other thing you’ll probably need to learn if you want to use Docker is some basic PowerShell scripting to make scripts for your build process. The good thing is that writing PowerShell scripts is a lot easier (better?) than writing bash scripts.

Conclusion

The thing I love about this is that you get a Mac like experience on Windows, but you now have hardware options! You don’t have to buy a Mac (or settle for a Linux desktop) anymore, instead you can get something like the sweet Lenovo 910 or I hear the Surface Pro 4 is pretty nice.

Well played Microsoft. Well played.

--

--