Every morning, the same ritual. Open Local. Wait. Click the site I work on every single day. Click Start. Wait. Realize I also need the second site, because of course the first one talks to it. Click. Start. Wait.
Computers were invented to automate boring repetitive tasks. So why am I the one doing the boring repetitive task here?!
No, this is not a TED Talk about AI, but about IA.
No, no, not Internal Affairs… Intelligent Automation.
The Problem
Local has no concept of “always start this site when you launch”. None. Zero.
And yes, at one time I was so sure it had, that I opened a support ticket requesting the feature repaired/restored.
…
Yeah ….
Well …
I still want it!
I want my sites running; the two or three (or twelve … ) I’m actually working on this sprint, up and running by the time I’ve fetched my coffee.
So why… nah, forget why, HOW?
Digging through Local’s internals (it’s an Electron app, and its addon API is surprisingly capable) reveals everything needed is already there;
- Sites live in a
sites.json, and the site record happily stores extra flags viasiteData.updateSite()— flags that survive restarts and even exports. - Local’s own
siteProcessManager.startSites()can start a batch of sites and is smart enough to restart the router only once for the whole batch. - Electron politely tells you when the app is done booting.
So all the ingredients for auto-starting sites are sitting right there in the pantry; nobody ever cooked the meal. Fine. I’ll do it myself. ;)
The Solution
Auto-Start Sites: a Local addon that adds one toggle — Auto-start — to every site’s Overview tab, right below the Xdebug row (if you have it… or maybe it’s above it …). Flip it on for the sites you care about. From then on, every time Local launches, the addon waits for Electron to settle, collects all flagged sites that are currently halted, and starts them through Local’s own machinery. That’s the whole trick. No config files, no cron nonsense, one toggle.
Get it
Source on GitHub: rmpel/Local-Auto-Start. Be sure to read the notes.
Install from source (MacOS and Linux);
git clone git@github.com:rmpel/Local-Auto-Start.git
cd Local-Auto-Start
./scripts/install.sh # symlinks into Local's addons dir + npm install
Restart Local to make it visible in the Installed addons list, toggle on as usual.
Install from a dist file (All OS); grab the latest .tgz from the dist folder, or build it with ./scripts/build.sh, and use the “Install from disk” feature in LocalWP.