Local Bedrock Development with Local by Flywheel

While there are many fantastic tools for developing with WordPress (and other things) locally, I’ve found that some developers might be a little bit wary to use the command line at all times. Personally, I love GUIs and find them to be a little easier to use as long as they can be lightweight.

Local by Flywheel uses Docker containers under the hood but takes care of many things in a really easy to use, friendly, and performant GUI. The other thing I like about it is that it can get SSL working locally easily and keeps DB backups in an easy-to-find place. It includes Mailhog and even has really cool add-ons available now. It also keeps itself updated, so if you’re scared of updating your Docker containers or VirtualBox, worry no more!

At my agency, it’s a bullet-proof local development environment that’s easy to get newer developers on board with, and runs well on Mac and Windows.

It also allows you just enough configuration under the hood to get Bedrock working.

For this guide I’ll be working on a Mac with Local by Flywheel v2.4.5 installed. I hope as they update the app this guide will stay current, but if there are any major changes I’ll try to catch them and update this post as I use Local in my daily work.

Create a new site

This part is pretty straightforward. Let’s call our site “Bedrock,” use the local domain bedrock.local, and install it in the recommended location: ~/Local Sites/bedrock (change this if you would like the project to live somewhere else).
Screenshot of the "create site" step on Local by Flywheel

Choose the “Custom” environment, since it will let you pick the most up-to-date PHP and MySQL versions. The “Preferred” setup will let you deploy to Flywheel with a click, but they don’t support Bedrock sites out of the box so I don’t care about that feature. Make sure nginx is selected.
Screenshot of the "choose environment" step on Local by Flywheel

To setup WordPress, I’m just going to use my name and a simple password to have it create a user for me. Keep in mind Local DOES support multisite easily (I’ve tested subdomain multisite), you just have to tell it during this step. For now we’ll setup a regular install though.
Screenshot of the "setup WordPress" step on Local by Flywheel

Let it provision and do it’s thing. This should take a few minutes, depending on your internet connection.

After provisioning is complete you should see the site in your site list. Please ignore the message about my missing hosts entry, I prefer to manage my hosts file myself:
Screenshot of the "site overview" screen on Local by Flywheel

Go to the “SSL” tab and select “Trust”:
Screenshot of the "site SSL" screen on Local by Flywheel

Now you should be able to visit https://bedrock.local and there should be a site with SSL working!
Screenshot of the Bedrock WordPress site in Google Chrome
Local provisioned a normal WordPress site though, and that’s not what we want, so let’s get Bedrock working.

Install Bedrock

From ~/Local Sites/bedrock/app/, run:

$ composer create-project roots/bedrock

You should now have a new bedrock folder where your Bedrock files will live. Your directory structure should look a little something like this:

Screenshot of the projects directory structure

At this point, you might want to delete the /public/ directory. It might get kind of confusing down the road since our install won’t be using those files.

Update .env

Let’s update the .env file to include the new DB and domain details, and generate some salts. Mine looks like this now:


# Optional variables
# DB_HOST=localhost


# Generate your keys here: https://roots.io/salts.html

Update Local’s nginx config

A few directories above our Bedrock install is a folder for configurations files called conf. We’re going to edit ~/Local Sites/bedrock/conf/nginx/site.conf and set the root to /app/bedrock/web/:

-root /app/public/;
+root /app/bedrock/web/;

To get the changes to take effect you will need to restart the site by right-clicking the site in the list of sites and selecting “Restart”.

👋 TIP: When you need to run WP-CLI commands, you’ll need to SSH into the server. Local makes it easy. In Local, right-click your Bedrock site from the list of sites and select “Open Site SSH”. It should open your terminal app (or you can configure it to open iTerm in Local’s preferences) and spit you out at the server root. Go into the /app/bedrock/ folder and you should be able to run wp --command without an issue. This is because Bedrock already includes a wp-cli.yml file with the correct webroot configured.

It works!

At this point, you should see your site working fine when you visit https://bedrock.local. Grab yourself a beer (or tea, or water) and enjoy the power of Bedrock with the ease of Local by Flywheel!

Join the discussion on Roots Discourse

Help support our open-source development efforts

Help us grow

Join over 7,800+ subscribers on our newsletter to get the latest Roots updates, along with occasional tips on building better WordPress sites.

Looking for WordPress plugin recommendations, the newest modern WordPress projects, and general web development tips and articles?

“Easily the best WordPress email I get.” Colin OBrien

Follow us on Twitter @rootswp

Ready to checkout?