Developing Magento 2 on a localhost machine (includes how-to)

I regularly get asked “How to install and setup Magento 2 on a Windows/Mac machine”. So, I figured I’d put this post together as a sort of waypoint.

Do you recommend running Magento 2 on a Windows/Mac machine ?

Simply put, no. Unless of course you already have a positive experience working in this type of environment with anything other than Wordpress (which will run on anything). In which case, you’re probably not even reading this.

Let me explain… When I first started using Magento 2.0.x, I tried to set it up on Windows using Ampps and Wamp. But for the life of me I couldn’t get it to work. When I tried again on an actual Linux server, it was a much smoother experience.

It turns out, that I’m not the only person who runs into issues setting up on a local machine. For whatever reason Magento 2 and local development don’t go together very well. Everyone appears to experience these different “ghost in the machine” issues. So, you end up getting incredibly frustrated trying to get Magento to just run as opposed to simply using it.

Sometimes, you’ll get through the installation process and think you’ve won… Only to fall down weeks later the next time you attempt to run an update or some other process.

Working with Magento 2 is difficult enough without trying to debug environment issues at the same time.

Surely there must be a way?

Everyone has their reasons for working locally. But luckily, I do have one recommendation. It’s unlikely that I’ll ever do a tutorial on the topic because it’s outside the scope of what we cover here. Remember, this is a Magento Community and not a Server Stack Community.

Look into something called VirtualBox. I haven’t used it in years, but I know it’s very popular in the Developer Community. The software can be ran on Windows/Mac and allows you to virtualise another Operating System that you can interact with - in its purest form.

So, in your case you’d want to install the Ubuntu Operating System. Then you can interact with that environment as is you were actual connecting to (and working on) a genuine web server. I would highly recommend you learn more about this if you want to work locally.

Update: The following tutorial is now available for those who want to work locally: How to install Ubuntu Server 18.04 on Windows 10 (VirtualBox)

Here are some useful external links to learn more: