Accent CMS on Windows

This page takes you from a Windows machine without Accent CMS to a running site, and covers what differs from Linux and macOS. Every example uses PowerShell. The getting-started guide covers the rest, on every platform.

If you prefer a Linux environment, the Linux install script also works inside WSL; the rest of this page is about running Accent natively on Windows.

Requirements

  • Windows 10 22H2 or Windows 11, on an x64 or ARM64 processor.
  • Windows PowerShell 5.1, which ships with Windows, or PowerShell 7.

Install

Run the installer:

irm https://raw.githubusercontent.com/AccentCMS/accent/main/install.ps1 | iex

The installer puts accent.exe in %LOCALAPPDATA%\accent and checks the download against the release’s SHA-256 checksums. When gpg is on your PATH – Gpg4win provides it – it also verifies the release signature. To make the install stop whenever a check cannot run, set $env:ACCENT_INSTALL_REQUIRE_VERIFY = "1" before you run it. See Verifying downloads for what each check proves.

When the installer reports that %LOCALAPPDATA%\accent is not on your PATH, add it for your account:

$path = [Environment]::GetEnvironmentVariable('Path', 'User')
[Environment]::SetEnvironmentVariable('Path', "$path;$env:LOCALAPPDATA\accent", 'User')

Then open a new terminal and check the install:

accent --version

You can also download accent-<version>-x86_64-pc-windows-msvc.zip, or the aarch64-pc-windows-msvc archive for ARM64, from the latest release. Extract accent.exe into a folder on your PATH. To reinstall or pin a version, see Reinstalling or pinning a version.

Enable long paths

Windows limits paths to 260 characters for programs that do not support long paths, and accent validate warns until long paths are enabled. Enabling them lifts the limit for programs that do support them. To enable them, open PowerShell with Run as administrator, run the following command, and then restart Windows:

New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name LongPathsEnabled -Value 1 -PropertyType DWORD -Force

Create and serve a site

accent init my-site
Set-Location my-site
accent serve

Open https://127.0.0.1:4400 in your browser. When you save a Markdown file under content\, the browser refreshes.

The development certificate

accent serve uses HTTPS with a self-signed certificate, so your browser warns on the first visit; choose the option to continue. Accent stores the certificate in %LOCALAPPDATA%\accentcms\dev-cert\ and reuses it, so the warning appears once.

Accent writes the certificate’s private key, key.pem, so that only your account, SYSTEM, and the Administrators group can read it.

On the first start, Accent prints a command that trusts the certificate for your Windows account:

certutil -addstore -user Root "C:\Users\<you>\AppData\Local\accentcms\dev-cert\cert.pem"

Run the command exactly as Accent prints it, and choose Yes when Windows asks you to confirm installing the certificate. Programs that trust the Windows certificate store then accept the certificate.

To serve plain HTTP instead, run accent serve --no-tls.

Set environment variables

Accent reads some settings from environment variables, such as your license key in ACCENTCMS_LICENSE. Set one for the current PowerShell session:

$env:ACCENTCMS_LICENSE = "<your license key>"

To keep a variable for new terminals, store it for your account, and then open a new terminal:

[Environment]::SetEnvironmentVariable('ACCENTCMS_LICENSE', '<your license key>', 'User')

To remove the variable from the current session, run Remove-Item Env:ACCENTCMS_LICENSE.

Reload the configuration

Windows has no SIGHUP. To apply changes to config.yaml without restarting the server, call the reload endpoint. Against accent serve --no-tls, this works in both Windows PowerShell 5.1 and PowerShell 7:

Invoke-RestMethod -Method Post -Uri http://127.0.0.1:4400/_admin/reload

A successful reload returns:

message                status
-------                ------
Configuration reloaded ok

The default HTTPS server needs a trusted certificate first. In PowerShell 7, you can skip the certificate check for this local request instead; Windows PowerShell 5.1 has no such option:

Invoke-RestMethod -Method Post -Uri https://127.0.0.1:4400/_admin/reload -SkipCertificateCheck

In development, the endpoint needs no token, and every request counts against a limit of 10 a minute that failed admin logins share. In production (accent serve --production), send the server’s admin token: the value of ACCENT_ADMIN_TOKEN where the server runs, or, when that is not set, admin.token in its config.yaml.

$headers = @{ Authorization = "Bearer <admin token>" }
Invoke-RestMethod -Method Post -Uri http://127.0.0.1:4400/_admin/reload -Headers $headers

In production, the endpoint returns 401 for a missing or wrong token, and 503 when no token is configured. Failed attempts share a limit of 10 a minute with failed admin logins; past it, a failed attempt returns 429, while a request with the right token is never limited. If the new configuration is invalid, the server keeps the previous one and the endpoint returns 500 with the error.

Stop the server

Press Ctrl+C or Ctrl+Break in the terminal that runs accent serve, or close its window. Each one stops the server gracefully: it stops accepting connections, gives requests in progress time to finish, and logs the event, for example Received Ctrl+Break, shutting down.... Over HTTPS, the default, it waits at most 5 seconds; with --no-tls it waits for every request. After you close the window it waits at most 4 seconds, because Windows ends the process 5 seconds later. See Stopping the server for details.

Troubleshooting

ProblemWhat to do
accent is not recognized as a commandAdd %LOCALAPPDATA%\accent to your PATH as shown in Install, then open a new terminal.
accent does not start: Windows reports that VCRUNTIME140.dll was not found, or a script sees exit code -1073741515Releases up to 0.27.1 need the Microsoft Visual C++ Redistributable, which a clean Windows install does not have. Install a release after 0.27.1, which needs nothing beyond Windows, or install the Visual C++ 2015-2022 Redistributable from Microsoft.
A path is too longMove the site to a shorter folder, such as C:\sites\my-site. Enabling long paths helps only programs that support them.
accent serve stops with server bind failed: 127.0.0.1:4400Another process holds the port, or Windows reserves it. Find the process with Get-Process -Id (Get-NetTCPConnection -LocalPort 4400 -State Listen).OwningProcess. If Get-NetTCPConnection finds no connection, the port may be in a range Windows reserves, for example for Hyper-V or WSL 2; list those ranges with netsh interface ipv4 show excludedportrange protocol=tcp. Either way, accent serve --port 4401 starts Accent on another port.
Builds and hot reload are slowReal-time antivirus scanning checks every file Accent writes. Exclude the site’s build output (output by default) and its cache directories, such as .media-cache and .diagram-cache, rather than your whole profile. For Microsoft Defender, run Add-MpPreference -ExclusionPath "C:\sites\my-site\output" in PowerShell opened with Run as administrator.
Files have Windows line endingsNo action is needed. Accent reads frontmatter with CRLF line endings the same as LF, so Git’s core.autocrlf setting can stay on.
Invoke-RestMethod reports that it could not establish trust relationship for the SSL/TLS secure channelThe dev server uses HTTPS with a self-signed certificate. Trust the development certificate, use -SkipCertificateCheck in PowerShell 7, or run accent serve --no-tls.