Start site through command line

Is it possible to start/stop a site through the command line? I would like to set up a shell script and one of the steps would be starting a site, but I wasn’t sure if that was possible.


Hi Andrew,

Unfortunately it’s not possible at the moment but this is definitely on the radar :slight_smile:

I’ve moved this topic to “Feature Requests”


+1 for that feature request :wink: That would give a lot for “hardcore” command line using developers


+1 This is even more important now that Local shuts down sites when Local is shutdown, i.e., need to start up sites more often now.

+1 - this would be an awesome feature to have, especially for super users. Thanks!

Thanks for the feedback!

If you have specific dreams of how Local works in the CLI, be sure let us know! By that I mean actual commands and arguments :slight_smile:

+1 for this. I would love to be able to just launch the site from the integrated terminal in my IDE. I already made myself a one-liner command to drop me into the “SSH” for sites, launching the sites this way would be great as well. Actually, this feature would best if it were something like a lbf start and lbf stop command that determined which site to start or stop based on the current directory. If that were to happen (this is just me dreaming a little) you could also include a lbf shell command that drops you into the shell of the site whose path you are within (what I wrote for myself in bash and php a few weeks back, but would rather be something provided officially by Local).

1 Like

You have my vote. A feature like this will certainly attract ‘hardcode’ developers who don’t like pretty user interfaces. At the moment I have a hard time convincing back-end developers to migrate, whereas Front-End devs are easily convinced thanks to Local’s attractive design.

I think @alexclst is on the right track with lbf start etc. commands…

Something like lbf new to create a new site, the user would then be presented with options, i.e. title, directory, server type, php/mysql versions, multisite etc… Have a look at how Lando does it -

Some commands:

  • lbf new - Create site
  • lbf start - Start site
  • lbf stop - Turn site off
  • lbf status - Check run status of site
  • lbf remove - Delete site, also presented with confirmation, and option to remove files from dir.
  • lbf edit - Update server, php or mysql options
  • lbf update core - Update WordPress
  • lbf update plugins - Update All Plugins
  • lbf update plugin contact-form-7 - Update specific plugin, i.e. “contact-form-7” (directory slug)
  • lbf update themes - Update All Themes
  • lbf update theme twentyseventeen - Update specific theme, i.e. “twentyseventeen” (directory slug)
  • lbf update all - Update WordPress, plugins and themes
  • lbf mysql - Open database in preffered tool (i.e. Sequel Pro)
  • lbf mail - Open MailCatcher
  • lbf push - Push to Flywheel (presented with option for database)
  • lbf pull - Pull from Flywheel (presented with option for database)
  • lbf export - Zip and export site
  • lbf import - Import site

Just some examples…


@clay just mentioning you so you see my comment :grinning:

Saw it! I dig the ideas! :smiley:

+1 Another vote for this, especially with wp-cli integration.

On a side note. The latest LBF releases have been super solid so thanks!

would you be willing to share your scripts?

The script I wrote can be found at the Bitbucket repository for it. The sh script is intended for the Bash shell. I later switched to the Fish shell, and so the following is what I now use, which still depends on the PHP script, but is included as a function in my Fish config folder:

function lbf
    # get the LBF container id using the PHP script from the Bash lbf-container
    set container (command php $HOME/bin/lbf-container/lbf-container.php $PWD $HOME)

    if test -n "$container"
        # if we have a container attempt to enter it's bash shell
        eval ("/Applications/Local by" env local-by-flywheel)
        "/Applications/Local by" exec -it $container /bin/bash
        # if we don't have a container just alert the user of that
        echo "Not a Local by Flywheel site folder."
1 Like

If you have the WP CLI command installed on your computer (like via Homebrew), you can add two files to the root folder for the local site that enable using the WP CLI directly from the shell on your regular computer, without even going into the shell of the local site, so long as your CWD is within the folders of the local site.

One is wp-cli.local.yml:

path: app/public
  - wp-cli.local.php

The second is wp-cli.local.php:

define('DB_HOST', ‘');
define('DB_USER', 'root');
define('DB_PASSWORD', 'root');

@ini_set('display_errors', 0);
define( 'WP_DEBUG', false );

Just replace XXXX with the port for the DB that is shown in the main Local window.

I find that this is even more convenient than going into the local machine’s shell if all I’m trying to do is use the WP CLI. In fact, another feature request, I guess, could be Local just creating these files for us on new sites.


There is now an experimental Local CLI. You can read about it and see how to download it over in its feature request. Just putting this here for anyone who may not have seen that yet.


Doesn’t seem to be clearly documented and this link is dead - anyone got a new one?

It can be found on NodeJS.

I am sooo happy this exists

1 Like

Hello @andrew.farinella and all -

Thank you for bringing this idea to the forums and everyone for contributing ideas.

I have spoken with the Local engineering team and it is not on the roadmap at this time.

In the future, we’d like to open the development of this tool up to the community, but we’re not quite ready for that yet. When the API that powers Local CLI is stable and documented, we’d love to have help from those interested in building this out.

We appreciate you!


Hi, is this still not on the roadmap ?

There would be so many benefits of being able to control local from the command line, a major one being integration with IDEs like VS Code or simply adding it to startup scripts.

It’s very commont to lauch several tools at once when working on a project, it’s annoying having Local being the only one that needs a manual GUI action, wasting precious seconds each time :slight_smile:

None of the alternative solutions listed in this post seem to work these days (at least on linux), would love to hear any solution if somebody found a way.