Run WP-CLI commands against any Local (by Flywheel) site without entering the site shell.
No more opening one shell at a time. Target any running WordPress site instantly from any terminal.
# Instead of opening Local > right-click > Open Site Shell...
lwp --site=mystore plugin list
lwp --site=blog db export backup.sql
lwp --site=client user listLocal by Flywheel runs each site with its own PHP, MySQL, and unix socket. The only official way to use WP-CLI is through Local's "site shell" — one site at a time, one terminal at a time.
lwp fixes that. It reads Local's config, finds the right PHP binary and MySQL socket, and runs WP-CLI with the correct environment. You can target any running site from any terminal window, script WP-CLI across multiple sites, and never touch the site shell again.
# One-liner install
curl -sL https://raw.githubusercontent.com/mikevalera/lwp/main/lwp -o /usr/local/bin/lwp && chmod +x /usr/local/bin/lwpOr clone and copy:
git clone https://github.com/mikevalera/lwp.git
cp lwp/lwp /usr/local/bin/lwp
chmod +x /usr/local/bin/lwp- macOS (Apple Silicon or Intel)
- Local installed
- WP-CLI installed globally (e.g.
/usr/local/bin/wp) - Python 3 (ships with macOS)
# Auto-detect site from current directory
cd ~/Local\ Sites/mysite/app/public
lwp plugin list
# Target any site by folder name
lwp --site=mysite option get siteurl
lwp --site=othersite plugin list --status=active
# Database operations (export, import, cli — all work)
lwp --site=mystore db export backup.sql
lwp --site=mystore db import dump.sql
# List running sites
lwp --list
# List all sites (running + stopped)
lwp --list-all- Reads
~/Library/Application Support/Local/sites.json - Matches the site by folder name (auto-detected from cwd or via
--site=) - Finds the correct PHP binary from Local's
lightning-services/ - Finds the MySQL socket at
run/{site_id}/mysql/mysqld.sock - Verifies MySQL is actually responding (not just a stale socket)
- Sets
MYSQL_UNIX_PORTsodb export/import/cliwork natively - Runs WP-CLI with
php -d mysqli.default_socket=... -d memory_limit=512M
# Export a database
lwp --site=mystore db export backup.sql
# Search-replace URLs
lwp --site=mystore search-replace 'http://old.local' 'http://new.local'
# Check active plugins across multiple sites
lwp --site=site1 plugin list --status=active
lwp --site=site2 plugin list --status=active
# WooCommerce commands
lwp --site=shop wc product list --format=table
lwp --site=shop wc order list --status=processing
# Cron, cache, users — anything WP-CLI supports
lwp --site=mysite user list
lwp --site=mysite cron event list
lwp --site=mysite cache flush| Supported | |
|---|---|
| macOS Apple Silicon (M1/M2/M3/M4) | Yes |
| macOS Intel | Yes |
| Local 8.x / 9.x | Yes |
| WP-CLI 2.x | Yes |
| Linux / Windows WSL | Not yet |
MIT