As a WordPress software developer, you might need to set up a development environment for your projects. For example, to develop new plugins and themes, to test new features before they go live, or to perform troubleshooting. The best way to do this is to have an offline WordPress development environment installed on your computer. In this tutorial, I will show you how to set up a local WordPress development environment with Local.
Why I Chose Local to Set Up my WordPress Development Environment
There are several tools available to set up an offline development environment for WordPress, like XAMPP, MAMP, and Local. Over my last eight years of WordPress coding experience, I have used XAMPP for the majority of it. I briefly used MAMP for a few months, and just recently made the switch to Local. I have to say Local is by far the most intuitive and easy to set up app of all of them, and here are the reasons why:
One-Click WordPress Installations
Local, unlike XAMPP or MAMP, was built from the ground up to be a WordPress development tool. So it’s no surprise that it comes with a one-click WordPress installer that really saves a lot of time when spinning new WordPress sites. On XAMPP, I had to create a new database, download WordPress, and install it; whereas on Local, I just click the “+” button, give my site a name, and it is ready to go!
Furthermore, if you are a Flywheel or WP Engine (affiliate link) customer, you can pull your live sites to your local site with a single click. This saves a lot of time because you don’t have to stage your local site to test a new design or feature. It’s also really useful for debugging purposes if your live site encounters an error!
Apache to Nginx and PHP 5.6 to 7.4
It is incredibly easy to switch the server type from Apache to Nginx, or to change the PHP or MySQL versions. On XAMPP, I had to download a whole new version of the program, export all of my databases, install XAMPP anew, and then import my databases just to change the PHP version. On Local, I just click on a dropdown menu and select which version I want. Given how many different versions of PHP we have gotten in recent years, this feature is a godsend.
Out-of-the-Box SSL Support
Sometimes some plugins behave differently when the connection is done over Secure Sockets Layer (SSL) (for example, WooCommerce or Jetpack Photon). Local lets you set up SSL for your local site with a click. This is very helpful for testing SSL features like payment processors for eCommerce.
Shareable Demo URLs
When I was designing a new theme for my other website, The Postman’s Knock, I had to call my wife every few minutes to give me feedback on a new feature. Those days are long gone now! With Local, you can set up a Live Link, which is a URL that you can share with your team to show them your site. It’s a great way to collaborate and get feedback on your project.
Easy Access to your Sites’ Files + WP CLI Support
From your Local dashboard, you can open a shell to access your site’s files and also execute WordPress Command Line Interface (WP CLI) commands. For example, you can open your shell and then type
wp media regenerate to regenerate all of your image’s thumbnails. You can do the same in XAMPP or MAMP with the Terminal app on MacOS, but the fact that this feature is integrated into the Local dashboard does make things a bit easier.
Sending email from your local site to an inbox for testing purposes was something that I never got to work quite right on XAMPP. Local comes integrated with Mailhog, which is a utility that captures all outbound email from your local site. For eCommerce, being able to test order confirmation emails is important, so this feature is very welcome.
Adminer vs PHPMyAdmin
My only complaint with using Local is that it comes integrated with Adminer for its database management, whereas XAMPP (and most web hosting providers) uses PHPMyAdmin. I personally find PHPMyAdmin to be more intuitive, but Adminer is definitely not a deal breaker. After playing with Adminer for a few minutes, I got the hang of it and so will you!
Local is completely free to use for Mac, Windows, and Linux. This means you can try it out without any risks or obligations involved. Now that we know why Local is the best option to manage your WordPress development environment, let’s get started setting it up!
Set Up your WordPress Development Environment with Local (in 3 Easy Steps)
1. Download and Install Local
Navigate to the Local website homepage, and click on “Download for Free” (it’s next to the more flashy “Get Started” button). Select your platform (Mac, Windows, or Linux), fill out the form, and click on “Get It Now!” to start the download.
The download will start immediately.
Click on the
local-x.x.x-mac.dmg file that was just downloaded, and drag the app to the Applications directory to install it.
2. Create a New Site
Open the Local app, and click on the “+” button on the lower left corner of the Local dashboard. A new site creation wizard will show up.
Insert a site name (for example, “My New Site”). If you wish to configure the site domain or where the files will be located on your computer, click on “Advanced Options”.
Once you click “Next”, the wizard will take you to the “Setup Environment” step. Here you can select the Preferred configuration or customize the web server type, the PHP version, and the MySQL version. It’s up to you!
In the last step, you will select a WordPress username and password. In the “Advanced Options” dropdown menu, you can select whether this WordPress development environment will be multisite or not.
Click on “Add Site” to finish the installation and exit the wizard. In order to setup the hosts files, that is, to create the local web address you selected above (
https://my-new-site.local), Local will ask you for your administrator password. Once you enter your password, your new site will be ready to go!
Finally in order to add SSL support, click on “Trust” next to the SSL menu item. Once again, you will be asked for your administrator password. Once you enter your password, you can use HTTPS with your new WordPress development environment in any browser.
Click on “View Site” from your Local dashboard, or go to your browser and navigate to your site’s URL (
https://my-new-site.local in my case). You should now be able to see your newly created WordPress site!
3. Pull Your Live Site Database + Files from Flywheel or WPEngine (optional)
This last step only applies to Flywheel or WP Engine customers. Local was owned by Flywheel, which was then acquired by WP Engine. Because of this, Local integrates really nicely with both of these services. If you wish to create a copy of a live site hosted on Flywheel or WPEngine, all you have to do is click on “Connected to no host selected” at the bottom of the dashboard, and then click on “Add New Host” on the menu that appears. A wizard to login to your account will appear.
Select your web host, and then Local will ask for a username and password. Please note that WPEngine will ask you for an API username and password, which are different from your regular username and password you use to login to your account. You can get an API username and password for WP Engine here. Local will redirect you to your dashboard once you login with your username and password. From here, click once again on “Connected to no host selected”, except this time you should have an option to select the host you just added. Once you connect to a host, you can click on the Pull or Push button on the lower right corner of the dashboard.
You can then select which site you wish to import from or export to. For example, you can make a copy of a live site and turn it into a local site. Then you can make changes, and copy them back over to the live version.
That’s it! You should now know everything you need to create a WordPress development environment and manage your sites through Local. How you use them is up to you!
Like I said earlier, I have been a XAMPP user for years. After upgrading from PHP 5.6 to 7.3 on XAMPP turned out to be major pain, I decided to look for a different, WordPress-oriented solution. I came across Local through the WP Engine site, and I haven’t looked back since! Being able to quickly create a local WordPress site and pull the files and database from your live sites is incredibly useful as a developer. Local lets you develop new plugins and themes without hassle, and makes it easy to perform testing and troubleshooting without affecting your live sites. I can’t recommend it enough!