Install on Windows with WSL2
You work inside the distro and look at the result in a Windows browser. Two installers are needed because those are two machines with two trust stores. The Windows one goes first so that the second can borrow its certificate authority and its token.
Before you start
Know which side does what. Windows holds the browser, the certificate authority the browser trusts, and its own hosts file. The distro holds grim, your projects and every command you type after today. Docker Desktop serves both.
On the Windows side, Git for Windows has to be installed. The Windows installer stops without it. PHP, Composer, mkcert, MariaDB and Node it installs itself.
Inside the distro, Docker has to answer, which means WSL integration is switched on for this distro in Docker Desktop. PHP 8.1 or newer and Composer have to be installed in the distro too. The Linux installer checks both first and stops when either is missing.
$ docker info --format '{{.ServerVersion}}'
$ php --version
$ composer --versionThe ritual, in order
Six steps. The first runs in PowerShell, the other five inside the distro. The order of the first two matters, and nothing else here is ever repeated.
Install on the Windows side
In PowerShell, not in the distro. This creates the mkcert authority in the Windows trust store, which is the one Chrome, Edge and Firefox on Windows believe. It also asks for a classic GitHub token and stores it under your Windows profile, in
.grim\config.json.$ irm https://grim.grimoiry.com/install.ps1 | iexThe pasted token is shown on screen.
GRIM CLI installed successfullyends the run. You will not use this Windows copy of grim for daily work. It is here for what it leaves behind.Install inside the distro
Open the distro. The same installer as on macOS and Linux notices WSL2 and looks at the Windows side before it asks for anything.
$ curl -sS https://grim.grimoiry.com/install.sh | bash … Sharing mkcert CA with Windows host: /mnt/c/Users/anna/AppData/Local/mkcert … Found GitHub token from a Windows-side grim install at: /mnt/c/Users/anna/.grim/config.json Reuse it? [Y/n]Sharing mkcert CA with Windows hostis the line this recipe exists for. Certificates made inside the distro are now signed by the authority Windows trusts.No Windows mkcert CA foundmeans step one did not finish. Go back to it, then run this installer again.Answer the token question with Enter. The installer ends by running
grim auth:login, which also removes thecredsStoreentry that breaks image pulls from inside WSL2. Yellow lines are things the installer left to you. On Linux that includes the database: it prints the packages for your distribution and oneGRANTstatement. Run both now.Open a fresh shell
The installer wrote
CAROOTand, when it had to, aPATHhint into your shell profile. Neither reaches the shell you ran it from.$ echo $CAROOT /mnt/c/Users/anna/AppData/Local/mkcert $ grim auth:whoamiAn empty
CAROOTin a new shell means your shell reads none of~/.profile,~/.bashrcand~/.zshrc. Copy the three marked lines from one of them into the profile it does read.Stop WSL2 from rewriting the hosts file
grim adds each project's names to the distro's
/etc/hosts. WSL2 generates that file again at every restart and the entries are gone. Switch the generation off once per distro, then restart WSL.$ printf '[network]\ngenerateHosts = false\n' | sudo tee -a /etc/wsl.conf $ wsl.exe --shutdownThe shutdown closes every distro and this terminal with them. When
/etc/wsl.confalready has a[network]section, put the line there by hand instead. Open the distro again before the next step, and wait until Docker Desktop reports the engine running.Prepare the distro
grim setupcreates the Docker network all projects share, installs the authority into the distro's own trust store and starts the one Traefik that routes every project.$ grim setup Setting up local dev environment... Creating traefik-public network... OK Checking mkcert... installed Installing mkcert CA... OK SSL certs will be generated per-project on grim up Setting up Traefik... running Setting up *.test DNS... manual setup needed Add to /etc/hosts: 127.0.0.1 yourproject.test Or install dnsmasq: address=/.test/127.0.0.1 Local dev environment ready.Read the indented lines, not the last one.
Local dev environment ready.is printed, with exit code 0, even when a line above it saysfailed.manual setup neededis not a task for you. Creating a project adds its names to both hosts files by itself.Ask the doctor
On WSL2
grim doctorhas a section of its own for the road from the distro to a Windows browser.$ grim doctor … Docker daemon ✓ running Traefik ports ✓ 80, 443 bound MySQL/MariaDB ✓ 10.11.6 (root@127.0.0.1, no password) … WSL2 browser path mkcert CAROOT ✓ /mnt/c/Users/anna/AppData/Local/mkcert Windows CA ✓ /mnt/c/Users/anna/AppData/Local/mkcert/rootCA.pem certutil ✓ /usr/bin/certutil Browser ✓ Snap Firefox not on PATH (use Windows browser for *.test) All checks passed!A
-on theMySQL/MariaDBline does not fail the run, and it still matters. grim creates a project's database from inside the distro, asrootwithout a password. With a-there, the first project gets no database.
What you have now
| Where | What |
|---|---|
| Windows | The mkcert authority in the trust store, a token in .grim\config.json, and a copy of grim you can ignore |
| Distro | ~/.local/bin/grim, ~/.grim/config.json, ~/.grim/traefik/, CAROOT in your shell profile |
| Docker Desktop | The traefik-public network and one Traefik on ports 80, 443 and 8099 |
Keep projects in the distro's own filesystem, under ~/, never under /mnt/c. Docker reaches Windows files through a slow bridge and every request pays for it.
No project yet. That is the next recipe, Create a project. Its one Windows-specific moment is a UAC prompt on the desktop, when the project's names go into the Windows hosts file. If you miss it, grim hosts:windows asks again.
When it does not work
“PHP is not installed. Install PHP 8.1+ first.”
The Linux installer brings Node and mkcert but not PHP or Composer. Install both with the distro's package manager and run the installer again. Composer is not installed. is the same stop one check later.
“No Windows mkcert CA found at /mnt/c/Users/*/AppData/Local/mkcert/.”
The distro made an authority of its own, and Windows browsers will reject every certificate signed by it. Finish step one on Windows, or run mkcert -install in PowerShell, then run the Linux installer again. Doctor shows the same state as Windows CA ✗.
“Git is not installed or not in PATH.”
The Windows installer stops here. Install Git for Windows, open a new PowerShell and run step one again.
“error getting credentials” when an image is pulled
The distro's ~/.docker/config.json names "credsStore": "desktop" again, and that helper fails inside WSL2. Run grim auth:login again. It removes the entry and logs in without it.
Firefox in the distro still warns about the certificate
Snap Firefox detected on PATH in doctor explains it. A Snap browser keeps a sandboxed trust store the authority cannot be installed into. Use the Windows browser for .test pages.
Next recipe
Create a project
Answer two questions, let the install run, bring the stack up, sign in as the generated admin, run the suite once and commit the three files that are the project.
Read itSpells used here
grim setup
Prepare the machine
Put the shared pieces of local development in place, once per machine: the Traefik proxy, a trusted local certificate authority and .test name resolution.
grim doctor
Check your circle
Check every tool grim expects on this machine, and the project you are standing in, and say what to do about what is missing.
grim auth:login
Log grim in to GitHub
Give grim a GitHub token, from your gh login or a personal access token, and hand the same token to Composer and Docker.
grim auth:whoami
See who grim acts as
Show the GitHub user and the masked token grim holds on this machine.
grim hosts:windows
Reach WSL2 from Windows
Write the project's .test domain into the Windows hosts file from inside WSL2, so a Windows browser can open it.