It has been more than a year since I switched to Local by Flywheel for the local development of WordPress websites. I must admit that it is one of the best tools available for local development π― Local by Flywheel uses Docker to create WordPress sites in separate containers.
One thing that stuck out after switching was the use of WP-CLI π WP-CLI is an essential tool for WordPress developers because it helps to speed up our workflow. However, to access the CLI for a website on Local by Flywheel, you have to go through a two-step process.

β Right-click on the name of the website in Local and select Open Site SSH. As a result, a new terminal window will appear which will automatically log you in via SSH protocol, and then WP-CLI becomes available for you.

π‘ So, to streamline my workflow, I started searching for a solution which does not require logging into the container to access the CLI. And I made a CLI of my own, local-wpcli
β
Introducing local-wpcli
local-wpcli creates configuration files which enable WP-CLI β installed on your computer β to connect with locally hosted websites of Local by Flywheel within your terminal. Use the following command in your terminal to install it globally.
npm install --global local-wpcli
βοΈ How it Works
Once the installation is complete, follow these steps to connect WP-CLI with your WordPress site.
- 1οΈβ£ Open your terminal and go to the root folder of the website.
cd ~/local-sites/local-wp/
- 2οΈβ£ Now input the following command and press enter.
local-wpcli
- 3οΈβ£ The CLI will ask the following details:
β Remote Host (IP Address) β default is192.168.95.100
β Remote Port
π You can find the details mentioned above in DATABASE tab of the website in Local by Flywheel’s desktop app.

The CLI creates two configuration files in the root folder namely,
- 1οΈβ£ wp-cli.local.yml
- 2οΈβ£ wp-cli.local.php
That’s it π Once the files are created, WP-CLI will be ready to use to your heart’s content π
Stefano Monteiro says:
Do we need to have wp-cli installed?
May 3, 2019 — 7:31 am
Ashar Irfan says:
Yes,
wp-clishould be installed on your system.May 3, 2019 — 7:38 pm
florianbrunner says:
I get the error “/bin/sh: wp: command not found” – what do I have to do?
November 13, 2019 — 9:01 pm
Luyen Dao says:
Thanks!!!
November 10, 2020 — 12:38 am
luyenminhdao says:
Any idea why i don’t see a Remote Host and Remote port on my Local WP? What would the default port be?
November 25, 2020 — 11:46 am
Ashar Irfan says:
That’s because the CLI does not support Local Lightning yet. I am tracking this issue over here.
November 25, 2020 — 6:39 pm
mike says:
This whole workflow doesn’t work now that Local has switched to sockets.
January 11, 2021 — 3:42 pm
Ashar Irfan says:
Yes, at the moment it does not work because of the switch to sockets. I am tracking this issue over here.
August 8, 2021 — 11:13 pm
Niloy says:
the fun thing is i am using local by flywheel since 2017 and today i know it’s have build in wp-cli π
November 23, 2021 — 9:55 am