valar on engineers’ Macs and Windows 11 PCs, set it up, and keep it current without anyone typing a command. This page explains how valar runs under MDM and in what order to deploy it. The sections before Windows describe macOS.
How valar runs under MDM
MDM scripts run as root, in the background, with no terminal.valar is built for a signed-in engineer, so three rules follow.
Every command acts for one user. valar changes that user’s configuration in ~/.valar, each app’s settings in the user’s home, and the proxy services that run in the user’s login session. A command run as root with no user selected is refused (V1A-1004). A command acts for the user in one of two ways:
- Proxy setup runs as root, for a selected user.
valar proxy enableneeds administrator access: it sets the network proxy and installs the proxy services. Run it from a root policy withSUDO_USERset to the target account.valardoes the user’s part of the setup as that user. - Everything else runs as the user.
valar configure,valar upgrade, andvalar <harness> on|offneed no administrator access. Run them as the signed-in user, either through your MDM’s option to run as the signed-in user or by switching to that user from a root script (see the example). Runvalar upgradethis way, not throughSUDO_USER.
valar asks before it restarts a running app. Under MDM it cannot ask, so pass --force (see Restarts).
Choose a lane
The on-device proxy is optional. Without it,valar <harness> on uses the direct lane. The proxy lane adds quota-first and Remote Control. For Cursor on macOS, it keeps Cursor’s own models working next to Valar’s and makes Valar only strict. It needs two things on every Mac:
- A root certificate your MDM trusts. See Set up the proxy from a root policy.
- Each engineer signed in to Claude Code with their Claude account. Without it, Claude Code stops at “Not logged in”.
Deploy
-
Install the CLI at a path the user can run, such as
/usr/local/bin/valar. See Install the CLI. -
Give each engineer a coding key. Create keys in the dashboard or with key automation. Store each key as that user with
valar configure --api-key <key>, or provide it through a protectedVALAR_API_KEYenvironment variable. Keep keys out of policy arguments and logs. -
Upgrade existing installs, as the user:
valar upgrade --force. Finish this before setting up the proxy. - Set up the proxy, from a root policy (proxy lane only, see below).
-
Turn on each harness, as the user:
-
Verify the proxy lane with
valar <harness> status --verifyafter the user sends a request through that harness. On the direct lane, usevalar <harness> status. -
Keep it current. Whenever your MDM installs a new
valarbinary, runvalar upgrade --forceas the user. Until it runs, most commands refuse (V1A-1903).
Set up the proxy from a root policy
Under MDM, bring your organization’s certificate. macOS trusts a new root only from an MDM profile or a person at the screen, so the certificatevalar proxy enable creates on its own fails from a policy (V1A-1113). Before the policy runs:
- Deliver your root CA as an MDM configuration profile with a Certificate payload. Until it arrives,
valar proxy enablestops withV1A-1106. - Put a leaf certificate for
api.anthropic.comand its key on the Mac, readable by root. See Create an organization-managed certificate.
--ingress external; if your network requires an outbound proxy, add --upstream-proxy. See Corporate networks.
Setting up the proxy does not turn on any harness. Running it again keeps each harness’s on/off choice but restarts the proxy, interrupting requests in flight, so run it on first setup and after renewing the certificate. If you use Cursor, also run it once after upgrading to a release with Cursor support, so the certificate covers Cursor (reissue an organization-managed certificate with Cursor’s names first).
Restarts
Some changes apply only after a running app restarts. With a terminal,valar asks first. Under MDM it cannot ask, so pass --force to every valar upgrade and valar <harness> on|off. Without it, a command that needs a restart changes nothing and exits with an error (1 for on/off, 20 for upgrade).
--force restarts what the change needs:
- Claude Desktop quits and reopens in the background.
- Cursor quits and reopens.
- Claude Code closes interactive sessions and restarts background agents. Users reopen conversations with
claude --resume.
valar upgrade, --force also accepts any breaking changes the upgrade lists.
Restarts interrupt work in progress, so schedule forced runs at login or outside working hours. --force does not bypass certificate, ownership, or network checks.
Example: run as the signed-in user
If your MDM can run a script as the signed-in user, run thevalar commands directly. Otherwise, switch to that user from a root script, as this macOS example does. Adapt it to your fleet, for example by listing only the harnesses your engineers use.
Windows
On Windows, novalar step needs administrator access, and every command runs as the signed-in user, including valar proxy enable. valar sets up the account that runs it, so a script that runs as SYSTEM does not set up the engineer’s account. In Intune, set Run this script using the logged on credentials to Yes; with other tools, use their equivalent option.
Windows asks the user to confirm before a certificate is added to their own store, and an unattended script cannot answer. An unattended valar proxy enable that would create its own certificate therefore stops before changing anything (V1A-1128). Deploy an organization certificate instead:
- Trust your organization’s root on each device: an Intune trusted certificate profile or Group Policy that installs it in the computer’s Trusted Root Certification Authorities store. See Trust and distribute.
- Deliver each device’s leaf bundle and key to a location only the signed-in user can read. Setup copies both into its own protected folder.
- Install the CLI. The installer places it at
%USERPROFILE%\.local\bin\valar.exe. - Run the setup as the signed-in user:
valar configure --api-key <key> as the same user, or provide VALAR_API_KEY through a protected channel. Keep keys out of script arguments and logs.
If your organization applies one proxy setting to every user of the machine, proxy enable stops (V1A-1125): add --ingress external and deploy the Valar rule in your PAC. If your network requires an outbound proxy, add --upstream-proxy. See Corporate networks.
Keep it current. When your tool installs a new valar.exe, run valar upgrade --force and then valar proxy restart as the user. The restart moves the proxy services onto the new version.
Verify with valar <harness> status --verify after the user sends a request through that harness. To check the device without Valar, see Deployment checks and diagnostics.
Update older policies
- Selecting the user: root policies that relied only on
HOMEmust setSUDO_USERor run as the user. - Old command names:
valar claude-desktop proxystill works as an alias forvalar proxy. Onproxy enable,--force,--no-restart, and--offare accepted and ignored with a warning. Put--forceon the harness command instead, and use the harness’soffto stop routing.