DEV Community

loading...
Cover image for The "Mac Guy" Guide to Windows Development

The "Mac Guy" Guide to Windows Development

James Walsh
I live & work in Salt Lake City as a full-stack engineer. I love being outdoors, synthwave, & playing video gamesπŸ•Ή
・Updated on ・5 min read

I've been writing NodeJS on a 2016 Macbook Pro since well... 2016. And the experience has been gr8. Except for one small problem....

 Gaming on A Mac

I am an avid PC gamer. And I'm not holding my breath for a "Gaming Macbook Air" to come out any time soon... Beyond that, I also love building PCs. I know each and every component in my gaming rig because I hand picked everything. There is a certain craftsmanship aspect to it that has always intrigued me.

When I come home at the end of the day and need some time to decompress 2 things come to mind. Do I want to pwn N00bs, or work on side projects? Depending on my answer I'll be on entirely different hardware, which SUCKS. So for years I've been trying to make my experience at home with gaming & writing Node just a bit smoother.

The fact remains that beyond gaming there may be many reasons why you are interested in moving to Windows. This is my journey πŸš€.

The Alpha Solution: "Cordy McCord Face"

Dongle Hell

The alpha solution is one I'm pretty sure many reading this article already do or know... I call this solution "Cordy McCord Face". What you do is buy a nice laptop stand, a display switcher, and a USB hub that connects to a central keyboard and mouse. That way you can dock your MacBook, press 3 buttons total (switch display, switch USB, power on device) and BOOM. Now you're cooking with avocado oil, and can πŸ‘ "seamlessly" πŸ‘ switch πŸ‘ between πŸ‘ your πŸ‘ gaming πŸ‘ rig πŸ‘ and πŸ‘ mac.

Cordy McCord Face Problems

If you like to re-arrange your office, ever move, have the ports on your laptop change, or have lots of dongles... it can just be a huge pain. Cable management also sucks if you need to have your office look "clean".

The Beta Solution: Dual Boot

Dual boot Ubuntu (or some other distro). The thing that makes NodeJS development so great on Mac is because Linux & Mac are so closely related. After all, MacOS is Unix based. I love using tools like zsh, and most of the dependencies I need for app development are available via homebrew or a simple apt-get. So I felt like I would feel right at home on Ubuntu.

Dual Boot Problems

Let's face it. No matter how good the Linux desktop environment is getting, it will never be as polished as Mac & Windows. Maybe that will change some day. I hope so. I personally ran into an obscure issue with Grub, where it would reset my Ubuntu OS instance to a fresh install whenever I switched between operating systems. Ugh... I'm sure there was a solution. But I dont want to spend time debugging those things. Those are issues I know I will never have on Windows or Mac. And if I'm going to write code on my PC the development experience needs to be just as good as Mac otherwise I know I won't do it.

The Solution: Going All In On Windows

For me to go all in on Windows I needed a few things to happen.

  1. I needed to be able to usebash, or even more preferable: zsh with oh-my-zsh
  2. I needed all of my editor settings to seamlessly transfer over.
  3. I needed Node through Node Version Manager
  4. I needed Yarn for package management.
  5. I needed Docker.

The Shell

The best part about going all in on Windows, is that I actually bypassed Windows all together. My development environment is totally isolated from my gaming environment.

  1. Download the Ubuntu app from the Windows Store. Once this install is complete, you will have the Windows Subsystem for Linux running on your PC. (WSL also supports a handful of other distros, I just prefer Ubuntu)

WSL Distro Choices

  1. Install the new Windows Terminal app from the Windows Store. Windows Terminal App

The new terminal app is sleek. It's minimal, it stays out of the way, it actually supports re-sizing (cough cough command prompt), and here's the best part... If you have WSL installed it has automatic support for WSL. Just open a new WSL tab and boom. You're running Linux bois.

Drops Mic.

Please note that the Terminal app is still in Preview. I haven't had any issues with it as of 08-28-2019.

  1. From there the rest was history. I could fly free. I followed the Ubuntu specific guides for installing docker, git, yarn, node version manager, and all my other dependencies. sudo apt-get worked great with no hiccups. I tried to find things to poke at, but in my personal experience things worked exactly the way they did when I was using the terminal in Ubuntu natively.

The Editor

I use VS Code. But I had so many small details configured just the way I wanted on Mac that I didn't want to have to setup again.

I discovered a handy extension in the marketplace called Settings Sync that has worked wonders.

Because all settings in VS Code eventually become some sort of json object. What Setting Sync does is save your VS Code Settings to a Github Gist. You can then push settings up to a gist and pull settings down to a new editor instance on a different machine. It's a thing of beauty.

Potential "Gotchas" 😳

  1. If you're coming from Mac/Ubuntu then all of your line endings are LF. VS Code uses CLRF on Windows by default. You will want to make sure you go user settings and set files.eol: 'lf'
  2. The code command works great inside of WSL. If you are using Webstorm, or a different IDE, it can be a bit tricky to setup commands in your path to be able to open up the IDE from the command line.
  3. You may want to set up symlinks from /mnt/c/** -> your User directory in Windows so that you can find your files inside of the File Explorer.

TLDR;

  1. Use WSL
  2. Use the new Windows Terminal App
  3. Use VSCode.
  4. Switch between gaming & coding like an absolute bad ass.
  5. Profit.

I had such a great experience switching to this setup that I was even able to generate a super small portfolio site completely in windows with my Mac tightly closed in my backpack. I took plenty of Overwatch breaks because for the first time... I could.

Discussion (4)

Collapse
dwd profile image
Dave Cridland

Two helpful tips:

1) You can get at files inside the Linux bit easily with File Explorer - on WSL1, just run the Explorer.exe from the WSL1 prompt. For WSL2, if you're doing the bleeding edge thing, just run it up normally and type \\wsl$ into the location bar and prepare to be amazed. (If WSL is running, anyway).

2) You know Linux has Steam, right? It plays many games pretty well. So does Mac, and you can stream from one to the other. But yeah, for real gaming I'd stick with Windows.

Collapse
jimboslicethat profile image
James Walsh Author

Fun fact, I’ve actually tried SteamLink (streaming from one device to the other) and I’ve tried steam on all platforms and Battlenet for Mac. Gaming on other platforms is definitely picking up speed. But I built my current PC specifically with PC gaming in mind, which IMO is the best possible gaming experience.

Collapse
nans profile image
Nans Dumortier

Hey !
I remember trying WSL, and had struggle configuring extensions on Visual Studio code, with for example ESLint which needs node and ESLint installed on your computer to be able to run.
How did you manage that ?

Collapse
jimboslicethat profile image
James Walsh Author

Hey! I forgot to mention this piece, I will try and update the blog post in the near future. I believe what you are looking for is the Remote - WSL extension. It's currently in Preview but is working really well from my experience with it thus far.

In your specific case that should tell VS Code to look at your node modules/node installation inside of WSL rather than Windows.

Forem Open with the Forem app