The Journey from Windows to macOS and back to Windows…

Ben Braunstein
7 min readJan 5, 2020

Since I was a young child, I was blessed to have the opportunity of having personal computers in my home. I loved everything about them. Using them, fixing them… and sometimes breaking them. The PCs in my home started with Windows XP, next up was Vista and eventually Windows 7 (my parents never wanted to upgrade to Windows 10).

Throughout my life I got to learn the in’s and out’s of Windows and although I did very minor development work on it at the time, it was simple enough for me to use. Unfortunately, I never really had the opportunities to use a Mac and learn macOS. The extent of my macOS usage was a matter of minutes at a time when I borrowed a friends MacBook to check my email.

Everybody’s best friend, Clippy.

I decided to pursue Computer Science and attend the Flatiron School’s Immersive Software Engineering Bootcamp. Before I started Flatiron School I was reading over the various things, to prepare for my first day and one of the requirements was a MacBook…obviously this must be a mistake, whats wrong with my current Windows 10 laptop ? Well, to keep things simple for everyone Flatiron requires all students to use Macs. It looked like I would have to learn an entirely new operating system.

I started the bootcamp with my Flatiron-loaned MacBook and started learning the OS and how to use it and it’s terminal to my advantage coding. MacOS is simply a breeze to use for development. We learned back end technologies such as Ruby on Rails and front end technologies like vanilla JavaScript, React.js, Redux.js and more. I never really noticed having major compatibility issues with macOS, everything just seemed to work.

After graduating from Flatiron School, I had to return the loaner laptop and setup my Windows laptop, so I could get up and running developing again. Should be simple, not a single worry in my mind that this would be stop me or slow me down.

Goodbye Apple

I was quite mistaken…it seemed to be WAY more difficult than I could of anticipated and it was definitely not as simple as setting up my environment on macOS.

I already had my editor of choice, VS Code installed so there was nothing else I had to do there. But all the difficulties and hoops I had to jump through to get my environment set up were very stressful and are confusing to the day to day macOS developer. Because, I’m a nice guy I’m not going to make you struggle like I did, I’m going to explain what I did to set up my development environment on Windows, emulating the environment I had on macOS before.

How to set up your environment to develop using Rails and React using WSL 2

Firstly, lets talk about what WSL is and why you are going to want to use it if you are a Windows Developer.

WSL 2 or the Windows Subsystem for Linux 2 lets developers run ELF64 Linux Binaries on Windows with full system call compatibility. Unlike WSL 1, which was interpreting the Linux commands into Windows compatible ones essentially, WSL 2 uses a real Linux Kernel, built by Microsoft.

According to Microsoft, WSL 2 uses the latest and greatest in virtualization technology to run its Linux kernel. Unlike most Virtual Machines, WSL 2 takes up very few resources, is super quick to boot up and is not isolated from the rest of your Windows system as it has full access to your Windows files (although it is much faster when you keep files in your Linux file system).

If the above was too confusing for you, it lets you run a Linux command line inside of Windows 10. Linux is far easier to use for development than Windows with much greater overall compatibility and is much more similar to macOS development than Windows is.

So lets get started on how to get set up with WSL 2.

  1. Have your Windows 10 build on Build 18917 or higher. At the time of writing, you need to join the Windows Insider Program to upgrade.

You can check your Windows 10 Build by opening command prompt and typing ver.

To become an Insider you need to go to this link and press “Become an Insider”.

Then you need to log into your Windows account (it must be the same account you use for login on your Windows Desktop or Laptop) and click through any prompts to become an insider. Then on your machine, head over to your Windows Settings > Update & Security >Windows Insider Program and select either the Slow or Fast update branch (the fast branch will give updates very frequently, Slow is recommended).

Then head back over to Windows Update and hit Check for updates or if it requires restart hit that.

Keep installing updates and restarting when necessary until there are no more updates. Check your build to ensure you are on the latest build.

** If you have games installed that use BattlEye’s anti-cheat system (ex. Fortnite) you may need to uninstall BattlEye using this app, due to an incompatibility with the new Windows build.

2. Enable the Virtual Machine Platform and WSL (also enable virtualization in your BIOS)

Open up PowerShell as an administrator and run the following two commands

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Then restart your machine and enter your system’s BIOS. Every machine has a different BIOS and most name virtualization different things, but what it does is allow your processor to run virtual machines (which is what WSL 2 uses as stated earlier). Some common names are VT-d, VT-x or AMD-V, but there are a slew of other names and places for this setting to be hiding. Here is a resource that may help if you can’t enter your BIOS or cannot find the setting to enable. Ensure you save your changes when exiting the BIOS.

3. Install a Linux Distro

Head on over to the Microsoft Store and search for Linux and install a Linux Distribution you want to use. Ubuntu is a simple choice, but there are many others as well. Install the distribution and launch it once its finished installing. It will ask you for a new UNIX username so enter one and create a password. I also recommend downloading the Windows Terminal app from the Microsoft Store as well as to use as your new command-line application.

4. Enable WSL 2 with your Linux Distro

Open CMD and check your Distros installed and if they are running in WSL 1 or 2 using the command

wsl -l -v

Assuming your version is WSL 1 you will have to run the command

wsl --set-version <Distro> 2

Replacing <Distro> with the name of your Linux Distro. This may take a few moments to execute, however once complete you have WSL 2 up and running, with a Linux filesystem that can be accessed from within windows.

5. Install and set up homebrew, RVM, bundler, rails and node, npm and npx.

Run the following commands in order:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
curl -sSL https://get.rvm.io | bash
source ~/.bash_profile
rvm install 2.6.1
rvm use 2.6.1 --default
gem update --system
gem install bundler
gem install rails
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bash_profile
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"' >> ~/.bash_profile
source ~/.bash_profile
nvm install node
nvm use node
nvm alias default node

6. Start Developing!

Now that you have rails and npx you can use both commands just as you would on macOS

rails new app_name

and

npx create-react-app appName

7. Extra (Optional) Steps

  1. WSL 2 has access to the Windows file system and applications. For example you can use the command to pull up your Linux director in the Windows file explorer
explorer.exe .

2. PostgreSQL is necessary if you are interested in hosting your projects on Heroku. If you want PostgreSQL you need to run the commands

sudo apt update
sudo apt install postgresql postgresql-contrib

Then you should create a new PostgreSQL role

sudo -u postgres createuser --interactive

Then it will ask for the name of the role and you can select the same name as your Unix name if you prefer to keep things simple.

PostgreSQL is now installed and configured. The only other thing you need to know is that you will need to start the PostgreSQL server before you can use it (also you can stop the server when you are not using it).

To check the server status:

service postgresql status

To start the server:

sudo service postgresql start

To stop the server:

sudo service postgresql stop

3. VSCode has an extension called Remote WSL. It is very useful and I recommend you install it.

4. Git needs to be configured and linked to your github profile using this as a guide

--

--