Switching to Windows for Local WordPress Development: Part 2

#

Last year when I wrote about switching to Windows for local WordPress development, I hadn’t anticipated how much I would change in the weeks/months to follow. There were several things I wasn’t happy with in my development environment and general workflow – Local by Flywheel was slow, the command line wasn’t quite up to par with what I was used to, and I just felt that there had to be a better way to do things.

In this week’s article, I take a look at some of the changes I’ve made to my Windows development and how they’ve upped my WordPress development game.

What’s Changed in the Last Year?

I originally switched from Mac to Windows because I wasn’t happy with the state of Mac. Macs have always been expensive, but I feel that the quality and bang for your buck has been on a decline in recent years. While they have started improving the quality control issues, for example with the recent improvements to the keyboard on MacBook Pros, they are still very expensive compared to a similarly-equipped Windows machine.

At the same time, Windows has continued making improvements that make life easier for the average developer. Windows Subsystem for Linux has been receiving a steady stream of updates, and it looks as if it’s going to continue to improve. Microsoft has also announced plans to include a full Linux kernel in future versions of Windows 10, a move that will surely attract more developers in the future.

Windows Subsystem for Linux

I spent a lot of time trying to find a good terminal workflow I was happy with. In my post last year, I mentioned that I was using CMDer along with Git BASH, which worked alright for a while. But I eventually wanted something a little closer to what I was used to. I missed using things like OhMyZSH and TMUX, and I couldn’t find a good alternative with the relatively simple CMDer + Git BASH combo I was using.

First I tried running OhMyZsh through Cywigin, CMDer, and Mintty, but it was a ton of setup and overall confusing. I also got the feeling that this setup would be painful to troubleshoot and update in the future.

I then realized that I should probably give Windows Subsystem for Linux (WSL) another shot. I installed Ubuntu and played around with it for a bit before remembering Daniel Iser’s comment on my previous post, in which he recommended a great guide for getting started.

I loosely followed that guide to set up Hyper as my terminal emulator for WSL, and installed OhMyZSH with the great Agnoster theme. Finally, I had a good-looking Linux terminal that did everything I needed it to:

WSL Terminal

Laragon

Another pain point in my old workflow was, unfortunately, Local by Flywheel. It had been my favorite solution for a local development server on Mac, but on Windows, it was very sluggish and not as reliable. It also required Hyper-V to be disabled, which prevented me from being able to install Docker (which is needed for our acceptance tests).

I saw a lot of recommendations for Laragon, so I decided to give it a spin. For those who aren’t familiar, it’s essentially a very lightweight alternative to something like MAMP or WAMP.

Right away I noticed that Laragon was fast. Like, incredibly, unthinkably fast for a local development environment. You click “Start” to start the servers, and the servers have already started. It also offers 1-click installs of WordPress, Laravel, and any other apps or tools you may need for your project.

Starting servers in Laragon

Overall, it does a great job of giving me what I need to get started, and then getting out of the way quickly and letting me focus on my work. Just as a good dev environment should.

Gotchas

Occasionally I’d run into issues where grunt or a shell script would complain about the line endings in a given file. Since Windows will use “\r\n” as a line ending, and Linux will just use “\n”, there can be some conflicts in that sort of situation.

Luckily, I found two ways around this. The first is setting Git to use Linux-style line endings so that whenever a commit is checked out the files have proper line endings.

I also found a handy command line utility, dos2unix, which can convert any files outside of Git into files with Linux-style line endings.

Other than that, I haven’t found any real problems with this setup.

Final Thoughts

These changes to my environment and workflow have made a world of difference in my productivity. I no longer feel like I’m fighting with Windows (maybe because I still get to play with Linux), and as a result of that, I’m able to get a lot more done.

I also get the impression that this is just a taste of the future. With Microsoft having plans to include a complete Linux kernel in future versions of Windows 10, Linux is only going to get faster and more integrated with Windows in the future. I can see many more developers skipping out on paying the premium for a MacBook Pro or iMac since development will be as easy as on any other machine. And needless to say, I don’t see myself switching back anytime soon.

Do you currently develop on Windows? If so, are there any other must-have tools that you’re using? If not, would you consider making the switch now that it’s totally awesome? Let us know in the comments.

About the Author

Matt Shaw

Matt is a WordPress plugin developer located near Philadelphia, PA. He loves to create awesome new tools with PHP, Javascript, and whatever else he happens to get his hands on.