mirror of
https://github.com/devvmhq/docs-next.git
synced 2026-12-01 06:23:22 -10:00
5938 lines
988 KiB
XML
5938 lines
988 KiB
XML
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>devvm – Using devvm</title><link>https://next.devvm.dev/docs/using/</link><description>Recent content in Using devvm on devvm</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://next.devvm.dev/docs/using/index.xml" rel="self" type="application/rss+xml"/><item><title>Coding agents</title><link>https://next.devvm.dev/docs/using/coding-agents/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/coding-agents/</guid><description>
|
||
<h2 data-hextra-search-id="running-an-agent">Running an agent<span class="hx:absolute hx:-mt-20" id="running-an-agent"></span>
|
||
<a href="#running-an-agent" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>An agent runs where you start it, so you start it in the VM&rsquo;s shell, not on this machine. On this machine, devvm opens the VM&rsquo;s shell, and the VM&rsquo;s prompt starts with <code>(devvm)</code>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-console" data-lang="console"><span class="line"><span class="cl"><span class="go">~/some-project $ devvm
|
||
</span></span></span><span class="line"><span class="cl"><span class="go">(devvm) ~/some-project $ claude
|
||
</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>In the VM the agent sees only your project folder, and your agents&rsquo; settings from <a href="#devvms-agent-store">devvm&rsquo;s agent store</a>, which it gets read-only. Whatever it runs, such as a script a package installs, runs in the VM too. You don&rsquo;t install any agent on this machine, because devvm installs each one in the VMs that have it. How devvm gives each agent its settings, logins and history is in <a href="https://next.devvm.dev/docs/internals/agents/">how it works</a>.</p>
|
||
<h3 data-hextra-search-id="the-guide-in-every-vm">The guide in every VM<span class="hx:absolute hx:-mt-20" id="the-guide-in-every-vm"></span>
|
||
<a href="#the-guide-in-every-vm" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Every VM has a guide to devvm for the agents in it, at <code>/usr/share/doc/devvm/README.md</code>, and <code>devvm-help</code> in the VM prints it:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm-help <span class="c1"># in the VM: print the guide to devvm</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>It tells an agent what a devvm VM is, how its network tiers and secrets work, where its installs go, and which commands to ask you to run on this machine, such as <code>devvm network allow</code> for a blocked host or <code>devvm agent login</code> for a login. The guide is the same in every VM, so it says nothing about the VM&rsquo;s own tier, ports or layers, and nothing in the VM can change it for long (<a href="https://next.devvm.dev/docs/internals/agents/#the-guide-in-every-vm">the guide</a>). Ask your agent to read it, or to run <code>devvm-help</code>, when it doesn&rsquo;t know where it&rsquo;s running. devvm adds nothing about it to the agents&rsquo; instruction files.</p>
|
||
<h2 data-hextra-search-id="supported-agents">Supported agents<span class="hx:absolute hx:-mt-20" id="supported-agents"></span>
|
||
<a href="#supported-agents" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A new VM gets an agent when you choose it as you customize the VM, or when you name it with <code>--agents</code>. A VM that exists gets one from <code>devvm tools</code>, which shows the same list with the VM&rsquo;s agents already chosen, or from <code>devvm tools add</code>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm <span class="c1"># a new VM: customize it, then choose its agents in the list</span>
|
||
</span></span><span class="line"><span class="cl">devvm --agents claude,codex <span class="c1"># a new VM with Claude Code and Codex, without the list</span>
|
||
</span></span><span class="line"><span class="cl">devvm tools <span class="c1"># the VM that exists: choose its agents in the list</span>
|
||
</span></span><span class="line"><span class="cl">devvm tools add opencode <span class="c1"># the VM that exists: add opencode without the list</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>In the VM, you run each agent by its name in the table, such as <code>claude</code>.</p>
|
||
<!-- the agents' table, generated from internal/agents and the hosts in assets/shared-tools/<name>.policy by mise run cli-docs -->
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Name</th>
|
||
<th>Agent</th>
|
||
<th>What devvm adds</th>
|
||
<th>Allowlist, on the allowlist and none tiers</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>claude</code></td>
|
||
<td>Claude Code</td>
|
||
<td>the newest release, with its auto-update off, since the shared copy is read-only, and its telemetry off</td>
|
||
<td>Anthropic&rsquo;s API, Claude&rsquo;s login, Claude Code&rsquo;s downloads and claude.ai&rsquo;s connectors: <code>api.anthropic.com</code>, <code>claude.ai</code>, <code>downloads.claude.ai</code>, <code>platform.claude.com</code> and <code>mcp-proxy.anthropic.com</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>codex</code></td>
|
||
<td>Codex</td>
|
||
<td>the newest release, with its analytics and metrics off unless your config sets them</td>
|
||
<td>the OpenAI API and the ChatGPT login: <code>api.openai.com</code>, <code>chatgpt.com</code> and <code>auth.openai.com</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>opencode</code></td>
|
||
<td>opencode</td>
|
||
<td>the newest 2.x release, because opencode marks its 1.x releases as its latest on GitHub</td>
|
||
<td>opencode&rsquo;s own service and its model catalog: <code>opencode.ai</code> and <code>models.opencode.ai</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>pi</code></td>
|
||
<td><a href="https://pi.dev" target="_blank" rel="noopener">pi</a></td>
|
||
<td>the newest release, with its check for a newer pi and its install report off, and <code>fd</code>, which pi finds files with, in base</td>
|
||
<td>pi&rsquo;s model catalog: <code>pi.dev</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>cursor</code></td>
|
||
<td><a href="https://cursor.com/cli" target="_blank" rel="noopener">Cursor CLI</a></td>
|
||
<td>the release devvm pins, run as <code>cursor-agent</code> or <code>agent</code>, with its self-update off through its static channel</td>
|
||
<td>Cursor&rsquo;s API, its agent&rsquo;s hosts and its codebase indexing: <code>api2.cursor.sh</code>, <code>api5.cursor.sh</code>, <code>*.api5.cursor.sh</code> and <code>repo42.cursor.sh</code></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<!-- end of the agents' table -->
|
||
<ul>
|
||
<li>opencode and pi talk to the model provider you choose, so on the allowlist tier you allow that provider&rsquo;s API host yourself, such as <code>devvm network allow api.anthropic.com</code> (<a href="https://next.devvm.dev/docs/safety/network/#changing-rules">changing rules</a>), unless devvm keeps the agent&rsquo;s login or API key for that provider, because the VM&rsquo;s proxy then allows its host.</li>
|
||
<li>Claude Code&rsquo;s telemetry hosts aren&rsquo;t on its allowlist, because blocking them costs nothing. Every VM turns off each agent&rsquo;s self-update and telemetry with the agent&rsquo;s own variables, in every shell (<a href="https://next.devvm.dev/docs/internals/agents/#each-agents-variables">each agent&rsquo;s variables</a>).</li>
|
||
<li>pi&rsquo;s releases are built for glibc alone, so a VM made <code>--from</code> an Alpine-based container image can&rsquo;t have pi, and devvm refuses it there (<a href="https://next.devvm.dev/docs/using/from/#shared-tools-and-glibc">shared tools and glibc</a>). Every other agent runs on Alpine too.</li>
|
||
<li>Agents are <a href="https://next.devvm.dev/docs/using/images/#shared-tools">shared tools</a>, like the toolchains, so you can combine them with any layers and with each other, as in <code>devvm --tools node --agents claude,codex</code>. devvm follows each agent&rsquo;s newest release, because agents release several times a week, and <code>devvm update</code> or <code>devvm tools update</code> moves a VM to newer versions (<a href="https://next.devvm.dev/docs/using/toolchains/#adding-and-removing-tools">adding and removing tools</a>).</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="setups-default-agents">Setup&rsquo;s default agents<span class="hx:absolute hx:-mt-20" id="setups-default-agents"></span>
|
||
<a href="#setups-default-agents" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm setup</code> chooses the agents that the list checks for every new VM, and that a new VM gets without a terminal. devvm asks for them on its first run in a terminal and again in <code>devvm setup</code>&rsquo;s questions, and <code>devvm setup --agents claude,codex</code> or <code>devvm setup --agents none</code> sets them without asking. They&rsquo;re a setting for new VMs only, so a VM that exists keeps its agents (<a href="https://next.devvm.dev/docs/using/settings/#devvm-setup">devvm setup</a>).</p>
|
||
<h2 data-hextra-search-id="devvms-agent-store">devvm&rsquo;s agent store<span class="hx:absolute hx:-mt-20" id="devvms-agent-store"></span>
|
||
<a href="#devvms-agent-store" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm keeps the agents&rsquo; settings and logins on this machine in a store of its own, and every VM with an agent gets that agent&rsquo;s settings and logins from there. devvm never reads the agents&rsquo; own files in your home folder for a VM, such as <code>~/.claude</code>, <code>~/.claude.json</code>, <code>~/.codex</code>, <code>~/.config/opencode</code>, <code>~/.local/share/opencode</code> or <code>~/.pi/agent</code>, so a VM gets the same settings and logins whether or not this machine has the agent. The one command that reads those files is <a href="#importing-from-this-machine"><code>devvm agent import</code></a>, which copies them into the store when you run it, and <a href="#saving-a-vms-settings"><code>devvm agent save</code></a> copies the settings you changed in a VM into the store.</p>
|
||
<p>The store has two folders for each agent, and each one holds the agent&rsquo;s files at the same paths below it as the agent keeps them in a home folder:</p>
|
||
<ul>
|
||
<li><strong>Settings</strong> go in <code>~/.config/devvm/agents/&lt;agent&gt;/</code>, such as <code>~/.config/devvm/agents/claude/.claude/settings.json</code> and <code>~/.config/devvm/agents/claude/.claude/skills</code>. You can edit these files and make or delete these folders yourself, and a VM gets the change on its next launch, as <a href="#mounts">mounts</a> and <a href="#copies">copies</a> describe. Keep every folder from <code>~/.config/devvm/agents</code> down a real folder, because <code>devvm agent import</code> and <code>devvm agent save</code> never write the store through a link. When a link is on the path to what they&rsquo;d write, they fail and name it before they change anything.</li>
|
||
<li><strong>Logins</strong> go in <code>~/.local/share/devvm/logins/&lt;agent&gt;/</code>, such as <code>~/.local/share/devvm/logins/codex/.codex/auth.json</code> and <code>~/.local/share/devvm/logins/claude/.claude.json</code>, and so does a login that you make inside a VM, such as Codex&rsquo;s (<a href="#codex-and-opencode-logins">Codex and opencode logins</a>) or Claude Code&rsquo;s in <code>~/.local/share/devvm/logins/claude/.claude/.credentials.json</code> (<a href="#claude-code-login">Claude Code login</a>). Only you can read them, because devvm makes each agent&rsquo;s logins folder yours alone (mode 700) and each login file mode 600. On macOS, devvm keeps each agent&rsquo;s logins folder out of Time Machine&rsquo;s backups.</li>
|
||
</ul>
|
||
<p>Each VM gets its agents&rsquo; settings and logins from the store, but never your history. Transcripts, sessions and databases aren&rsquo;t in the store, and each VM&rsquo;s own stay in that VM. Before you leave an agent running unattended, read <a href="https://next.devvm.dev/docs/safety/#the-habits">staying safe</a> and <a href="https://next.devvm.dev/docs/safety/attack-vectors/#rogue-agents">rogue agents</a>.</p>
|
||
<div class="devvm-diagram" style="contain-intrinsic-block-size: auto 744px; --devvm-diagram-width: 704px"><svg xmlns="http://www.w3.org/2000/svg" class="pele pele-flowchart" viewBox="0 0 704 744" width="704" height="744" style="--_bg:var(--pele-bg,#fff);--_fg:var(--pele-fg,#1f1f1f);--_m:var(--pele-muted,#6e6e6e);--_l:var(--pele-line,#1f1f1f);--_s:var(--pele-surface,#f3f3f3);--_a:var(--pele-surface-alt,#e6e6e6);--_b:var(--pele-border,#8a8a8a);--_c:var(--pele-accent,#5b7bd5);color:var(--_fg);--_r:var(--pele-radius,4px);--_fm:var(--pele-font-mono,&quot;Departure Mono&quot;, monospace);font:14px sans-serif;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;font-family:var(--pele-font,&quot;Departure Mono&quot;, monospace)" fill="var(--_fg)" role="graphics-document document" aria-roledescription="flowchart" aria-labelledby="db17e8376495869e1--title" aria-describedby="db17e8376495869e1--desc"><title id="db17e8376495869e1--title">The agent store and a VM</title><desc id="db17e8376495869e1--desc">devvm agent import copies the agents' files from your home folder into devvm's agent store, but never your history. The store's settings folders are mounted into each VM read-only, and its settings files and logins are copied in on every launch, without your secrets. devvm agent save brings changed copies back after a diff and a yes. Each VM's own history goes to a .tar.gz on this machine with devvm history export or devvm rm, and comes back with devvm history import, or with yes when a new VM offers it.</desc><g class="pele-clusters"><g class="pele-cluster" data-id="guest"><rect x="8" y="410" width="585.45" height="142" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-cluster-label" fill="var(--_m)" x="48.73" y="433.4" text-anchor="middle">The VM</text>
|
||
</g><g class="pele-cluster" data-id="store"><rect x="72.41" y="149" width="433.18" height="137" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-cluster-label" fill="var(--_m)" x="171.05" y="172.4" text-anchor="middle">devvm's agent store</text>
|
||
</g></g><g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round"><g class="pele-edge" data-id="L_home_store_0"><path d="M289,68L289,142"/><path class="pele-marker" d="M289,149L285.64,141L292.36,141Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_folders_links_0"><path d="M186.14,246L186.14,292Q186.14,304 174.14,304L115.91,304Q103.91,304 103.91,316L103.91,460"/><path class="pele-marker" d="M103.91,467L100.55,459L107.27,459Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_files_copies_0"><path d="M405.23,246L405.23,292Q405.23,304 417.23,304L457.64,304Q469.64,304 469.64,316L469.64,380Q469.64,392 457.64,392L311.82,392Q299.82,392 299.82,404L299.82,460"/><path class="pele-marker" d="M299.82,467L296.46,459L303.18,459Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_copies_store_0"><path d="M276.82,467L276.82,310.09Q276.82,304 282.91,304Q289,304 289,297.91L289,293"/><path class="pele-marker" d="M289,286L292.36,294L285.64,294Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_own_export_0"><path d="M480.64,512L480.64,558Q480.64,570 468.64,570L393.09,570Q381.09,570 381.09,582L381.09,646Q381.09,658 393.09,658L447.57,658Q455.82,658 455.82,666.25L455.82,669"/><path class="pele-marker" d="M455.82,676L452.46,668L459.18,668Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_export_own_0"><path d="M521.45,676L521.45,668.13Q521.45,658 531.58,658L584.18,658Q596.18,658 596.18,646L596.18,582Q596.18,570 584.18,570L508.64,570Q496.64,570 496.64,558L496.64,519" stroke-dasharray="3 4"/><path class="pele-marker" d="M496.64,512L500,520L493.28,520Z" fill="var(--_l)" stroke="none"/></g></g><g class="pele-edge-labels" font-size="14"><g class="pele-edge-label" data-id="L_home_store_0"><rect x="200.36" y="92.5" width="177.27" height="32" rx="3" fill="var(--_bg)"/><text text-anchor="middle" xml:space="preserve"><tspan x="289" y="104.7">devvm agent import,</tspan><tspan x="289" y="120.7">never your history</tspan></text>
|
||
</g><g class="pele-edge-label" data-id="L_folders_links_0"><rect x="59.82" y="332" width="88.18" height="32" rx="3" fill="var(--_bg)"/><text text-anchor="middle" xml:space="preserve"><tspan x="103.91" y="344.2">mounted</tspan><tspan x="103.91" y="360.2">read-only</tspan></text>
|
||
</g><g class="pele-edge-label" data-id="L_files_copies_0"><rect x="398.82" y="324" width="141.64" height="48" rx="3" fill="var(--_bg)"/><text text-anchor="middle" xml:space="preserve"><tspan x="469.64" y="336.2">copied on every</tspan><tspan x="469.64" y="352.2">launch, without</tspan><tspan x="469.64" y="368.2">your secrets</tspan></text>
|
||
</g><g class="pele-edge-label" data-id="L_copies_store_0"><rect x="174.82" y="332" width="204" height="32" rx="3" fill="var(--_bg)"/><text text-anchor="middle" xml:space="preserve"><tspan x="276.82" y="344.2">devvm agent save,</tspan><tspan x="276.82" y="360.2">after a diff and a yes</tspan></text>
|
||
</g><g class="pele-edge-label" data-id="L_own_export_0"><rect x="283.55" y="598" width="195.09" height="32" rx="3" fill="var(--_bg)"/><text text-anchor="middle" xml:space="preserve"><tspan x="381.09" y="610.2">devvm history export,</tspan><tspan x="381.09" y="626.2">devvm rm</tspan></text>
|
||
</g><g class="pele-edge-label" data-id="L_export_own_0"><rect x="498.64" y="590" width="195.09" height="48" rx="3" fill="var(--_bg)"/><text text-anchor="middle" xml:space="preserve"><tspan x="596.18" y="602.2">devvm history import,</tspan><tspan x="596.18" y="618.2">or yes when a new VM</tspan><tspan x="596.18" y="634.2">offers it</tspan></text>
|
||
</g></g><g class="pele-nodes"><g class="pele-node pele-shape-rect" data-id="home" transform="translate(289,38)"><rect x="-102.64" y="-30" width="205.27" height="60" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">the agents' files</tspan><tspan x="0" y="13.9">in your home folder</tspan></text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="folders" transform="translate(186.14,216)"><rect x="-93.73" y="-30" width="187.45" height="60" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">settings folders:</tspan><tspan x="0" y="13.9">skills, plugins…</tspan></text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="files" transform="translate(405.23,216)"><rect x="-80.36" y="-30" width="160.73" height="60" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">settings files</tspan><tspan x="0" y="13.9">and logins</tspan></text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="links" transform="translate(103.91,489.5)"><rect x="-75.91" y="-22.5" width="151.82" height="45" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="0" y="4.9" text-anchor="middle">linked into ~</text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="copies" transform="translate(291.82,489.5)"><rect x="-67" y="-22.5" width="134" height="45" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="0" y="4.9" text-anchor="middle">copies in ~</text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="own" transform="translate(488.64,489.5)"><rect x="-84.82" y="-22.5" width="169.64" height="45" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="0" y="4.9" text-anchor="middle">its own history</text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="export" transform="translate(488.64,706)"><rect x="-84.82" y="-30" width="169.64" height="60" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">a .tar.gz</tspan><tspan x="0" y="13.9">on this machine</tspan></text>
|
||
</g></g></svg></div><p>Each row lists the agent&rsquo;s paths in the VM&rsquo;s home, and the store keeps each one at the same path below the agent&rsquo;s settings or logins folder:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th>Mounted read-only, linked into <code>~</code></th>
|
||
<th>Copied in on every launch</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>claude</td>
|
||
<td><code>~/.claude/{skills,agents,commands,output-styles}</code>, and the store&rsquo;s <code>~/.claude/plugins</code> at <code>~/.claude/plugins-seed</code> (<a href="#claude-codes-plugins">Claude Code&rsquo;s plugins</a>)</td>
|
||
<td><code>~/.claude/settings.json</code>, <code>~/.claude/CLAUDE.md</code>, and from the logins <code>~/.claude.json</code> (<a href="#copies">merged</a>, only its settings, account state and MCP servers)</td>
|
||
</tr>
|
||
<tr>
|
||
<td>codex</td>
|
||
<td><code>~/.codex/{prompts,skills}</code></td>
|
||
<td><code>~/.codex/{config.toml,AGENTS.md}</code>, and from the logins <code>~/.codex/auth.json</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>opencode</td>
|
||
<td>the subfolders of <code>~/.config/opencode</code> (not <code>node_modules</code>)</td>
|
||
<td>the files in <code>~/.config/opencode</code> (not lock files, <code>.gitignore</code>, <code>.DS_Store</code> or <a href="#opencodes-service">its service&rsquo;s settings</a>), and from the logins <code>~/.local/share/opencode/auth.json</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>pi</td>
|
||
<td><code>~/.pi/agent/{extensions,skills,prompts,themes}</code></td>
|
||
<td><code>~/.pi/agent/{settings.json,keybindings.json,models.json,mcp.json,AGENTS.md,SYSTEM.md,APPEND_SYSTEM.md}</code>, and from the logins <code>~/.pi/agent/auth.json</code></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<h3 data-hextra-search-id="importing-from-this-machine">Importing from this machine<span class="hx:absolute hx:-mt-20" id="importing-from-this-machine"></span>
|
||
<a href="#importing-from-this-machine" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>When you already use an agent on this machine, <code>devvm agent import</code> copies its settings and logins from your home folder into the store, so your VMs get them. With no argument it imports every agent that your home folder has files of, and <code>devvm agent import claude codex</code> imports only the agents you name:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm agent import <span class="c1"># copy every agent&#39;s settings and logins into the store</span>
|
||
</span></span><span class="line"><span class="cl">devvm agent import codex <span class="c1"># copy only Codex&#39;s</span>
|
||
</span></span><span class="line"><span class="cl">devvm agent import --force <span class="c1"># replace what the store has without asking</span>
|
||
</span></span><span class="line"><span class="cl">devvm agent import --follow-links <span class="c1"># copy what links out of the agents&#39; folders lead to as well</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>devvm says which agents it imported and where, and an agent you named that your home folder has nothing of gets a warning. What the import copies and asks:</p>
|
||
<ul>
|
||
<li>The import copies only the paths in the table above, so it never copies your history or <code>~/.claude/.credentials.json</code> (<a href="https://next.devvm.dev/docs/internals/agents/#importing">what it copies</a>). From <code>~/.claude.json</code> it keeps only the settings, account state and MCP servers, so your API key and your per-project entries stay out of the store. From <code>~/.claude/plugins</code> it copies only the marketplaces, their records and the plugins&rsquo; cache, never what is this machine&rsquo;s own, such as each plugin&rsquo;s data.</li>
|
||
<li>devvm reads each agent&rsquo;s settings inside the agent&rsquo;s own folder, such as <code>~/.claude</code>. A link to a file inside the folder becomes a copy of that file when that file is one of the settings that the import copies, such as <code>~/.claude/CLAUDE.md</code>. devvm leaves out a link to anything else inside the folder, such as your history, <code>~/.claude/.credentials.json</code> or a plugin&rsquo;s data, with a warning that names where it leads. It does the same with a link to a folder inside it and a link that leads nowhere, and it always leaves out a login file that&rsquo;s a link, with a warning. A link that leads out of the folder, by a relative or an absolute path, is copied only when you allow it (<a href="#links-out-of-an-agents-folder">links out of an agent&rsquo;s folder</a>).</li>
|
||
<li>One import copies at most 20,000 files, folders and links, 128 MiB, and 16 MiB in one file, of each agent&rsquo;s own folder, at most 128 folders deep. When the folder holds more, devvm imports nothing and names the folder, so take out what it doesn&rsquo;t need, such as a plugin&rsquo;s build files, and import again.</li>
|
||
<li>An import that fails leaves the store&rsquo;s settings and logins as they were, so run it again (<a href="https://next.devvm.dev/docs/internals/agents/#importing">how</a>). That holds whether it fails while it reads, such as at a file that changed meanwhile, or while it puts them in place, such as at a login it can&rsquo;t save. In the rare case that putting the store back also fails, devvm names the stores it couldn&rsquo;t put back and the folders that hold what it moved aside, so copy what you need from those before you import again, which deletes them.</li>
|
||
<li>On a Mac, whose volume ignores case by default, a file whose name differs from the store&rsquo;s only in case, such as <code>foo.md</code> where the store has <code>Foo.md</code>, replaces the store&rsquo;s file, which keeps its name. Two names that differ only in case, which your home folder can have only on a volume that tells case apart, would be one file in the store, so devvm imports nothing and names both.</li>
|
||
<li>Runs that write the store take turns. While another <code>devvm agent import</code> or <code>devvm agent save</code> writes it, or a start cleans it, devvm says it&rsquo;s waiting and goes on once that one is done.</li>
|
||
<li>When a VM&rsquo;s project folder is inside an agent&rsquo;s folder, such as a skill you work on in <code>~/.claude/skills</code>, or holds one, such as <code>~/.pi</code>, devvm warns that the VM can change the settings it imports for every VM, and each launch of such a VM also warns (<a href="https://next.devvm.dev/docs/using/settings/#project-folders-devvm-refuses">project folders devvm refuses</a>). Keep such a project somewhere else unless you trust that VM. When the path to an agent&rsquo;s folder passes through a link in a VM&rsquo;s project folder that leads elsewhere, devvm leaves that agent&rsquo;s folder out with a warning.</li>
|
||
<li>A VM whose state devvm can&rsquo;t read gets a warning that names the file, because devvm can&rsquo;t tell where its project folder is, and <code>devvm doctor</code> says what&rsquo;s wrong with it. That VM&rsquo;s project folder could hold a link, so until the state is fixed, devvm leaves out, with a warning that names the state, every link out of an agent&rsquo;s folder, and every agent&rsquo;s folder or login whose path leads through a link, such as an agent&rsquo;s folder that&rsquo;s a link to your dotfiles.</li>
|
||
<li>When the store already has settings or a login of an agent you import, devvm asks in a terminal whether to replace them, with no as the default. Without a terminal, or with <code>--no-input</code>, devvm refuses and names <code>--force</code>, which replaces them without asking. An agent whose settings aren&rsquo;t in your home folder keeps the store&rsquo;s settings, and one without a login there keeps the store&rsquo;s login.</li>
|
||
<li>On macOS, Claude Code keeps its own login in the Keychain, and devvm neither reads it nor copies it. You log Claude Code in from a VM instead, with <code>devvm agent login claude</code>, and every VM with Claude Code gets that login (<a href="#claude-code-login">Claude Code login</a>).</li>
|
||
<li>When this machine&rsquo;s opencode is version 2 or later, devvm saves the API key of each provider, and your OpenAI login when you made it with one of opencode&rsquo;s Codex logins, the browser or the headless one. Any other login is left out with a warning that names it, such as opencode&rsquo;s Sign in with ChatGPT, whose tokens a VM can&rsquo;t use, or another provider&rsquo;s OAuth login, and you log in from a VM instead, with <code>devvm agent login opencode</code> (<a href="#logging-in-with-devvm-agent-login">logging in with devvm agent login</a>). When <code>opencode auth export</code> fails, the import fails too, and the store keeps the login it had.</li>
|
||
</ul>
|
||
<h4 data-hextra-search-id="links-out-of-an-agents-folder">Links out of an agent&rsquo;s folder<span class="hx:absolute hx:-mt-20" id="links-out-of-an-agents-folder"></span>
|
||
<a href="#links-out-of-an-agents-folder" class="subheading-anchor" aria-label="Permalink for this section"></a></h4><p>When your settings live elsewhere, such as in a dotfiles repo with links into <code>~/.claude</code>, devvm copies what those links lead to only when you allow it, because every VM with the agent gets what&rsquo;s in the store. In a terminal, devvm names each link and where it leads, and asks whether to copy them, with no as the default. Without a terminal, or with <code>--no-input</code>, it leaves them out with a warning that names <code>--follow-links</code>. You allow them for one run with the flag, or for good with <code>config.toml</code>&rsquo;s <code>follow-links</code>, which lists the folders whose links devvm follows without asking:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm agent import --follow-links <span class="c1"># copy what the links lead to, naming each, without asking</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="c"># in ~/.config/devvm/config.toml: follow links into these folders without asking</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">follow-links</span> <span class="p">=</span> <span class="p">[</span><span class="s2">&#34;~/dotfiles&#34;</span><span class="p">]</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>What devvm copies through a link, and what it refuses:</p>
|
||
<ul>
|
||
<li><strong>Copies, never links.</strong> A linked file becomes a file in the store, and a linked folder, such as a skill that <code>~/.claude/skills/x</code> links to, becomes a folder of copies. Each import copies them again, and takes a copy out once its link is gone.</li>
|
||
<li><strong>Only inside the folder you allowed.</strong> devvm reads what a link leads to through a <code>follow-links</code> folder, or with <code>--follow-links</code> through the linked folder itself, or the linked file&rsquo;s own folder. A link inside a linked folder becomes a copy of the file it leads to only when that file is inside the same folder, and any other is left out with a warning.</li>
|
||
<li><strong>Never your secrets or devvm&rsquo;s own files.</strong> devvm never follows a link to your home folder or a folder that holds it, to devvm&rsquo;s own folders, to <code>~/.ssh</code>, <code>~/.gnupg</code>, <code>~/.aws</code>, <code>~/Library/Keychains</code>, <code>~/.config/devvm</code>, <code>~/.netrc</code>, <code>~/.config/gh</code>, <code>~/.docker</code> or <code>~/.kube</code>, or to an agent&rsquo;s logins or history, such as <code>~/.codex</code>, nor into one of these or to a folder that holds one. It leaves such a link out with a warning, even with <code>--follow-links</code>.</li>
|
||
<li><strong>A <code>follow-links</code> folder must be safe as a whole.</strong> A folder that is, holds or is inside one of those places fails the import, naming it, so name a folder inside it instead, such as <code>~/dotfiles/skills</code> when <code>~/.claude</code> is a link to <code>~/dotfiles/claude</code>. Write each folder as an absolute path or one that starts with <code>~/</code>, and devvm refuses anything else (<code>config.toml</code> names the line).</li>
|
||
<li><strong>A VM&rsquo;s project folder gets a warning.</strong> When a link leads into the folder of one of your VMs, <code>--clone</code> VMs included, devvm names that VM and warns that it can change what every VM&rsquo;s agent reads from the next import on. Follow such links only when you trust that VM. A link that passes through a link in a VM&rsquo;s project folder to a place outside that folder is left out with a warning naming the VM, whatever allows it, because that VM chose where it leads. While a VM&rsquo;s state can&rsquo;t be read, devvm can&rsquo;t tell where that VM&rsquo;s project folder is, so it leaves out every link, with a warning that names the state.</li>
|
||
<li><strong>At most 20,000 files and folders, 128 MiB, and 16 MiB in one file,</strong> for all the links of one import together. A link whose files would pass that is left out whole, with a warning.</li>
|
||
<li><strong>Settings files and folders keep their kind.</strong> A link that is one of an agent&rsquo;s settings files, such as <code>~/.claude/CLAUDE.md</code>, must lead to a file, and one that is a settings folder, such as <code>~/.claude/skills</code>, must lead to a folder. Any other is left out with a warning.</li>
|
||
</ul>
|
||
<p>Without either, two layouts keep your settings in a dotfiles repo and import them as they are. You can link the agent&rsquo;s whole folder, such as <code>~/.config/opencode</code>, to a folder in the repo, and devvm then reads that folder as the agent&rsquo;s folder, so its links to files inside it become copies. Or your dotfiles manager can write real files rather than links, as chezmoi does by default, so your home folder has files that devvm copies.</p>
|
||
<h3 data-hextra-search-id="saving-a-vms-settings">Saving a VM&rsquo;s settings<span class="hx:absolute hx:-mt-20" id="saving-a-vms-settings"></span>
|
||
<a href="#saving-a-vms-settings" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>When you change an agent&rsquo;s settings in a VM, for example by installing a Claude Code plugin there with <code>claude plugin install</code> or <code>/plugin</code>, or by changing <code>~/.claude/settings.json</code>, <code>devvm agent save</code> copies them into the store, so every VM with that agent gets them. With no argument it saves every agent that the folder&rsquo;s VM has, and <code>devvm agent save claude</code> saves only the agents you name. devvm starts a stopped VM for it. It reads only the settings, never the logins or your history, treats everything the VM sends as untrusted, and puts your secrets back where the VM&rsquo;s copies hold placeholders (<a href="https://next.devvm.dev/docs/internals/agents/#saving-a-vms-settings">how</a>).</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm agent save <span class="c1"># show what changed in the VM&#39;s agents&#39; settings, then save them</span>
|
||
</span></span><span class="line"><span class="cl">devvm agent save codex <span class="c1"># save only Codex&#39;s</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>It reads at most 128 MiB from the VM, in at most 20,000 files, folders and links, none of the files larger than 16 MiB, at most 128 folders deep and in paths of at most 4,096 bytes. The VM sends only what the store keeps, as the table above lists, so opencode&rsquo;s lock files, such as the <code>bun.lock</code> that its plugins&rsquo; installs write, stay in the VM. When the VM sends more, or sends a path outside the agents&rsquo; settings, devvm saves nothing. A save that fails partway leaves the store as it was.</p>
|
||
<p>For example, to give every VM a plugin that you install in one:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">claude plugin install my-plugin@my-marketplace <span class="c1"># in the VM: installs into the VM&#39;s own ~/.claude/plugins</span>
|
||
</span></span><span class="line"><span class="cl">devvm agent save claude <span class="c1"># on this machine, in the project folder: copies it into the store</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Before it saves anything, devvm shows what would change:</p>
|
||
<ul>
|
||
<li>For each folder it lists the files it adds (A), changes (M) and removes (D), and then it shows a diff of each file it adds or changes against the store&rsquo;s copy, with a line when a file&rsquo;s mode changes.</li>
|
||
<li>The diff shows the settings files and <code>~/.claude.json</code> as a VM gets them, written out again with <code>devvm-redacted</code> in place of the values that look like secrets, so it never prints your secrets, and it says so when only those values or the file&rsquo;s layout changed.</li>
|
||
<li>Every character that a terminal wouldn&rsquo;t show, such as a control character, a zero-width character or a character that reverses the text, appears in the diff as its code, such as <code>\u{200b}</code>, so a VM can&rsquo;t hide a line from you.</li>
|
||
<li>The diff names a binary file without showing it, and it shows a file of more than 1 MiB or 10,000 lines, and every line past the first 20,000 of the whole diff, only as a count.</li>
|
||
<li>On a Mac, whose volume ignores case by default, a file whose name differs from the store&rsquo;s only in case, such as <code>foo.md</code> where the store has <code>Foo.md</code>, is the store&rsquo;s file, so the diff shows it as changed and the store keeps its name.</li>
|
||
<li>Two names in the VM that differ only in case, such as <code>A.md</code> and <code>a.md</code>, would be one file in the store on a Mac, so once you say yes, devvm saves nothing and names both, and you rename one of them in the VM.</li>
|
||
</ul>
|
||
<p>Then devvm says that every VM with these agents runs the hooks, the MCP servers&rsquo; commands and the plugins you save, and it asks whether to save them, with no as the default. Read the diff before you answer, because a hook or a plugin that a <a href="https://next.devvm.dev/docs/safety/attack-vectors/#rogue-agents">rogue agent</a> added in one VM runs in every VM once you save it. devvm agent save always asks, and no flag answers for you, so without a terminal, or with <code>--no-input</code>, it shows what would change and then refuses. What devvm doesn&rsquo;t save:</p>
|
||
<ul>
|
||
<li><strong>A file where the VM changed what&rsquo;s around a placeholder,</strong> which devvm leaves out with a warning, so make that change in the store&rsquo;s file yourself.</li>
|
||
<li><strong>Anything, when the store changed after devvm showed what differs,</strong> as when you ran <code>devvm agent import</code> meanwhile, so run <code>devvm agent save</code> again to see what differs now.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="mounts">Mounts<span class="hx:absolute hx:-mt-20" id="mounts"></span>
|
||
<a href="#mounts" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm mounts the store&rsquo;s settings folders that exist when it creates the VM read-only, at the same path as in the store on this machine, and links them from the VM&rsquo;s home. This machine enforces read-only, so even root in the VM can&rsquo;t write to them (<a href="https://next.devvm.dev/docs/internals/agents/#mounts">links and paths in them</a>).</p>
|
||
<ul>
|
||
<li>devvm mounts each folder whole, whatever the VM&rsquo;s network tier, so the VM reads every file in it, a <code>.env</code> or a key file in a plugin&rsquo;s folder included, and the git config of a private plugin marketplace whose URL holds a password. devvm takes no secrets out of these folders, because they hold plugins, skills and their scripts that the agent runs as they are. So keep secrets out of these folders, as you keep them out of the project folder (<a href="https://next.devvm.dev/docs/internals/network/#what-stays-in-the-vms-copies">why devvm mounts them whole</a>).</li>
|
||
<li>When <code>devvm agent import</code> or <code>devvm agent save</code> copies a Claude Code marketplace that has a password or an access token in its clone&rsquo;s git config, or in its source in <code>known_marketplaces.json</code>, it copies it as it is and warns, naming the marketplace, the store&rsquo;s file and the keys that hold it, never the credential (<a href="https://next.devvm.dev/docs/internals/agents/#mounts">what it checks</a>). Take the credential out of that file and of the marketplace on this machine, and keep it in a credential helper instead.</li>
|
||
<li>devvm doesn&rsquo;t mount a folder whose path has a comma, on any backend, and it warns you.</li>
|
||
</ul>
|
||
<p>When you make or delete one of these folders in the store later, by hand or with <code>devvm agent import</code>, devvm notices on the VM&rsquo;s next launch and names the folder. A VM&rsquo;s mounts change only when it starts, so a stopped VM gets the new mounts as the launch starts it. For a running VM, devvm asks in a terminal whether to restart it now, which stops anything running in it, in the one question that covers every change waiting for the VM&rsquo;s next start, and because the mounts are among those changes, the default answer is yes (<a href="https://next.devvm.dev/docs/using/vms/#restarting-and-stopping">restarting</a>). If you answer no, or there&rsquo;s no terminal, or you pass <code>--no-input</code>, the mounts change when the VM next starts, for example with <code>devvm restart</code>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm restart <span class="c1"># give a running VM the store&#39;s new folders now</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="claude-codes-plugins">Claude Code&rsquo;s plugins<span class="hx:absolute hx:-mt-20" id="claude-codes-plugins"></span>
|
||
<a href="#claude-codes-plugins" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Claude Code writes into its plugins folder as it runs, for each plugin&rsquo;s data, for the plugins you install and for its marketplaces&rsquo; updates, so each VM&rsquo;s <code>~/.claude/plugins</code> is its own folder, on the VM&rsquo;s disk. The store&rsquo;s <code>~/.claude/plugins</code> is mounted read-only and linked at <code>~/.claude/plugins-seed</code>, and Claude Code reads it as its seed, a plugins folder it never writes. Every shell in the VM names both for Claude Code, with <code>CLAUDE_CODE_PLUGIN_CACHE_DIR</code> and <code>CLAUDE_CODE_PLUGIN_SEED_DIR</code> (<a href="https://next.devvm.dev/docs/internals/agents/#claude-codes-plugins">how</a>). What that means in a VM:</p>
|
||
<ul>
|
||
<li>A plugin in the store loads when <code>enabledPlugins</code> in <code>~/.claude/settings.json</code> turns it on, as it does on this machine, and Claude Code keeps its data in the VM&rsquo;s own <code>~/.claude/plugins/data</code>.</li>
|
||
<li>A plugin you install in the VM goes into the VM&rsquo;s own folder, and only that VM has it until you <a href="#saving-a-vms-settings">save it</a>. The save copies the plugins you installed and their marketplaces into the store, and it never takes a plugin out of the store, so remove one in the store&rsquo;s folder yourself, or import your machine&rsquo;s plugins again.</li>
|
||
<li>Claude Code doesn&rsquo;t update the store&rsquo;s marketplaces in a VM, and <code>claude plugin marketplace update</code> refuses them, so update a marketplace on this machine and run <code>devvm agent import claude</code> again.</li>
|
||
<li>Neither <code>devvm agent import</code> nor <code>devvm agent save</code> copies what is each machine&rsquo;s own, such as each plugin&rsquo;s data, and an export of the VM&rsquo;s history leaves out the VM&rsquo;s plugins folder.</li>
|
||
<li>When the store holds such entries, as an import by devvm 0.1.0 left there, a VM&rsquo;s start takes them out of the store and warns once, naming them, and leaves your own folder as it is. When devvm can&rsquo;t take them out, or the store&rsquo;s <code>~/.claude/plugins</code> is a link or below one, a VM with Claude Code doesn&rsquo;t start until that folder is one of its own that holds only <code>known_marketplaces.json</code>, <code>marketplaces</code> and <code>cache</code> (<a href="https://next.devvm.dev/docs/internals/agents/#claude-codes-plugins">how</a>).</li>
|
||
</ul>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">claude plugin list <span class="c1"># in the VM: the store&#39;s plugins and the VM&#39;s own</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="copies">Copies<span class="hx:absolute hx:-mt-20" id="copies"></span>
|
||
<a href="#copies" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm copies the store&rsquo;s files into the VM&rsquo;s home on every launch, over the VM&rsquo;s own. On every <a href="https://next.devvm.dev/docs/safety/network/#network-tiers">network tier</a>, the copies of the logins and settings files have your secrets taken out, and the VM&rsquo;s proxy puts them into requests instead (<a href="https://next.devvm.dev/docs/internals/network/#agents-logins-and-settings">agents&rsquo; logins and settings</a>). devvm merges the store&rsquo;s <code>.claude.json</code> into the VM&rsquo;s own, so servers added in the VM stay, and it merges Claude Code&rsquo;s login into the VM&rsquo;s <code>~/.claude/.credentials.json</code>, so <a href="#mcp-servers-logins">MCP servers&rsquo; logins</a> made in the VM also stay. It writes <code>devvm-redacted</code> in place of each secret in the settings files, names what it replaced in each file, and names each file it didn&rsquo;t copy (<a href="https://next.devvm.dev/docs/internals/agents/#copies">what it takes out</a>).</p>
|
||
<h3 data-hextra-search-id="claude-code-login">Claude Code login<span class="hx:absolute hx:-mt-20" id="claude-code-login"></span>
|
||
<a href="#claude-code-login" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>You log Claude Code in once, from inside any VM that has it, and devvm keeps the login on this machine for every VM with Claude Code, so this machine never needs Claude Code:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm agent login claude <span class="c1"># log Claude Code in to your Claude subscription</span>
|
||
</span></span><span class="line"><span class="cl">devvm agent login claude --setup-token <span class="c1"># get a long-lived Claude Code token with claude setup-token instead</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>devvm starts the folder&rsquo;s VM first if it&rsquo;s stopped, as <code>devvm host</code> does, and then runs Claude Code&rsquo;s own login in the VM, on your terminal: <code>claude auth login --claudeai</code>, or <code>claude setup-token</code> with <code>--setup-token</code>. Claude Code shows an address, which you open in a browser on any machine. When you approve the login there, the browser shows a code, which you paste back at Claude Code&rsquo;s prompt, so devvm forwards no port. The VM uses the login at once, and every other VM with Claude Code gets it from its next launch (<a href="https://next.devvm.dev/docs/internals/agents/#claude-codes-login">how</a>). When the login ends without a new login in the store, such as when Ctrl-C ends Claude Code&rsquo;s login in the VM, devvm says so and fails. Run <code>--setup-token</code> in a terminal, because <code>claude setup-token</code> draws on one and shows nothing without it, and devvm warns when there&rsquo;s none (<a href="https://next.devvm.dev/docs/internals/network/#logins-made-in-a-vm">how the login gets a terminal</a>).</p>
|
||
<p>devvm keeps one Claude Code login, either your subscription&rsquo;s login or a Claude Code token, and the newest replaces the other, so every VM uses the account you logged in to last:</p>
|
||
<ul>
|
||
<li><strong>Your subscription&rsquo;s login</strong>, from <code>devvm agent login claude</code> or a <code>claude /login</code> that you run in a VM yourself, goes in devvm&rsquo;s agent store, in <code>~/.local/share/devvm/logins/claude/.claude/.credentials.json</code>, only yours to read. The VM&rsquo;s <code>~/.claude/.credentials.json</code> holds placeholders, with no refresh token and an expiry in 2099, so Claude Code in the VM never refreshes the login itself. The VM&rsquo;s proxy puts the login into the VM&rsquo;s requests to <code>api.anthropic.com</code> and to <code>mcp-proxy.anthropic.com</code>, the host of your claude.ai connectors, and refreshes it on this machine when it&rsquo;s due, through the company proxy when <code>config.toml</code> names one. devvm keeps only a login that can use Claude&rsquo;s models and can&rsquo;t make API keys, so a login to an Anthropic Console account, which Claude Code uses to make an API key, fails in a VM, and no API key reaches it. Only a VM that has Claude Code can log it in.</li>
|
||
<li><strong>A Claude Code token</strong>, from <code>devvm agent login claude --setup-token</code> or a <code>claude setup-token</code> that you run in a VM yourself, goes with the other <a href="https://next.devvm.dev/docs/safety/network/#saving-and-binding-secrets">secrets</a>. You can also save one with <code>devvm secret set claude</code> and paste the token that <code>claude setup-token</code> printed on another machine (<code>sk-ant-oat01-…</code>), not the code the browser shows. devvm neither saves nor sends a Claude Code token that isn&rsquo;t a setup token. Every VM with Claude Code gets the token in its environment as <code>CLAUDE_CODE_OAUTH_TOKEN</code>, holding a placeholder of its own, and its proxy puts the token into its requests. When you set up a token in a VM, <code>claude setup-token</code> prints that VM&rsquo;s placeholder, not the token, because devvm already saved it.</li>
|
||
</ul>
|
||
<p>A <code>CLAUDE_CODE_OAUTH_TOKEN</code> in devvm&rsquo;s own environment on this machine wins over both, as it does in Claude Code, so VMs get that token, and <code>devvm agent login claude</code> warns you when it&rsquo;s set. With your subscription&rsquo;s login, and only with it, a VM can use your claude.ai connectors, and <a href="https://next.devvm.dev/docs/safety/attack-vectors/#the-network">your claude.ai connectors</a> says how to stop that. Anthropic doesn&rsquo;t document the requests that Claude Code&rsquo;s login sends, so devvm follows the ones Claude Code sends today, and a new Claude Code release can change them. When a login in a VM stops working, run <code>devvm agent login claude</code> again, or save a Claude Code token instead.</p>
|
||
<h4 data-hextra-search-id="mcp-servers-logins">MCP servers&rsquo; logins<span class="hx:absolute hx:-mt-20" id="mcp-servers-logins"></span>
|
||
<a href="#mcp-servers-logins" class="subheading-anchor" aria-label="Permalink for this section"></a></h4><p>You log Claude Code in to an MCP server that asks for a login inside the VM, the way you would on this machine:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">/mcp # in Claude Code in the VM: pick the server and log in to it</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Claude Code keeps these logins in the VM&rsquo;s <code>~/.claude/.credentials.json</code>, beside the Claude login, and they&rsquo;re the VM&rsquo;s own (<a href="https://next.devvm.dev/docs/internals/agents/#claude-codes-login">how</a>):</p>
|
||
<ul>
|
||
<li><strong>They stay in the VM.</strong> Each launch replaces only the Claude login in that file and keeps the rest, so a login you make lasts across launches.</li>
|
||
<li><strong>They hold real tokens,</strong> which code in the VM can read, and they never reach this machine, another VM, <code>devvm agent save</code> or an export of the VM&rsquo;s history.</li>
|
||
<li><strong>They don&rsquo;t come along when devvm makes the VM again,</strong> such as to add a layer, so you log in to those servers again there (<a href="https://next.devvm.dev/docs/using/images/#what-a-vm-made-again-keeps">what a VM made again keeps</a>).</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="codex-and-opencode-logins">Codex and opencode logins<span class="hx:absolute hx:-mt-20" id="codex-and-opencode-logins"></span>
|
||
<a href="#codex-and-opencode-logins" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>You log Codex and opencode in from inside a VM, with <a href="#logging-in-with-devvm-agent-login"><code>devvm agent login</code></a>, and devvm keeps the login on this machine for every VM with that agent:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm agent login codex <span class="c1"># log Codex in to ChatGPT in a browser on this machine</span>
|
||
</span></span><span class="line"><span class="cl">devvm agent login opencode <span class="c1"># log opencode in with its Codex login, the same way</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>On every network tier, the VM&rsquo;s <code>auth.json</code> holds placeholders, and its proxy holds the real API keys and logins, so when the agent in the VM stops getting answers, the proxy&rsquo;s own log, <code>proxy.log</code> in <code>~/.local/share/devvm/vms/&lt;hash&gt;/logs/</code>, may say that refreshing a login failed or that you&rsquo;re no longer logged in that way. To log in again, run <a href="#logging-in-with-devvm-agent-login"><code>devvm agent login codex</code> or <code>devvm agent login opencode</code></a> in the VM&rsquo;s folder, which also gives that VM the new login&rsquo;s placeholders, and the other VMs get them on their next launch. Some logins stay on this machine, and devvm names each at every launch (<a href="https://next.devvm.dev/docs/internals/agents/#codexs-and-opencodes-logins">how</a>):</p>
|
||
<ul>
|
||
<li>Codex&rsquo;s other logins, such as a personal access token or an Amazon Bedrock key, so to use Codex in a VM, log in with ChatGPT or an OpenAI API key (<a href="#logging-in-with-devvm-agent-login">logging in with devvm agent login</a>).</li>
|
||
<li>opencode&rsquo;s other entries, such as another provider&rsquo;s API key or an OAuth login, which the VM gets without its key or its tokens. To use an OAuth login&rsquo;s provider in the VM, log in to it with an API key on this machine and import the login again.</li>
|
||
<li>Claude Code&rsquo;s account fields in <code>~/.claude.json</code> other than the ones it writes there today.</li>
|
||
</ul>
|
||
<p>To give the VM one provider&rsquo;s API key as it is, such as a local model server&rsquo;s that the VM&rsquo;s proxy can&rsquo;t put in, list the provider under <code>opencode</code> in <code>config.toml</code>&rsquo;s <code>[pass-keys]</code> table (<a href="https://next.devvm.dev/docs/using/settings/#configtoml">config.toml</a>), as you would for <a href="#pi-logins">pi</a>. The provider is its entry&rsquo;s name in opencode&rsquo;s <code>auth.json</code>, such as <code>ollama</code>. Every VM with opencode then gets that entry whole, its <code>metadata</code> included, and opencode 2 in the VM imports it into its database too, and devvm says so at each launch. It applies only to entries with an API key, because a VM never gets a login&rsquo;s tokens, and only to providers whose keys the proxy doesn&rsquo;t put in, because a key the proxy puts in is always its placeholder:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="p">[</span><span class="nx">pass-keys</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">opencode</span> <span class="p">=</span> <span class="p">[</span><span class="s2">&#34;ollama&#34;</span><span class="p">]</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>So when opencode in a VM can&rsquo;t reach a provider whose key works on this machine, such as a local model server&rsquo;s, and devvm&rsquo;s warning at launch names that provider, add it to <code>[pass-keys]</code> and run devvm in the folder again.</p>
|
||
<h4 data-hextra-search-id="logging-in-with-devvm-agent-login">Logging in with devvm agent login<span class="hx:absolute hx:-mt-20" id="logging-in-with-devvm-agent-login"></span>
|
||
<a href="#logging-in-with-devvm-agent-login" class="subheading-anchor" aria-label="Permalink for this section"></a></h4><p><code>devvm agent login</code> logs Codex or opencode in from inside this folder&rsquo;s VM, so this machine never needs either agent, and devvm&rsquo;s agent store keeps the login for every VM with that agent. Claude Code&rsquo;s login is <code>devvm agent login claude</code> (<a href="#claude-code-login">Claude Code login</a>), and pi&rsquo;s is an API key alone (<a href="#pi-logins">pi logins</a>):</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm agent login codex <span class="c1"># log Codex in to ChatGPT in a browser on this machine</span>
|
||
</span></span><span class="line"><span class="cl">devvm agent login opencode --device-code <span class="c1"># log opencode in with a code, in a browser on any machine</span>
|
||
</span></span><span class="line"><span class="cl">devvm agent login codex --api-key <span class="c1"># save Codex&#39;s OpenAI API key, asking for it</span>
|
||
</span></span><span class="line"><span class="cl">devvm agent login codex --api-key --stdin &lt; key.txt <span class="c1"># save it from a file or a pipe</span>
|
||
</span></span><span class="line"><span class="cl">devvm agent login opencode --api-key --provider anthropic <span class="c1"># save opencode&#39;s Anthropic API key</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>devvm starts the folder&rsquo;s VM first if it&rsquo;s stopped, as <code>devvm host</code> does, and the VM must have the agent, which <code>devvm tools add codex</code> gives it. Then devvm logs the agent in one of three ways:</p>
|
||
<ul>
|
||
<li><strong>In a browser on this machine</strong>, by default: <code>codex login</code> for Codex, and <code>opencode auth login openai --method chatgpt-browser</code>, opencode&rsquo;s Codex browser login, for opencode. The agent shows an address, which you open in a browser on this machine, and devvm forwards this machine&rsquo;s <code>localhost:1455</code> to the VM while the login runs (<a href="https://next.devvm.dev/docs/internals/agents/#logging-in">how</a>). When another program on this machine has port 1455, devvm refuses and names <code>--device-code</code>.</li>
|
||
<li><strong>With <code>--device-code</code></strong>, the agent shows a code instead, which you type into a browser on any machine, and devvm forwards nothing. Codex&rsquo;s device code login is <code>codex login --device-auth</code>, which your ChatGPT account&rsquo;s security settings must allow, and opencode&rsquo;s is <code>opencode auth login openai --method chatgpt-headless</code>, its Codex device code login.</li>
|
||
<li><strong>With <code>--api-key</code></strong>, devvm asks for the API key without showing it, or reads it from a line of input with <code>--stdin</code>, and saves it in the store itself, so the key never goes into the VM. Codex&rsquo;s key is an OpenAI key, and it replaces Codex&rsquo;s ChatGPT login in the store, as <code>codex login --with-api-key</code> does. opencode&rsquo;s key is for the provider that <code>--provider</code> names, by one of the IDs in <a href="#api-keys-the-proxy-puts-in">API keys the proxy puts in</a>, and the store keeps opencode&rsquo;s other providers beside it.</li>
|
||
</ul>
|
||
<p>opencode&rsquo;s Anthropic login is an API key, because opencode itself has no other way to log in to Anthropic. opencode&rsquo;s Claude Agent provider uses Claude Code&rsquo;s own login instead, so it works in a VM that has Claude Code too, with the login that <code>devvm agent login claude</code> saves. When the agent logs in, the VM&rsquo;s proxy saves the login in the store, and the agent in the VM gets placeholders, as <a href="#logins-made-in-a-vm">the next section</a> describes. devvm then says what the store saved and the account&rsquo;s email, and the VM uses the login at once. When the login ends without a new login in the store, for example because you chose another way to log in, devvm says so and fails, and <code>devvm network log</code> shows each login the proxy saved.</p>
|
||
<h4 data-hextra-search-id="logins-made-in-a-vm">Logins made in a VM<span class="hx:absolute hx:-mt-20" id="logins-made-in-a-vm"></span>
|
||
<a href="#logins-made-in-a-vm" class="subheading-anchor" aria-label="Permalink for this section"></a></h4><p>A login that Codex or opencode makes in a VM, whether <code>devvm agent login</code> runs it or you run it yourself, is saved in devvm&rsquo;s store, and every VM with that agent gets it from its next launch. A login that shows a code to type into a browser works in a VM as it is, but opencode&rsquo;s Sign in with ChatGPT doesn&rsquo;t, so choose one of opencode&rsquo;s Codex logins instead, as <code>devvm agent login opencode</code> does (<a href="https://next.devvm.dev/docs/internals/agents/#logins-made-in-a-vm">how a VM&rsquo;s logins are saved</a>). On the open tier, a program that goes around the VM&rsquo;s proxy gets the login&rsquo;s tokens itself, and devvm saves nothing (<a href="https://next.devvm.dev/docs/internals/network/#logins-made-in-a-vm">logins made in a VM</a>).</p>
|
||
<h3 data-hextra-search-id="opencodes-service">opencode&rsquo;s service<span class="hx:absolute hx:-mt-20" id="opencodes-service"></span>
|
||
<a href="#opencodes-service" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>opencode&rsquo;s background service, which opencode starts when it needs one, asks for a password when you sign in to it, and each VM&rsquo;s opencode makes its own the first time its service starts. To sign in to a VM&rsquo;s service, such as from opencode&rsquo;s app, read that VM&rsquo;s password in the VM:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">opencode service get password <span class="c1"># in the VM: its service&#39;s password, made now if it has none</span>
|
||
</span></span><span class="line"><span class="cl">opencode service <span class="nb">set</span> password PASSWORD <span class="c1"># in the VM: choose another, which stops its service</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<ul>
|
||
<li>devvm never copies this machine&rsquo;s opencode service settings into its agent store or a VM. They&rsquo;re <code>service.json</code> in <code>~/.config/opencode</code>, or <code>service-&lt;channel&gt;.json</code> for another channel&rsquo;s opencode, and they hold this machine&rsquo;s service password and, with remote access on, the secret route that the service is served on. So <code>devvm agent import</code> and <code>devvm agent save</code> leave them out, and each VM&rsquo;s service settings stay in that VM.</li>
|
||
<li>When devvm&rsquo;s agent store holds them, a VM&rsquo;s start takes them out and warns once, and each VM&rsquo;s setup takes out any copy of them that devvm made, so the VM&rsquo;s opencode makes its own password (<a href="https://next.devvm.dev/docs/internals/agents/#opencodes-service">how</a>).</li>
|
||
<li>A service that&rsquo;s running keeps the password it started with, so after that warning, restart each running VM that has opencode:</li>
|
||
</ul>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm restart <span class="c1"># in the VM&#39;s folder: its opencode service starts again with a password of its own</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="pi-logins">pi logins<span class="hx:absolute hx:-mt-20" id="pi-logins"></span>
|
||
<a href="#pi-logins" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>pi in a VM uses API keys that devvm keeps on this machine, for the providers whose keys the VM&rsquo;s proxy puts in, which <a href="#api-keys-the-proxy-puts-in">API keys the proxy puts in</a> lists. You save one with <code>devvm agent login pi --api-key --provider PROVIDER</code>, because pi&rsquo;s login always takes both flags, or you import the API keys in your own <code>~/.pi/agent/auth.json</code> with <code>devvm agent import pi</code>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm agent login pi --api-key --provider anthropic <span class="c1"># save pi&#39;s Anthropic API key, asking for it</span>
|
||
</span></span><span class="line"><span class="cl">devvm agent import pi <span class="c1"># copy pi&#39;s settings and auth.json from this machine</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<ul>
|
||
<li>The login needs a VM with pi in this folder, which it gives its copy of the login at once, and every other VM with pi gets it at its next launch.</li>
|
||
<li>The VM gets a placeholder in place of each key, and devvm keeps pi&rsquo;s other entries on this machine, such as a local model server&rsquo;s API key, a key that&rsquo;s a command for pi to run and a key that pi fills in from a variable, even for a provider whose key the proxy puts in, and warns you about each (<a href="https://next.devvm.dev/docs/internals/agents/#pis-logins">how</a>).</li>
|
||
</ul>
|
||
<p>To give the VM one provider&rsquo;s API key as it is, such as a local model server&rsquo;s that the VM&rsquo;s proxy can&rsquo;t put in, list the provider under <code>pi</code> in <code>config.toml</code>&rsquo;s <code>[pass-keys]</code> table (<a href="https://next.devvm.dev/docs/using/settings/#configtoml">config.toml</a>). Every VM with pi then gets that entry whole, its <code>env</code> included, and devvm says so at each launch. It applies only to entries with an API key, because a VM never gets a login&rsquo;s tokens, and only to providers whose keys the proxy doesn&rsquo;t put in, because a key the proxy puts in is always its placeholder:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="p">[</span><span class="nx">pass-keys</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">pi</span> <span class="p">=</span> <span class="p">[</span><span class="s2">&#34;ollama&#34;</span><span class="p">]</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>pi&rsquo;s own logins with an account, which <code>/login</code> and <code>pi auth login</code> make for a subscription, such as Claude&rsquo;s, ChatGPT&rsquo;s or GitHub Copilot&rsquo;s, aren&rsquo;t among the logins devvm keeps, so save the provider&rsquo;s API key instead. Don&rsquo;t log pi in with an account inside a VM either, because the VM&rsquo;s proxy would save it as another agent&rsquo;s login or refuse it (<a href="https://next.devvm.dev/docs/internals/agents/#pis-logins">pi&rsquo;s logins</a>).</p>
|
||
<h4 data-hextra-search-id="pis-settings">pi&rsquo;s settings<span class="hx:absolute hx:-mt-20" id="pis-settings"></span>
|
||
<a href="#pis-settings" class="subheading-anchor" aria-label="Permalink for this section"></a></h4><p>Two of pi&rsquo;s settings act differently in a VM:</p>
|
||
<ul>
|
||
<li>The VM&rsquo;s copy of pi&rsquo;s <code>settings.json</code> leaves out three keys, because each would undo what devvm sets in the VM, and devvm names the ones it left out. <code>httpProxy</code> would send pi around the VM&rsquo;s proxy, <code>sessionDir</code> would keep pi&rsquo;s sessions outside <code>~/.pi/agent/sessions</code>, where history exports look for them, and <code>selfUpdateCommand</code> would run a command of the file&rsquo;s on <code>pi update</code>. When <code>devvm agent save pi</code> saves the VM&rsquo;s <code>settings.json</code>, its diff shows those keys as taken out, so save it only when you mean to drop them from the store&rsquo;s copy too.</li>
|
||
<li>When the store&rsquo;s <code>settings.json</code> sets <code>defaultProjectTrust</code> to <code>always</code>, devvm warns you at each launch. That setting makes pi load a project folder&rsquo;s own <code>.pi</code> extensions, settings and MCP servers without asking, and they run in the VM with pi, so set it to <code>ask</code> in devvm&rsquo;s agent store unless you trust every project you open.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="cursor-cli-login">Cursor CLI login<span class="hx:absolute hx:-mt-20" id="cursor-cli-login"></span>
|
||
<a href="#cursor-cli-login" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Cursor&rsquo;s CLI runs in the VM as <code>cursor-agent</code>, or <code>agent</code>, its other name. You log it in once, from inside any VM that has it, and devvm keeps the login on this machine for every VM with the CLI:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm agent login cursor</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>devvm starts the folder&rsquo;s VM first if it&rsquo;s stopped, as <code>devvm host</code> does, and then runs <code>cursor-agent login</code> in the VM, on your terminal, with <code>NO_OPEN_BROWSER=1</code>, so the CLI prints an address rather than opening a browser in the VM. You open that address in a browser on any machine and approve the login, and the CLI waits for it, so devvm forwards no port. The VM&rsquo;s proxy saves the login as Cursor&rsquo;s API hands it to the CLI, in <code>~/.local/share/devvm/logins/cursor/.config/cursor/auth.json</code>, only yours to read, and the CLI in the VM gets placeholders. A <code>cursor-agent login</code> that you run in a VM yourself is saved in the same way, and every VM with the CLI gets the login from its next launch.</p>
|
||
<ul>
|
||
<li>Cursor&rsquo;s CLI never refreshes a login, so devvm doesn&rsquo;t either. When the login expires, the proxy puts nothing in, and its own log says to log in again with <code>devvm agent login cursor</code>. devvm doesn&rsquo;t keep a Cursor API key, so <code>devvm agent login cursor</code> takes neither <code>--api-key</code> nor <code>--device-code</code>.</li>
|
||
<li><code>devvm agent import cursor</code> copies the CLI&rsquo;s settings from <code>~/.cursor</code> on this machine, which are <code>cli-config.json</code>, <code>mcp.json</code> and the <code>rules</code> and <code>commands</code> folders. On Linux it copies the CLI&rsquo;s login from <code>~/.config/cursor/auth.json</code> too. On macOS the CLI keeps its login in the Keychain, which devvm doesn&rsquo;t read, so log in from a VM instead.</li>
|
||
<li>The CLI would update itself in the VM, but every VM sets its channel to <code>static</code> in <code>~/.cursor/cli-config.json</code> at each launch, which the CLI never updates on, so it stays the release that devvm pins. Cursor&rsquo;s CLI has no setting that turns off its reports to Cursor, so its allowlist leaves out the host it sends its metrics to, <code>api3.cursor.sh</code>, which Cursor documents for its editor&rsquo;s Tab requests, and the reports it sends to Cursor&rsquo;s API go with the rest. That host is <a href="https://next.devvm.dev/docs/safety/network/#quiet-hosts">quiet</a>, so its blocks never show in the VM. If Cursor Tab doesn&rsquo;t work in a <a href="https://next.devvm.dev/docs/using/ssh/#cursors-agent"><code>devvm cursor</code></a> window on the allowlist tier, <code>devvm network allow api3.cursor.sh</code> lets it through.</li>
|
||
<li>In a VM, Cursor&rsquo;s CLI can&rsquo;t install, update or remove plugins and marketplaces, change automations or cloud agents&rsquo; environments, start, fork, pin or merge the work of a cloud agent, or change your team, because each of those changes your Cursor account in a way that outlasts the VM and acts outside it. Do them from Cursor on your machine. Cursor&rsquo;s agent store isn&rsquo;t available in a VM either, so use it from Cursor on your machine. The CLI in a VM keeps its own chats without the store. Checking Amazon Bedrock keys doesn&rsquo;t work in a VM either, as devvm doesn&rsquo;t keep them.</li>
|
||
<li><code>cursor-agent worker</code>, which makes the machine a worker that runs your cloud agents&rsquo; work, doesn&rsquo;t work in a VM, because the proxy never puts the login into its requests, and its host, <code>api2direct.cursor.sh</code>, isn&rsquo;t among the Cursor hosts the allowlist tier lets through (<a href="https://next.devvm.dev/docs/internals/network/#logins-made-in-a-vm">how</a>).</li>
|
||
<li>The VM&rsquo;s proxy puts the real login only into the requests that the CLI&rsquo;s own methods make, and cuts a reply off where a token starts, but a token in a shape devvm doesn&rsquo;t know could still reach the VM, so if you suspect that one did, log in again with <code>devvm agent login cursor</code> (<a href="https://next.devvm.dev/docs/internals/agents/#cursors-cli">how</a>).</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="api-keys-the-proxy-puts-in">API keys the proxy puts in<span class="hx:absolute hx:-mt-20" id="api-keys-the-proxy-puts-in"></span>
|
||
<a href="#api-keys-the-proxy-puts-in" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>The VM&rsquo;s proxy puts in opencode&rsquo;s and pi&rsquo;s API keys for the providers in this table. The ID is the provider&rsquo;s entry in the agent&rsquo;s <code>auth.json</code> and the value that <code>devvm agent login --provider</code> takes. The VM&rsquo;s copy of the login holds a placeholder in place of each of these keys, and on every network tier the proxy swaps it for the key in the headers that the table names, in requests to the provider&rsquo;s hosts alone, so any other host gets only the placeholder. Where the table names a path, the proxy swaps it only in requests for paths that start with it, so the rest of that host gets the placeholder too. The proxy also allows those hosts on port 443, as it allows the hosts of every secret it puts in, so you don&rsquo;t allow them yourself:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>ID</th>
|
||
<th>Provider</th>
|
||
<th>Hosts</th>
|
||
<th>Paths</th>
|
||
<th>Headers</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>anthropic</code></td>
|
||
<td>Anthropic</td>
|
||
<td><code>api.anthropic.com</code></td>
|
||
<td>any</td>
|
||
<td><code>x-api-key</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>deepseek</code></td>
|
||
<td>DeepSeek</td>
|
||
<td><code>api.deepseek.com</code></td>
|
||
<td>any</td>
|
||
<td><code>Authorization</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>google</code></td>
|
||
<td>Google Gemini</td>
|
||
<td><code>generativelanguage.googleapis.com</code></td>
|
||
<td>any</td>
|
||
<td><code>x-goog-api-key</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>groq</code></td>
|
||
<td>Groq</td>
|
||
<td><code>api.groq.com</code></td>
|
||
<td>any</td>
|
||
<td><code>Authorization</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>mistral</code></td>
|
||
<td>Mistral</td>
|
||
<td><code>api.mistral.ai</code></td>
|
||
<td>any</td>
|
||
<td><code>Authorization</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>openai</code></td>
|
||
<td>OpenAI</td>
|
||
<td><code>api.openai.com</code></td>
|
||
<td>any</td>
|
||
<td><code>Authorization</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>openrouter</code></td>
|
||
<td>OpenRouter</td>
|
||
<td><code>openrouter.ai</code></td>
|
||
<td><code>/api/</code></td>
|
||
<td><code>Authorization</code>, <code>x-api-key</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>xai</code></td>
|
||
<td>xAI</td>
|
||
<td><code>api.x.ai</code></td>
|
||
<td>any</td>
|
||
<td><code>Authorization</code></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>The Google Gemini key is the Gemini API&rsquo;s, for Google AI Studio. Vertex AI logs in with a Google Cloud account or a service account instead, so devvm withholds its logins, as it does any other provider&rsquo;s. These providers&rsquo; keys never need <code>[pass-keys]</code>, and when it lists one of them all the same, the VM still gets the key&rsquo;s placeholder, not the key, and devvm notes at each launch that you can take the provider out. With some of these keys, code in the VM can make a credential of its own that works without the proxy, or reach hosts that the allowlist doesn&rsquo;t have through the provider&rsquo;s own tools (<a href="https://next.devvm.dev/docs/internals/agents/#api-keys">how the proxy puts them in</a>).</p>
|
||
<div class="devvm-callout devvm-callout-warning">
|
||
<p class="devvm-callout-title"><svg class="devvm-icon" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="currentColor" shape-rendering="crispEdges"><path d="M5 1h1v1H5ZM4 2h1v1H4ZM6 2h1v1H6ZM4 3h1v1H4ZM6 3h1v1H6ZM3 4h1v1H3ZM7 4h1v1H7ZM3 5h1v1H3ZM5 5h1v1H5ZM7 5h1v1H7ZM2 6h1v1H2ZM5 6h1v1H5ZM8 6h1v1H8ZM2 7h1v1H2ZM5 7h1v1H5ZM8 7h1v1H8ZM1 8h1v1H1ZM9 8h1v1H9ZM1 9h1v1H1ZM5 9h1v1H5ZM9 9h1v1H9ZM0 10h1v1H0ZM10 10h1v1H10ZM0 11h11v1H0Z"/></svg> Warning</p><p>A VM that was given one of these keys as it was, before the launch that first gave it the placeholder, may still hold copies of it, and those copies still work wherever they are. So when you don&rsquo;t trust that VM, make a new key at the provider, save it with <code>devvm agent login AGENT --api-key --provider PROVIDER</code> and revoke the old one.</p></div><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm agent login opencode --api-key --provider openai <span class="c1"># save the new key, then revoke the old one at the provider</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="pasting-images">Pasting images<span class="hx:absolute hx:-mt-20" id="pasting-images"></span>
|
||
<a href="#pasting-images" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>An agent in the VM can&rsquo;t see this machine&rsquo;s clipboard, so an image you copied, such as a screenshot, gets to it through devvm paste, which sends the image into the VM and copies its path there for you to paste:</p>
|
||
<ol>
|
||
<li>Copy an image on this machine, such as a screenshot, copy pages in a PDF viewer such as Preview, or copy a file in Finder or your file manager.</li>
|
||
<li>In a terminal on this machine, run <code>devvm paste</code> in the project folder. devvm says where the image is in the VM, such as <code>/tmp/devvm-paste/paste-20261109-153012-7f3a9c01.png</code>, and puts that path on your clipboard. If putting it there fails, devvm warns you and still says where the image is, so you can paste that path yourself.</li>
|
||
<li>Paste the path into the agent with your terminal&rsquo;s paste shortcut, which is Cmd+V on macOS and usually Ctrl+Shift+V on Linux. Ctrl+V on its own asks the agent to read the VM&rsquo;s clipboard, and the VM has none. Claude Code, Codex and opencode attach an image whose path you paste, and pi reads it with its <code>read</code> tool.</li>
|
||
</ol>
|
||
<p>The VM must be running, because devvm paste is for an agent that runs in it, and devvm refuses a stopped one.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm paste <span class="c1"># send what you copied, asking first about a copied file</span>
|
||
</span></span><span class="line"><span class="cl">devvm paste --send-file <span class="c1"># send a file in the project folder without asking, as a script must</span>
|
||
</span></span><span class="line"><span class="cl">devvm paste --json <span class="c1"># the same, and print what it sent</span>
|
||
</span></span><span class="line"><span class="cl">devvm paste rm <span class="c1"># delete the files devvm paste left in the VM, after asking</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="what-devvm-paste-sends">What devvm paste sends<span class="hx:absolute hx:-mt-20" id="what-devvm-paste-sends"></span>
|
||
<a href="#what-devvm-paste-sends" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>devvm reads only an image, a PDF or a copied file&rsquo;s reference from the clipboard, never text, so a password you copied never reaches it:</p>
|
||
<ul>
|
||
<li><strong>An image</strong>: PNG, JPEG, GIF or WebP, and on macOS also a TIFF, which many Mac apps copy, sent as a PNG.</li>
|
||
<li><strong>A PDF</strong>, such as pages you copied in Preview, sent as it is, as a <code>.pdf</code> file, because most models read PDFs.</li>
|
||
<li><strong>One copied file</strong>, after devvm asks you about it.</li>
|
||
<li><strong>Nothing over 64 MiB</strong>, whether it&rsquo;s an image, a PDF or a file.</li>
|
||
</ul>
|
||
<p>devvm checks that an image&rsquo;s or a PDF&rsquo;s bytes are the type the clipboard claims (<a href="https://next.devvm.dev/docs/contributing/design/#pasting-images">how</a>). Text is never sent, so paste text, such as an error message, into the agent&rsquo;s terminal yourself. The app you copied from hands over what you copied when devvm asks for it, and devvm waits for it at most 30 seconds, then stops waiting, sends nothing and says so, so copy it again, or wait until the app responds, then run devvm paste again. On macOS, devvm reads the clipboard of the session you&rsquo;re logged in to, so run devvm paste in a terminal on that Mac, not over ssh.</p>
|
||
<p>What devvm gets depends on the app you copied from:</p>
|
||
<ul>
|
||
<li><strong>A browser&rsquo;s Copy Image</strong> hands over a PNG, never the original JPEG, GIF or WebP, and Safari hands over a TIFF, which devvm makes a PNG, so an animated GIF arrives as one still frame. To send the original, save it and copy the saved file instead.</li>
|
||
<li><strong>A PDF viewer</strong> puts a picture of what you copied beside the PDF, and devvm sends the PDF, never the picture. When you copy a page&rsquo;s thumbnail in Preview, Preview also puts a temporary file of its own on the clipboard, and devvm sends the PDF without asking about that file.</li>
|
||
<li><strong>Finder</strong>, on macOS, puts the copied file&rsquo;s icon on the clipboard as an image beside the file, and devvm sends the file, not the icon. If the file is gone by the time you run devvm paste, devvm says so and sends nothing, rather than the icon. Text is never taken for a file, even when it&rsquo;s a path, so copy the file itself in Finder.</li>
|
||
<li><strong>Photos</strong> puts a file of the Photos library beside a photo you copy, so devvm asks about that file, as it does about any copied file.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="copied-files">Copied files<span class="hx:absolute hx:-mt-20" id="copied-files"></span>
|
||
<a href="#copied-files" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Before devvm sends a copied file, it shows the file&rsquo;s path on this machine and asks, [y/N], because the clipboard can name any file of yours, such as a key in <code>~/.ssh</code> that you didn&rsquo;t mean to copy. Answer no and nothing is sent. An image or a PDF is sent without a question, because it&rsquo;s only what you copied. devvm sends a copied file under a name of its own that keeps only the file&rsquo;s extension, when it&rsquo;s letters and digits alone and at most 16 of them, so <code>my shot (1).png</code> becomes <code>paste-20261109-153012-7f3a9c01.png</code>, and <code>Makefile</code> becomes <code>paste-20261109-153012-7f3a9c01</code> (<a href="https://next.devvm.dev/docs/contributing/design/#pasting-images">why</a>).</p>
|
||
<p>It sends one file at a time, and it refuses:</p>
|
||
<ul>
|
||
<li>several files;</li>
|
||
<li>a folder;</li>
|
||
<li>a file with a symbolic link anywhere in its path, your own included, because a link the VM planted in the project folder could point at a file of yours. The only links devvm follows are the system&rsquo;s own, which root owns, such as macOS&rsquo;s <code>/tmp</code>, so copy the file from the folder it&rsquo;s really in.</li>
|
||
</ul>
|
||
<p><code>devvm paste --send-file</code> answers the question for a file in the project folder, which it sends without asking, as a script must, because the VM can read that folder already. It doesn&rsquo;t answer for the rest:</p>
|
||
<ul>
|
||
<li><strong>A file anywhere else</strong> is still asked about, so only you can send it, at a terminal.</li>
|
||
<li><strong>A file whose path goes through a symbolic link</strong> is asked about too, even through one of the system&rsquo;s that devvm follows, because the file may not be where its path says.</li>
|
||
<li><strong>A clone VM&rsquo;s files</strong>, because a clone VM, made with <code>--clone</code>, doesn&rsquo;t mount the folder.</li>
|
||
</ul>
|
||
<p>Where devvm can&rsquo;t ask, such as without a terminal, it sends nothing, and it names <code>--send-file</code> for a file in the folder, the file and the folder for one outside it, and the file for one reached through a link. So don&rsquo;t bind <code>devvm paste --send-file</code> to a hotkey to send files from outside the project, because a hotkey has no terminal to ask in, and devvm refuses those files.</p>
|
||
<h3 data-hextra-search-id="devvm-paste-json">devvm paste &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-paste-json"></span>
|
||
<a href="#devvm-paste-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm paste --json</code> does the same and prints what it sent as one object, with <code>&quot;version&quot;: 1</code> first. It has whether anything was <code>sent</code>, which is <code>false</code> when you answered no about a file, the VM, and the file&rsquo;s <code>path</code> in it (<code>&quot;&quot;</code> when nothing was sent). Then its <code>kind</code> (<code>image</code>, <code>pdf</code> or <code>file</code>), an image&rsquo;s or a PDF&rsquo;s <code>type</code> (<code>image/png</code>, <code>image/jpeg</code>, <code>image/gif</code>, <code>image/webp</code> or <code>application/pdf</code>, and <code>&quot;&quot;</code> for a file), and a copied file&rsquo;s <code>source</code>, its path on this machine (<code>&quot;&quot;</code> otherwise). Last come its size in <code>bytes</code>, and whether the path was <code>copied</code> to the clipboard:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span><span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="nt">&#34;sent&#34;</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span> <span class="nt">&#34;vm&#34;</span><span class="p">:</span> <span class="s2">&#34;devvm-website-3f9a1c2b4d5e6f&#34;</span><span class="p">,</span> <span class="nt">&#34;path&#34;</span><span class="p">:</span> <span class="s2">&#34;/tmp/devvm-paste/paste-20261109-153012-7f3a9c01.png&#34;</span><span class="p">,</span> <span class="nt">&#34;kind&#34;</span><span class="p">:</span> <span class="s2">&#34;image&#34;</span><span class="p">,</span> <span class="nt">&#34;type&#34;</span><span class="p">:</span> <span class="s2">&#34;image/png&#34;</span><span class="p">,</span> <span class="nt">&#34;source&#34;</span><span class="p">:</span> <span class="s2">&#34;&#34;</span><span class="p">,</span> <span class="nt">&#34;bytes&#34;</span><span class="p">:</span> <span class="mi">48213</span><span class="p">,</span> <span class="nt">&#34;copied&#34;</span><span class="p">:</span> <span class="kc">true</span><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="the-paste-folder-and-your-agents-settings">The paste folder and your agent&rsquo;s settings<span class="hx:absolute hx:-mt-20" id="the-paste-folder-and-your-agents-settings"></span>
|
||
<a href="#the-paste-folder-and-your-agents-settings" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>The files go into the VM&rsquo;s paste folder, <code>/tmp/devvm-paste</code> unless <code>config.toml</code>&rsquo;s <code>paste-dir</code> names another (<a href="https://next.devvm.dev/docs/using/settings/#the-paste-folder">the paste folder</a>), and they keep their mode, 600, so only the VM&rsquo;s user reads them. The folder is a fixed path so that you can allow it once in an agent&rsquo;s settings. Claude Code refuses to read a path outside the project folder when its <code>permissions.blockReadsOutsideWorkingDirectories</code> setting is on, until you add the folder in Claude Code:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">/add-dir /tmp/devvm-paste</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Or list it in <code>permissions.additionalDirectories</code> in your settings, which <a href="#devvms-agent-store">devvm&rsquo;s agent store</a> keeps for every VM, in <code>~/.config/devvm/agents/claude/.claude/settings.json</code>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span> <span class="nt">&#34;permissions&#34;</span><span class="p">:</span> <span class="p">{</span> <span class="nt">&#34;additionalDirectories&#34;</span><span class="p">:</span> <span class="p">[</span><span class="s2">&#34;/tmp/devvm-paste&#34;</span><span class="p">]</span> <span class="p">}</span> <span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Anything in the VM can read what you send, as it can read any file in the project folder, so paste nothing you wouldn&rsquo;t put in the folder.</p>
|
||
<h3 data-hextra-search-id="deleting-pasted-files">Deleting pasted files<span class="hx:absolute hx:-mt-20" id="deleting-pasted-files"></span>
|
||
<a href="#deleting-pasted-files" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm paste rm <span class="c1"># delete the files devvm paste left in the folder, after asking in a terminal</span>
|
||
</span></span><span class="line"><span class="cl">devvm paste rm --force <span class="c1"># delete them without asking, as a script must</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>devvm never deletes a pasted file on its own, because Codex reads the image when you submit your message and pi when the model calls <code>read</code>, which may be some time after the paste. devvm paste rm deletes only the files devvm paste named, and nothing else in the folder, so a <code>paste-dir</code> of your own, such as <code>/home/USER/pastes</code> where <code>USER</code> is your user in the VM, can hold other files. The VM&rsquo;s <code>/tmp</code> is emptied when the VM boots, so with the default folder the files are gone after a restart anyway. With a <code>paste-dir</code> of your own, they stay, and a command that starts a stopped VM and opens its shell offers to delete them, [y/N], once the VM is set up. Those commands are:</p>
|
||
<ul>
|
||
<li><code>devvm</code> and <code>devvm restart</code>;</li>
|
||
<li><code>devvm tools</code>, <code>devvm tools add</code>, <code>devvm tools rm</code> and <code>devvm tools update</code>;</li>
|
||
<li><code>devvm layer add</code> and <code>devvm layer rm</code>;</li>
|
||
<li><code>devvm update</code>;</li>
|
||
<li><code>devvm clone on</code> and <code>devvm clone off</code>.</li>
|
||
</ul>
|
||
<p>Without a terminal, devvm keeps the files and says nothing, and if deleting them fails, it warns you and opens the shell anyway. Commands that start a VM without opening its shell, such as <code>devvm code</code> and <code>devvm agent save</code>, don&rsquo;t ask, so run <code>devvm paste rm</code> when you want the files gone.</p>
|
||
<h3 data-hextra-search-id="on-linux">On Linux<span class="hx:absolute hx:-mt-20" id="on-linux"></span>
|
||
<a href="#on-linux" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>devvm reads and writes the clipboard with <code>wl-paste</code> and <code>wl-copy</code> in a Wayland session, which <code>WAYLAND_DISPLAY</code> names, and with <code>xclip</code> in an X11 session, which <code>DISPLAY</code> names. It tells you which one is missing, and installs nothing itself, so install <code>wl-clipboard</code> or <code>xclip</code> with your distribution&rsquo;s package manager:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo apt install wl-clipboard <span class="c1"># or xclip for X11; dnf, pacman and zypper have both</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>devvm looks for them only in the system&rsquo;s folders, never elsewhere on your <code>PATH</code> (<a href="https://next.devvm.dev/docs/contributing/design/#pasting-images">which folders, and why</a>). Run devvm paste from a terminal in your desktop session, because without either variable there&rsquo;s no clipboard to read. If <code>WAYLAND_DISPLAY</code> or <code>DISPLAY</code> names a session that&rsquo;s over, as in a tmux window left from an earlier login, devvm tells you that <code>wl-paste</code> or <code>xclip</code> failed and what it said, rather than that the clipboard is empty. Copying the path leaves <code>wl-copy</code> or <code>xclip</code> running until you copy something else, because a Linux clipboard&rsquo;s contents live in the program that copied them.</p>
|
||
<h2 data-hextra-search-id="history">History<span class="hx:absolute hx:-mt-20" id="history"></span>
|
||
<a href="#history" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Each VM&rsquo;s transcripts and sessions stay in that VM. <code>devvm history export [FILE]</code> saves them, and <code>devvm rm</code> saves them before it deletes a VM that has an agent. The export is a <code>.tar.gz</code> of the agents&rsquo; history in the VM, <!-- the agents' history, generated from internal/agents by mise run cli-docs --><code>~/.claude</code>, <code>~/.claude.json</code>, <code>~/.codex</code>, <code>~/.local/share/opencode</code>, <code>~/.local/state/opencode</code>, <code>~/.pi/agent/sessions</code> and <code>~/.cursor/chats</code><!-- end of the agents' history -->, written to FILE or to <code>~/.local/share/devvm/exports/&lt;vm&gt;-&lt;date&gt;-&lt;time&gt;.tar.gz</code>. An export in that folder gets a <code>&lt;vm&gt;-&lt;date&gt;-&lt;time&gt;.folder</code> file beside it, which names the VM&rsquo;s project folder and the VM&rsquo;s <a href="https://next.devvm.dev/docs/safety/network/#network-tiers">network tier</a> when devvm wrote the export. The agents&rsquo; logins are never in an export, and neither is the key that every machine paired with the VM&rsquo;s opencode trusts. An export holds at most 2 GiB (<a href="https://next.devvm.dev/docs/internals/agents/#history-exports">what an export holds</a>). The commands:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm <span class="nb">history</span> <span class="c1"># list the exports devvm saved</span>
|
||
</span></span><span class="line"><span class="cl">devvm <span class="nb">history</span> <span class="nb">export</span> <span class="c1"># save this folder&#39;s VM&#39;s agents&#39; history</span>
|
||
</span></span><span class="line"><span class="cl">devvm <span class="nb">history</span> <span class="nb">export</span> ~/backup.tgz <span class="c1"># or save it to a file of your own</span>
|
||
</span></span><span class="line"><span class="cl">devvm <span class="nb">history</span> import <span class="c1"># put this folder&#39;s newest export into its VM</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm history</code> lists the exports in <code>~/.local/share/devvm/exports</code>, oldest first, in a table with a header. It shows each export&rsquo;s file, the VM it&rsquo;s of, that VM&rsquo;s folder, the date and time devvm wrote it, and its size, with <code>-</code> for a folder devvm has no record of. Exports you wrote to a FILE of your own aren&rsquo;t listed, and <code>devvm history</code> changes nothing and starts no VM.</p>
|
||
<h3 data-hextra-search-id="devvm-history-json">devvm history &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-history-json"></span>
|
||
<a href="#devvm-history-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm history --json</code> prints the same list as one JSON object, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes. Each of the <code>exports</code> has its <code>file</code>, its <code>vm</code>, the VM&rsquo;s <code>folder</code>, which is <code>&quot;&quot;</code> when devvm has no record of it, the <code>date</code> devvm wrote it in RFC 3339 with this machine&rsquo;s time zone, and its <code>size</code> in bytes.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;exports&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;file&#34;</span><span class="p">:</span> <span class="s2">&#34;/Users/you/.local/share/devvm/exports/devvm-website-71a99b1076d92c-20261001-120000.tar.gz&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;vm&#34;</span><span class="p">:</span> <span class="s2">&#34;devvm-website-71a99b1076d92c&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;folder&#34;</span><span class="p">:</span> <span class="s2">&#34;/Users/you/code/website&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;date&#34;</span><span class="p">:</span> <span class="s2">&#34;2026-10-01T12:00:00+02:00&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;size&#34;</span><span class="p">:</span> <span class="mi">1048576</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="deleting-exports">Deleting exports<span class="hx:absolute hx:-mt-20" id="deleting-exports"></span>
|
||
<a href="#deleting-exports" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>After <code>devvm rm</code>, an export is the only copy of that VM&rsquo;s history, so devvm keeps the exports until you ask it to delete them. <code>devvm gc --history</code> also deletes the exports in that folder, and <code>devvm gc --history --older-than 30d</code> deletes only those written 30 days ago or more. An export&rsquo;s age counts from the date and time in its name, which is this machine&rsquo;s local time when devvm wrote it, so across a change to or from daylight saving time an export reaches an age such as <code>30d</code> an hour earlier or later, for <code>--older-than</code> and for the <code>history.age</code> <a href="https://next.devvm.dev/docs/using/settings/#retention">retention setting</a> alike. gc lists each one by its VM and date first, and in a terminal it asks. Exports you wrote to a FILE of your own stay where they are. To delete only the older ones:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm gc --history --older-than 30d <span class="c1"># also delete the exports written 30 days ago or more, after asking</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="importing-history">Importing history<span class="hx:absolute hx:-mt-20" id="importing-history"></span>
|
||
<a href="#importing-history" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm <span class="nb">history</span> import <span class="c1"># put this folder&#39;s newest export into its VM</span>
|
||
</span></span><span class="line"><span class="cl">devvm <span class="nb">history</span> import ~/backup.tar.gz <span class="c1"># or an export of your own</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm history import [FILE]</code> puts an export back into this folder&rsquo;s VM, so the agents&rsquo; transcripts and sessions carry over when you delete a VM and make it again. Without FILE, it imports the newest export in <code>~/.local/share/devvm/exports</code> that devvm saved for this folder, going by the <code>.folder</code> file beside each one, and it never picks an export made for another folder. With FILE, it imports that <code>.tar.gz</code>, such as one you saved with <code>devvm history export FILE</code>. devvm starts a stopped VM for the import, as it does for an export, and the import works on every VM, whatever its base (<a href="https://next.devvm.dev/docs/internals/agents/#importing-history">how</a>):</p>
|
||
<ul>
|
||
<li>
|
||
<p>When devvm makes a new VM that has an agent, and it saved an export for the same folder before, it offers that export. In a terminal it asks whether to import it into the new VM, with no as the default. Without a terminal, or with <code>--no-input</code>, it doesn&rsquo;t ask, and it says which export it found and that <code>devvm history import</code> in the folder puts it into the VM. devvm imports the export once the VM has started and before its setup, and if the import fails, devvm warns and makes the VM anyway, so you can run <code>devvm history import</code> later.</p>
|
||
</li>
|
||
<li>
|
||
<p>An export holds what a VM wrote, so devvm treats it as untrusted, and when it comes from a VM on a less strict tier than the VM you import it into, devvm warns you before it imports. It treats an export with no tier recorded, or a FILE elsewhere, as if it came from an open VM. When an export holds a path outside the agents&rsquo; history folders, devvm imports nothing.</p>
|
||
</li>
|
||
<li>
|
||
<p>The import leaves out what devvm puts in the VM itself. That&rsquo;s the agents&rsquo; logins, <code>~/.claude/.credentials.json</code>, with the old VM&rsquo;s own MCP servers&rsquo; logins in it, <code>~/.codex/auth.json</code>, and opencode&rsquo;s <code>auth.json</code>, <code>account.json</code>, <code>mcp-auth.json</code> and <code>bin</code>. It&rsquo;s also <code>~/.claude.json</code>, whose copy in the old VM held that VM&rsquo;s own placeholders, and every agent&rsquo;s <a href="#devvms-agent-store">mounted folders and copied files</a>, which the new VM&rsquo;s setup links and copies from devvm&rsquo;s agent store.</p>
|
||
</li>
|
||
<li>
|
||
<p>The import also leaves out the old VM&rsquo;s opencode identity, as an export does: opencode&rsquo;s <code>~/.local/state/opencode/machine</code>, with the key that every machine paired with the old VM&rsquo;s opencode trusts, and its <code>service.json</code>, or <code>service-&lt;channel&gt;.json</code> for another channel&rsquo;s opencode, and <code>pty</code>, which hold the password of the old VM&rsquo;s opencode service and the access tokens of its terminals&rsquo; daemons. The new VM&rsquo;s opencode makes its own. The import also leaves out the project plugins you approved in opencode&rsquo;s native client, <code>plugin-approvals.json</code> and <code>plugin-staged</code>, so opencode asks again before it runs one.</p>
|
||
</li>
|
||
<li>
|
||
<p>opencode&rsquo;s sessions come without what opencode would act on without asking. Neither an export nor an import keeps:</p>
|
||
<ul>
|
||
<li>automations, whose shell commands run on their schedule without asking again</li>
|
||
<li>the requests you said always to allow</li>
|
||
<li>subagents&rsquo; jobs and queued messages</li>
|
||
<li>a project&rsquo;s commands</li>
|
||
<li>opencode&rsquo;s git repositories and worktrees</li>
|
||
</ul>
|
||
<p>No session resumes its turn on its own, and each session keeps only its deny and ask rules (<a href="https://next.devvm.dev/docs/internals/agents/#history-exports">what an export holds</a>). In the new VM, make again any automation you want, and opencode asks again before the requests you had always allowed. <code>devvm rm</code> deletes opencode&rsquo;s worktrees with the VM, so it asks before their uncommitted changes go (<a href="#opencodes-worktrees">opencode&rsquo;s worktrees</a>).</p>
|
||
</li>
|
||
<li>
|
||
<p>A file or folder the VM already has stays as it is, so importing into a VM that has history of its own adds the export&rsquo;s files without replacing any of its own.</p>
|
||
</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="opencodes-worktrees">opencode&rsquo;s worktrees<span class="hx:absolute hx:-mt-20" id="opencodes-worktrees"></span>
|
||
<a href="#opencodes-worktrees" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm rm <span class="c1"># show opencode&#39;s worktrees&#39; uncommitted changes, then ask</span>
|
||
</span></span><span class="line"><span class="cl">devvm rm --no-worktree-check <span class="c1"># delete the VM without checking them, losing those changes</span>
|
||
</span></span><span class="line"><span class="cl">devvm update --clean-home <span class="c1"># a remake that starts from the image&#39;s home folder checks them too</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>opencode makes its worktrees in <code>~/.local/share/opencode/worktree</code> in the VM, and an export leaves that folder out, so their uncommitted changes go with the VM. Before <code>devvm rm</code> deletes the VM, and before a command that makes it again with <code>--clean-home</code> gives it the image&rsquo;s home folder, devvm checks each of those worktrees, starting a stopped VM for the check as a launch does. It asks before what it finds is lost, only in a terminal, so <code>--force</code> never answers. Without a terminal, or with <code>--no-input</code>, devvm refuses and keeps the VM, and when only the worktrees have work, the refusal names <code>--no-worktree-check</code>, which warns and goes ahead without the check.</p>
|
||
<p>devvm asks about:</p>
|
||
<ul>
|
||
<li><strong>Uncommitted changes:</strong> it lists the first 20 in all, under each worktree&rsquo;s path.</li>
|
||
<li><strong>A detached HEAD&rsquo;s commits</strong> that no branch, tag or remote-tracking branch in the VM has. To keep them, run <code>git switch -c NAME</code> in that worktree first.</li>
|
||
<li><strong>A worktree that git can&rsquo;t read,</strong> such as one whose entry your project&rsquo;s repository pruned, because it may hold changes devvm can&rsquo;t see.</li>
|
||
<li><strong>More than 100 worktrees,</strong> of which devvm checks the first 100.</li>
|
||
</ul>
|
||
<p>To keep the work, commit it in the worktree, which puts it in your project&rsquo;s repository for a VM that mounts the folder, or in the clone, whose branches <code>devvm rm</code> offers to fetch, for a <code>--clone</code> VM (<a href="https://next.devvm.dev/docs/using/clone/#deleting-the-vm">deleting the VM</a>). For a <code>--clone</code> VM, the clone&rsquo;s check and the worktrees&rsquo; share one question, and when the clone has work too, the refusal tells you to run the command in a terminal, as the clone&rsquo;s own does. When reading the worktrees fails, or the VM doesn&rsquo;t start for the check, devvm keeps the VM and names <code>--no-worktree-check</code>. A command that keeps the VM&rsquo;s home folder, such as <code>devvm update</code> without <code>--clean-home</code>, keeps the worktrees too, so it doesn&rsquo;t check them (<a href="https://next.devvm.dev/docs/internals/agents/#opencodes-worktrees">how devvm checks</a>).</p>
|
||
<h2 data-hextra-search-id="the-vms-setup">The VM&rsquo;s setup<span class="hx:absolute hx:-mt-20" id="the-vms-setup"></span>
|
||
<a href="#the-vms-setup" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Besides the agents&rsquo; config, every launch sets the VM up from this machine&rsquo;s settings:</p>
|
||
<ul>
|
||
<li>its hostname, which is the folder&rsquo;s part of the VM&rsquo;s name;</li>
|
||
<li>the timezone (<code>TZ</code>, else this machine&rsquo;s) and, when it&rsquo;s UTF-8, the locale (<code>LC_ALL</code>, else <code>LANG</code>);</li>
|
||
<li>git&rsquo;s <code>user.name</code> and <code>user.email</code>, as git has them in the project folder;</li>
|
||
<li>telemetry off where an environment variable can&rsquo;t turn it off, which is Go&rsquo;s, and Codex&rsquo;s analytics and metrics;</li>
|
||
<li>every agent&rsquo;s environment variables, which turn off its self-update and its telemetry (<a href="#supported-agents">supported agents</a>);</li>
|
||
<li>every toolchain&rsquo;s environment variables, such as the ones that turn off .NET&rsquo;s telemetry and send <code>npm i -g</code> into your home, and the folders where the toolchains&rsquo; global installs go, on the <code>PATH</code> (<a href="https://next.devvm.dev/docs/using/toolchains/">toolchains</a>);</li>
|
||
<li><code>(devvm)</code> at the start of the prompt.</li>
|
||
</ul>
|
||
<p>On every network tier, the launch also installs the VM&rsquo;s own CA and the next one, points apt, sudo, ssh, the <a href="https://next.devvm.dev/docs/using/images/#docker">docker layer</a>&rsquo;s Docker and the <a href="https://next.devvm.dev/docs/using/images/#nix">nix layer</a>&rsquo;s Nix at the proxy, and adds <code>devvm-why</code>, which shows what the proxy blocked lately. It also tells the agents, in <code>~/.claude/CLAUDE.md</code> and <code>~/.codex/AGENTS.md</code>, why a request may fail (<a href="https://next.devvm.dev/docs/safety/network/#inside-the-vm">inside the VM</a>). The VM&rsquo;s secrets go in <code>~/.config/devvm/env</code> in the VM, which login shells read, and that file holds their placeholders.</p></description></item><item><title>Toolchains</title><link>https://next.devvm.dev/docs/using/toolchains/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/toolchains/</guid><description>
|
||
<p>devvm has these toolchains:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Toolchain</th>
|
||
<th>What it brings</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><a href="#node">node</a></td>
|
||
<td>Node 24, with npm, pnpm, yarn and bun</td>
|
||
</tr>
|
||
<tr>
|
||
<td><a href="#python">python</a></td>
|
||
<td>CPython, with pip and uv</td>
|
||
</tr>
|
||
<tr>
|
||
<td><a href="#rust">rust</a></td>
|
||
<td>rustup, cargo and the stable toolchain</td>
|
||
</tr>
|
||
<tr>
|
||
<td><a href="#go">go</a></td>
|
||
<td>Go</td>
|
||
</tr>
|
||
<tr>
|
||
<td><a href="#dotnet">dotnet</a></td>
|
||
<td>the .NET SDK and its runtimes</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>A new VM gets the ones its folder&rsquo;s files call for, which the summary of the new VM shows, unless you customize the VM and check others in the list or give others with <code>--tools</code>, as in <code>devvm --tools node,python</code> (<a href="https://next.devvm.dev/docs/using/images/#what-a-new-vm-gets">what a new VM gets</a>). Each section below says what the toolchain brings and which files make devvm choose it. A project that gets its toolchain from Nix uses the <code>nix</code> layer, which <a href="#nix-projects">Nix projects</a> covers.</p>
|
||
<h2 data-hextra-search-id="node">node<span class="hx:absolute hx:-mt-20" id="node"></span>
|
||
<a href="#node" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>node brings the newest release of Node 24, with npm, pnpm, yarn through corepack, and bun. devvm stays on Node 24 because newer releases drop corepack.</p>
|
||
<ul>
|
||
<li><strong>Files.</strong> devvm chooses node for a folder with <code>package.json</code>, <code>bun.lock</code> or <code>bun.lockb</code> at its top level.</li>
|
||
<li><strong>Versions.</strong> A project&rsquo;s <code>.nvmrc</code> or <code>.node-version</code> picks its Node version, which installs into the VM the first time it&rsquo;s used.</li>
|
||
<li><strong>Global installs.</strong> <code>npm i -g</code> installs into <code>~/.npm-global</code> in the VM, which is on the <code>PATH</code>.</li>
|
||
<li><strong>Allowlist.</strong> On the allowlist tier, the VM can reach npm&rsquo;s, yarn&rsquo;s, pnpm&rsquo;s and bun&rsquo;s registries and Node&rsquo;s downloads, which are <code>registry.npmjs.org</code>, <code>registry.yarnpkg.com</code>, <code>repo.yarnpkg.com</code>, <code>nodejs.org</code> and <code>bun.sh</code>.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="python">python<span class="hx:absolute hx:-mt-20" id="python"></span>
|
||
<a href="#python" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>python brings a prebuilt build of the newest CPython release, and uv, so <code>pip</code> and <code>uv</code> work as usual.</p>
|
||
<ul>
|
||
<li><strong>Files.</strong> devvm chooses python for a folder with <code>pyproject.toml</code>, <code>requirements.txt</code>, <code>uv.lock</code>, <code>setup.py</code> or <code>Pipfile</code> at its top level.</li>
|
||
<li><strong>Versions.</strong> A project&rsquo;s <code>.python-version</code> picks its Python version, which installs into the VM the first time it&rsquo;s used.</li>
|
||
<li><strong>Global installs.</strong> The shared Python is read-only, so packages go into a project&rsquo;s virtual environment or into your home in the VM, and <code>~/.local/bin</code> is on the <code>PATH</code>.</li>
|
||
<li><strong>Allowlist.</strong> On the allowlist tier, the VM can reach PyPI and the Python downloads that uv uses, which are <code>pypi.org</code>, <code>files.pythonhosted.org</code> and <code>releases.astral.sh</code>.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="rust">rust<span class="hx:absolute hx:-mt-20" id="rust"></span>
|
||
<a href="#rust" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>rust brings rustup, cargo and the newest stable toolchain, with the <code>rust-src</code> and <code>rust-analyzer</code> components already added.</p>
|
||
<ul>
|
||
<li><strong>Files.</strong> devvm chooses rust for a folder with <code>Cargo.toml</code> at its top level.</li>
|
||
<li><strong>Versions.</strong> A project&rsquo;s <code>rust-toolchain.toml</code> picks its toolchain, which rustup installs into the VM next to the shared one the first time it&rsquo;s used.</li>
|
||
<li><strong>Global installs.</strong> <code>cargo install</code> installs into <code>~/.cargo/bin</code> in the VM, which is on the <code>PATH</code>. <code>rustup component add</code> can&rsquo;t change the shared toolchain, which is why it comes with <code>rust-src</code> and <code>rust-analyzer</code>.</li>
|
||
<li><strong>Allowlist.</strong> On the allowlist tier, the VM can reach crates.io and Rust&rsquo;s toolchain downloads, which are <code>crates.io</code>, <code>index.crates.io</code>, <code>static.crates.io</code> and <code>static.rust-lang.org</code>.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="go">go<span class="hx:absolute hx:-mt-20" id="go"></span>
|
||
<a href="#go" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>go brings the newest Go release, and devvm turns Go&rsquo;s telemetry off in the VM.</p>
|
||
<ul>
|
||
<li><strong>Files.</strong> devvm chooses go for a folder with <code>go.mod</code> at its top level.</li>
|
||
<li><strong>Versions.</strong> The <code>toolchain</code> line in a project&rsquo;s <code>go.mod</code> picks its Go version, and Go itself downloads that version into the VM the first time it&rsquo;s used.</li>
|
||
<li><strong>Global installs.</strong> <code>go install</code> installs into <code>~/go/bin</code> in the VM, which is on the <code>PATH</code>.</li>
|
||
<li><strong>Allowlist.</strong> On the allowlist tier, the VM can reach Go&rsquo;s module proxy, its checksum database and Go&rsquo;s downloads, which are <code>proxy.golang.org</code>, <code>sum.golang.org</code>, <code>go.dev</code> and <code>dl.google.com</code>. Go&rsquo;s telemetry uploads, to <code>telemetry.go.dev</code>, are a <a href="https://next.devvm.dev/docs/safety/network/#quiet-hosts">quiet host</a>, so their blocks never show in the VM.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="dotnet">dotnet<span class="hx:absolute hx:-mt-20" id="dotnet"></span>
|
||
<a href="#dotnet" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>dotnet brings the newest release of the .NET SDK, with the .NET and ASP.NET Core runtimes that come with it, and devvm turns off .NET&rsquo;s telemetry and its first-run banner in the VM.</p>
|
||
<ul>
|
||
<li><strong>Files.</strong> devvm chooses dotnet for a folder with a solution (<code>*.sln</code> or <code>*.slnx</code>), a C# or F# project (<code>*.csproj</code> or <code>*.fsproj</code>) or <code>global.json</code> at its top level.</li>
|
||
<li><strong>Versions.</strong> The <code>sdk.version</code> in a project&rsquo;s <code>global.json</code> picks its SDK, which installs into the VM the first time it&rsquo;s used. mise installs exactly that version and doesn&rsquo;t follow <code>rollForward</code>, so a <code>global.json</code> that allows a newer SDK still gets the one it names, and a <code>global.json</code> without an SDK version keeps the shared one. mise installs that SDK with Microsoft&rsquo;s install script, which checks only the download&rsquo;s size, while devvm checks the shared SDK against the SHA-512 that Microsoft publishes for it.</li>
|
||
<li><strong>Global installs.</strong> <code>dotnet tool install -g</code> installs into <code>~/.dotnet/tools</code> in the VM, which is on the <code>PATH</code>, and NuGet keeps its packages in <code>~/.nuget/packages</code>. The shared SDK is read-only, so <code>dotnet workload install</code> installs workloads into <code>~/.dotnet</code> in the VM instead of the SDK&rsquo;s folder.</li>
|
||
<li><strong>Allowlist.</strong> On the allowlist tier, the VM can reach NuGet, the revocation lists that NuGet checks packages&rsquo; signatures against and the OCSP responder it asks when a list can&rsquo;t be fetched, and the SDK downloads that a <code>global.json</code> asks for, which are <code>api.nuget.org</code>, <code>crl3.digicert.com</code> and <code>ocsp.digicert.com</code> on port 80, <code>dot.net</code> and <code>builds.dotnet.microsoft.com</code>. Microsoft&rsquo;s telemetry isn&rsquo;t on the allowlist.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="nix-projects">Nix projects<span class="hx:absolute hx:-mt-20" id="nix-projects"></span>
|
||
<a href="#nix-projects" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A project whose toolchain comes from Nix gets the <a href="https://next.devvm.dev/docs/using/images/#nix"><code>nix</code> layer</a>, which brings Nix, direnv and nix-direnv into its VM. For a folder with <code>flake.nix</code>, <code>shell.nix</code> or <code>devenv.nix</code> at its top level, or with a <code>default.nix</code> that makes a shell with <code>mkShell</code>, the list devvm shows when you customize a new VM names that file in the <code>nix</code> row, and you choose it there. A layer isn&rsquo;t chosen by default, so a VM made as its summary shows, or without a terminal, gets it only with <code>--layers nix</code>, as in <code>devvm --layers nix</code> in a folder with <code>package.json</code> and <code>flake.nix</code>, which gives node on the <code>nix</code> layer.</p>
|
||
<ul>
|
||
<li><strong>Dev shells.</strong> Put <code>use flake</code> (or <code>use nix</code> for a <code>shell.nix</code>) in the project&rsquo;s <code>.envrc</code> and run <code>direnv allow</code> in the VM once. From then on, each shell that changes into the folder loads the dev shell, and leaving the folder unloads it. This works in your terminal and in the terminals of editors connected over SSH.</li>
|
||
<li><strong>The flake&rsquo;s tools come first.</strong> While the dev shell is loaded, its tools are ahead of the shared tools on the <code>PATH</code>, so a flake&rsquo;s <code>node</code> wins over the shared node, and the shared tools come back when you leave the folder.</li>
|
||
<li><strong>Files in the project.</strong> nix-direnv keeps its cache of the dev shell in your home in the VM, so the project gets no <code>.direnv</code> folder. Nix itself writes a <code>flake.lock</code> next to a <code>flake.nix</code> that has none, and in a git repository it marks that file to be added, as it does on any machine.</li>
|
||
<li><strong>One store per VM.</strong> Each VM has its own Nix store, so a package one VM builds isn&rsquo;t in another&rsquo;s. <code>nix run nixpkgs#hello</code> works in any VM with the layer.</li>
|
||
<li><strong>Shared downloads.</strong> VMs share their downloads from Nix&rsquo;s binary cache, on every <a href="https://next.devvm.dev/docs/safety/network/#network-tiers">network tier</a>, an open VM&rsquo;s included, because every VM&rsquo;s Nix goes through its proxy. The first VM that needs a package gets it from cache.nixos.org through devvm, which keeps a copy on this machine, and the other VMs get that copy, so each package downloads once per machine instead of once per VM. Only devvm adds to this shared cache, and only what cache.nixos.org signed, so no VM can change what another VM gets. When the cache doesn&rsquo;t have a package or can&rsquo;t get it, Nix goes to cache.nixos.org itself. The cache keeps to 10 GiB, deleting the packages used least recently first, unless you set another size with <code>devvm retention nix-cache.size=20G</code> (<a href="https://next.devvm.dev/docs/using/settings/#retention">retention</a>). <code>devvm space</code> shows what it takes, and <code>devvm gc --nix-cache</code> empties it (<a href="https://next.devvm.dev/docs/internals/network/#the-shared-nix-cache">how it works</a>).</li>
|
||
<li><strong>Trust.</strong> Only root is a trusted Nix user, so the VM&rsquo;s user can&rsquo;t add caches or signing keys of their own, and Nix ignores <code>--option substituters</code> from them. <code>sudo nix</code> works. Nix builds every package in its sandbox, and a build fails rather than run without it.</li>
|
||
<li><strong>Allowlist.</strong> On the allowlist tier, the VM can reach Nix&rsquo;s binary cache and its channels and flake registry, which are <code>cache.nixos.org</code>, <code>channels.nixos.org</code> and <code>releases.nixos.org</code>, and GitHub, where most flakes&rsquo; inputs come from. A package that isn&rsquo;t in Nix&rsquo;s binary cache builds from source, which downloads its sources from their own hosts, and those are blocked until you allow them (<a href="https://next.devvm.dev/docs/safety/network/#nix">Nix through the proxy</a>).</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="sharing-a-teams-packages">Sharing a team&rsquo;s packages<span class="hx:absolute hx:-mt-20" id="sharing-a-teams-packages"></span>
|
||
<a href="#sharing-a-teams-packages" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>When your team&rsquo;s projects use one flake for their dev shell, you can put that dev shell&rsquo;s packages into an image, so every VM made from the image starts with them in its store and downloads none of them. VMs made from one image share its disk, because on macOS each VM&rsquo;s disk is a copy-on-write clone of the image&rsquo;s, and on Linux hosts it&rsquo;s an overlay of the image&rsquo;s, so the packages take their space once. This works with the stable Nix that the <code>nix</code> layer installs, on every network tier.</p>
|
||
<p>To do it, make a <a href="https://next.devvm.dev/docs/using/customizing/#your-own-layers">layer of your own</a> that builds the dev shell while the image builds, and give it after <code>nix</code>, so that it runs on top of the <code>nix</code> layer:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm layer new myteam
|
||
</span></span><span class="line"><span class="cl"><span class="nv">$EDITOR</span> ~/.config/devvm/layers/myteam.sh
|
||
</span></span><span class="line"><span class="cl">devvm --layers nix,myteam <span class="c1"># a new VM of the image nix+myteam</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Put these lines in <code>~/.config/devvm/layers/myteam.sh</code>, below the starter&rsquo;s <code>set -euo pipefail</code>, with your team&rsquo;s flake at the commit you want:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># The team&#39;s flake at a commit, so the image holds exactly that dev shell.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nv">flake</span><span class="o">=</span>github:myorg/devshell/0123456789abcdef0123456789abcdef01234567
|
||
</span></span><span class="line"><span class="cl"><span class="nv">bin</span><span class="o">=</span>/nix/var/nix/profiles/default/bin
|
||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="nv">$bin</span><span class="s2">/nix&#34;</span> develop <span class="s2">&#34;</span><span class="nv">$flake</span><span class="s2">&#34;</span> --profile /tmp/myteam-shell --command <span class="nb">true</span>
|
||
</span></span><span class="line"><span class="cl"><span class="c1"># A garbage collector root in the VM&#39;s home keeps the dev shell&#39;s packages in the store.</span>
|
||
</span></span><span class="line"><span class="cl">mkdir -p ~/.cache/myteam
|
||
</span></span><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="nv">$bin</span><span class="s2">/nix-store&#34;</span> --add-root ~/.cache/myteam/dev-shell --realise <span class="s2">&#34;</span><span class="k">$(</span>readlink -f /tmp/myteam-shell<span class="k">)</span><span class="s2">&#34;</span>
|
||
</span></span><span class="line"><span class="cl">rm -f /tmp/myteam-shell /tmp/myteam-shell-*-link</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>nix develop</code> builds or downloads every package of the flake&rsquo;s dev shell into the image&rsquo;s store and records the dev shell in a profile. <code>nix-store --add-root</code> then makes <code>~/.cache/myteam/dev-shell</code> a garbage collector root, so <code>nix-collect-garbage</code> in a VM never deletes those packages. A project that loads the same dev shell, with <code>use flake github:myorg/devshell/&lt;commit&gt;</code> in its <code>.envrc</code>, finds every package already in its VM&rsquo;s store, and so does most of a project whose own flake pins the same nixpkgs revision. The image is built without your credentials, because <a href="https://next.devvm.dev/docs/internals/security/#read-only-and-confined-builds">credentials never go into images</a>, so the flake has to be one that anyone can fetch, such as a public repository.</p>
|
||
<p>What this doesn&rsquo;t cover:</p>
|
||
<ul>
|
||
<li><strong>Packages a VM gets after it&rsquo;s made</strong> stay on that VM&rsquo;s own disk. The <a href="#nix-projects">shared downloads</a> at least save downloading them again.</li>
|
||
<li><strong>A new version of the flake</strong> needs a new image. Moving <code>flake</code> to another commit edits the script, so devvm builds the image again the next time it&rsquo;s used, while VMs made earlier keep the packages they have. When the script names a branch instead of a commit, a changed <code>flake.lock</code> upstream doesn&rsquo;t change the script, so run <code>devvm rebuild myteam</code> to build the image again.</li>
|
||
<li><strong>A flake that pins another nixpkgs revision</strong> shares few packages with the image, and its VM downloads the rest.</li>
|
||
<li><strong>Nix&rsquo;s local overlay store</strong>, which would let VMs share one store as it changes, is left out until Nix makes it stable.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="how-toolchains-are-shared-and-updated">How toolchains are shared and updated<span class="hx:absolute hx:-mt-20" id="how-toolchains-are-shared-and-updated"></span>
|
||
<a href="#how-toolchains-are-shared-and-updated" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>The toolchains are <a href="https://next.devvm.dev/docs/using/images/#shared-tools">shared tools</a>, like the <a href="https://next.devvm.dev/docs/using/coding-agents/#supported-agents">coding agents</a>, so they aren&rsquo;t part of any image. devvm builds each version once and mounts it read-only into every VM that has it, and <a href="https://mise.jdx.dev" target="_blank" rel="noopener">mise</a> runs it, so each toolchain&rsquo;s commands, such as <code>node</code> or <code>cargo</code>, work from any shell in the VM, including <code>bash -c</code> from agents and from editors over SSH. Because the shared copy is read-only, a toolchain can&rsquo;t update itself, and anything you install globally goes into your home in the VM, as each section above says.</p>
|
||
<p>devvm follows each toolchain&rsquo;s newest release, and Node 24 for node:</p>
|
||
<ul>
|
||
<li><a href="#which-bases-they-run-on">Which bases they run on</a> says what each one needs from a VM&rsquo;s base.</li>
|
||
<li><a href="#adding-and-removing-tools">Adding and removing tools</a> explains how <code>devvm update</code> and <code>devvm tools update</code> move a VM to newer versions, how <code>devvm tools add</code> adds a toolchain to an existing VM, and how <code>devvm tools rm</code> takes one out.</li>
|
||
<li><a href="https://next.devvm.dev/docs/using/images/#what-a-new-vm-gets">What a new VM gets</a> explains what happens when a folder calls for more than one toolchain.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="which-bases-they-run-on">Which bases they run on<span class="hx:absolute hx:-mt-20" id="which-bases-they-run-on"></span>
|
||
<a href="#which-bases-they-run-on" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Every toolchain runs on <code>base</code> from Ubuntu&rsquo;s own image, and on an Alpine-based image with <a href="https://next.devvm.dev/docs/using/from/"><code>--from</code></a>, which gets musl builds of the tools. dotnet also needs ICU, the Unicode library that .NET&rsquo;s globalization uses, so devvm installs ICU in <code>base</code>, whether it&rsquo;s made from Ubuntu&rsquo;s image or <code>--from</code> a container image. On a Debian- or Ubuntu-based image, each tool needs at least the glibc version that its prebuilt release was built against. devvm measures that version from the tool&rsquo;s files whenever it builds a new version, and it refuses a tool whose version is newer than the image&rsquo;s glibc (<a href="https://next.devvm.dev/docs/using/from/#shared-tools-and-glibc">shared tools and glibc</a>). Today the shared tools need these glibc versions, so Debian 10 and Ubuntu 20.04 and newer images run all of them:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Shared tool</th>
|
||
<th>arm64</th>
|
||
<th>amd64</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>node</td>
|
||
<td>2.28</td>
|
||
<td>2.28</td>
|
||
</tr>
|
||
<tr>
|
||
<td>pnpm and bun, with node</td>
|
||
<td>2.18 and 2.17</td>
|
||
<td>2.18 and 2.17</td>
|
||
</tr>
|
||
<tr>
|
||
<td>python</td>
|
||
<td>2.17</td>
|
||
<td>2.17</td>
|
||
</tr>
|
||
<tr>
|
||
<td>uv, with python</td>
|
||
<td>2.28</td>
|
||
<td>2.17</td>
|
||
</tr>
|
||
<tr>
|
||
<td>rust, with rustup</td>
|
||
<td>2.17</td>
|
||
<td>2.17</td>
|
||
</tr>
|
||
<tr>
|
||
<td>go</td>
|
||
<td>none, because its programs need no glibc</td>
|
||
<td>none</td>
|
||
</tr>
|
||
<tr>
|
||
<td>dotnet</td>
|
||
<td>2.27</td>
|
||
<td>2.27</td>
|
||
</tr>
|
||
<tr>
|
||
<td>claude, opencode and pi</td>
|
||
<td>2.17</td>
|
||
<td>2.17</td>
|
||
</tr>
|
||
<tr>
|
||
<td>codex</td>
|
||
<td>2.28, for its voice helper</td>
|
||
<td>2.28</td>
|
||
</tr>
|
||
<tr>
|
||
<td>cursor</td>
|
||
<td>2.28, for the node it bundles</td>
|
||
<td>2.28</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<h2 data-hextra-search-id="adding-and-removing-tools">Adding and removing tools<span class="hx:absolute hx:-mt-20" id="adding-and-removing-tools"></span>
|
||
<a href="#adding-and-removing-tools" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A new VM gets the shared tools chosen when devvm makes it, the toolchains and the <a href="https://next.devvm.dev/docs/using/coding-agents/#supported-agents">coding agents</a>, and keeps those versions. On each launch, devvm warns when there are newer ones and names <code>devvm update</code>, which moves the VM to them, and also makes the VM again when its image has changed, after asking (<a href="https://next.devvm.dev/docs/using/images/#outdated-vms">outdated VMs</a>).</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm tools <span class="c1"># choose this folder&#39;s VM&#39;s toolchains and agents in a list</span>
|
||
</span></span><span class="line"><span class="cl">devvm tools add python claude <span class="c1"># add tools without the list</span>
|
||
</span></span><span class="line"><span class="cl">devvm tools rm python <span class="c1"># take one out</span>
|
||
</span></span><span class="line"><span class="cl">devvm tools update <span class="c1"># move the VM to the newest shared tools</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>In a terminal, <code>devvm tools</code> shows the same list as for a new VM, with this folder&rsquo;s VM&rsquo;s toolchains and agents already chosen and its layers greyed out, because they&rsquo;re built into the VM&rsquo;s image, which keeps them until <code>devvm layer add</code> or <code>devvm layer rm</code> makes it again. The Layers heading names <code>devvm layer add</code> and <code>devvm layer rm</code>, which change a VM&rsquo;s layers by making it again (<a href="https://next.devvm.dev/docs/using/images/#adding-layers-to-a-vm">adding layers to a VM</a>). Choose the tools and confirm, and devvm adds and takes out what changed, as <code>devvm tools add</code> and <code>devvm tools rm</code> do, then opens a shell in the VM. When a new agent&rsquo;s config folders need the running VM to start again, devvm asks first. When nothing changed, devvm says so and opens nothing.</p>
|
||
<p>Without a terminal, or with <code>--no-input</code> or <code>--json</code>, <code>devvm tools</code> shows the tools of this folder&rsquo;s VM in a table, one row per tool, with node&rsquo;s pnpm and bun and python&rsquo;s uv in rows of their own:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Column</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>TOOL</code></td>
|
||
<td>the tool&rsquo;s name, such as <code>node</code> or <code>pnpm</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>VERSION</code></td>
|
||
<td>the version the VM has</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>NEWER</code></td>
|
||
<td>the version in devvm&rsquo;s tools lock when the VM has another build, which is usually a newer version, or <code>-</code> when the VM has the lock&rsquo;s build</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>BUILT</code></td>
|
||
<td><code>yes</code> when that newer version is built, <code>no</code> when <code>devvm tools update</code> builds it first, or <code>-</code></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>The table changes nothing and starts no VM. devvm reads the tools lock as it is, without going online, so a release that came out since devvm last checked isn&rsquo;t in it yet.</p>
|
||
<h3 data-hextra-search-id="devvm-tools-json">devvm tools &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-tools-json"></span>
|
||
<a href="#devvm-tools-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm tools --json</code> prints the same table as one JSON object, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes. Each of the <code>tools</code> has the tool&rsquo;s name and the VM&rsquo;s version. A tool that the lock has another build of also has <code>newer</code>, which is the lock&rsquo;s version, and <code>newer_built</code>, which says whether that version is built.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;tools&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;tool&#34;</span><span class="p">:</span> <span class="s2">&#34;node&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="s2">&#34;24.10.0&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;newer&#34;</span><span class="p">:</span> <span class="s2">&#34;24.11.0&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;newer_built&#34;</span><span class="p">:</span> <span class="kc">false</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;tool&#34;</span><span class="p">:</span> <span class="s2">&#34;pnpm&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="s2">&#34;10.18.0&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>The commands below change the VM&rsquo;s tools from a script or the command line. They don&rsquo;t change the VM&rsquo;s disk, because its tools are mounted, so a change takes effect when devvm then opens a shell in the VM. Each takes the tools&rsquo; names as separate words, as in <code>devvm tools add python claude</code>, and devvm refuses names joined with <code>+</code> or a comma.</p>
|
||
<ul>
|
||
<li><code>devvm tools add TOOL...</code> builds the tools that the share lacks, and they join the VM&rsquo;s list at once. It says which of the tools the VM has already and leaves those as they are. A new agent&rsquo;s config folders are mounted too, which needs the VM to start again. A stopped VM gets them as it starts, and for a running VM devvm asks before restarting it, because anything running in it stops (<a href="https://next.devvm.dev/docs/using/vms/#restarting-and-stopping">restarting</a>). If you answer no, there&rsquo;s no terminal or you pass <code>--no-input</code>, the VM gets them at its next start.</li>
|
||
<li><code>devvm tools rm TOOL...</code> takes tools out. What the VM installed itself, such as other versions or global packages, stays.</li>
|
||
<li><code>devvm tools update</code> checks upstream for newer versions, builds what&rsquo;s missing, and moves the VM to them. When the VM already has the newest versions, it builds any of them that are missing. It changes only the shared tools, and never makes the VM again.</li>
|
||
<li><code>devvm update</code> does the same first, without asking, and then asks to make the VM again only when the VM&rsquo;s image has changed (<a href="https://next.devvm.dev/docs/using/images/#outdated-vms">outdated VMs</a>), or its <code>devcontainer.json</code> has (<a href="https://next.devvm.dev/docs/using/devcontainer/#updating-a-vm-from-the-file">updating a VM from the file</a>).</li>
|
||
</ul>
|
||
<p><code>--tools</code>, <code>--agents</code> and <code>--layers</code> choose only what a new VM gets, so on a VM that exists they change nothing, and devvm warns and names <code>devvm tools</code>. Layers aren&rsquo;t shared tools, so <code>devvm tools</code> can&rsquo;t add or take out a layer such as <code>docker</code> or <code>nix</code>. A VM gets its layers when devvm makes it, so <code>devvm layer add</code> and <code>devvm layer rm</code> change them by making the VM again, after asking (<a href="https://next.devvm.dev/docs/using/images/#adding-layers-to-a-vm">adding layers to a VM</a>).</p></description></item><item><title>SSH and editors</title><link>https://next.devvm.dev/docs/using/ssh/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/ssh/</guid><description>
|
||
<p>You can reach each running VM by name from ssh and from editors such as VS Code and Cursor, and you choose for each VM whether it can use your SSH keys. <a href="https://next.devvm.dev/docs/internals/security/#ssh-into-vms">ssh into VMs</a> explains how devvm&rsquo;s ssh entries keep a VM away from the rest of this machine.</p>
|
||
<h2 data-hextra-search-id="ssh-access-by-name">SSH access by name<span class="hx:absolute hx:-mt-20" id="ssh-access-by-name"></span>
|
||
<a href="#ssh-access-by-name" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Each running project VM can be reached as <code>devvm-&lt;folder&gt;</code>, as in <code>ssh devvm-website</code> or VS Code&rsquo;s <em>Remote-SSH: Connect to Host</em>. devvm chooses this alias once, when it makes the VM, and records it, so it never changes. A VM gets <code>devvm-&lt;folder&gt;</code> unless another VM already has that alias, and then its alias is its full name. So when two folders share a name, the first VM made keeps <code>devvm-website</code>, and the second one&rsquo;s alias is its full name, whichever of them you delete first. The VM&rsquo;s full name (<code>devvm-website-&lt;hash&gt;</code>) always works as well.</p>
|
||
<p>devvm writes these entries to <code>~/.local/share/devvm/ssh_config</code> each time it launches or stops a VM, because a VM&rsquo;s SSH port can change each time it starts. To use them, add this line to the top of <code>~/.ssh/config</code>, before any <code>Host</code> block:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Include ~/.local/share/devvm/ssh_config</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>You can also point ssh at the file, as in <code>ssh -F ~/.local/share/devvm/ssh_config devvm-website</code>. <code>devvm host</code>, <code>devvm code</code>, <code>devvm cursor</code> and a new <a href="https://next.devvm.dev/docs/using/clone/"><code>--clone</code></a> VM offer to add the line in a terminal, and without one, they show it.</p>
|
||
<ul>
|
||
<li><strong>Only running VMs are listed.</strong> A stopped VM&rsquo;s port is free for any program on this machine to take, so an entry for it could hand your connection, and your agent, to that program. Start the VM with <code>devvm host</code> or <code>devvm</code> before you connect from an editor.</li>
|
||
<li><strong>Each entry checks the VM&rsquo;s own host keys,</strong> which devvm reads from the VM once each time it starts and keeps in the VM&rsquo;s folder, <code>~/.local/share/devvm/vms/&lt;hash&gt;/run/known_hosts</code>. ssh refuses a host key that doesn&rsquo;t match, and a VM whose keys devvm can&rsquo;t read gets no entry.</li>
|
||
<li><strong>Each entry reaches the VM on this machine&rsquo;s loopback, <code>127.0.0.1</code>,</strong> as the VM&rsquo;s user with the VM&rsquo;s own key. A VM whose backend names any other address, or no user or key, gets no entry, so ssh never takes your connection somewhere else.</li>
|
||
<li><strong>The entries need OpenSSH 8.7 or newer</strong> (<code>ssh -V</code>), and an older ssh refuses them.</li>
|
||
<li><strong>ssh sends your terminal&rsquo;s <code>COLORTERM</code>,</strong> so programs in the VM show 24-bit color when your terminal does. It&rsquo;s the only variable the entries send beyond the ones your own ssh config sends, and a VM made with <code>--from</code> gets it only when its image&rsquo;s sshd accepts it, as devvm&rsquo;s base does.</li>
|
||
<li><strong>Keep remote forwards out of <code>Host *</code>.</strong> The entries turn off what else your ssh config could share with a VM, but they can&rsquo;t turn off a <code>RemoteForward</code> of yours.</li>
|
||
</ul>
|
||
<!-- markdownlint-disable-next-line MD033 -- the section's anchor before its rename, which released versions' messages link to -->
|
||
<p><a id="devvm-host-and-devvm-code"></a></p>
|
||
<h2 data-hextra-search-id="devvm-host-devvm-code-and-devvm-cursor">devvm host, devvm code and devvm cursor<span class="hx:absolute hx:-mt-20" id="devvm-host-devvm-code-and-devvm-cursor"></span>
|
||
<a href="#devvm-host-devvm-code-and-devvm-cursor" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm host <span class="c1"># get this folder&#39;s VM ready, and show the name ssh and editors reach it by</span>
|
||
</span></span><span class="line"><span class="cl">devvm code <span class="c1"># the same, then open its folder in VS Code over Remote-SSH</span>
|
||
</span></span><span class="line"><span class="cl">devvm cursor <span class="c1"># the same, then open its folder in Cursor over Remote-SSH</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm host</code> gets this folder&rsquo;s VM ready for ssh and editors, then shows its host name (<code>devvm-website</code>) and its folder in the VM. It does what <a href="https://next.devvm.dev/docs/internals/overview/#an-existing-vm">a launch of an existing VM</a> does, without opening a shell. It checks <code>.git</code>, applies the size, ports and agent forwarding that a stopped VM&rsquo;s state asks for, starts the VM if it&rsquo;s stopped, runs the <a href="https://next.devvm.dev/docs/internals/network/#the-self-check">self-check</a>, sets the VM up and writes the ssh config. A VM whose tier isn&rsquo;t enforced is stopped, and it gets no name. The editors&rsquo; commands start the same way:</p>
|
||
<ul>
|
||
<li><code>devvm code</code> does the same, then opens the folder in VS Code over Remote-SSH with VS Code&rsquo;s <code>code</code> command, as in <code>code --remote ssh-remote+devvm-website ~/website</code>. VS Code gets the SSH agent that devvm was started with, not the one that devvm&rsquo;s own connections to the VM carry. Without <code>code</code> on <code>PATH</code>, devvm names the host to connect to with <em>Remote-SSH: Connect to Host</em>.</li>
|
||
<li><code>devvm cursor</code> does the same in Cursor, the editor, with its <code>cursor</code> command, as in <code>cursor --remote ssh-remote+devvm-website ~/website</code>. Cursor gets the SSH agent that devvm was started with too, and without <code>cursor</code> on <code>PATH</code>, devvm names the host to connect to from Cursor. Cursor installs its <code>cursor</code> command from its command palette, as VS Code does its <code>code</code>. Cursor&rsquo;s CLI agent, which runs in the VM, is another program, with commands of its own (<a href="https://next.devvm.dev/docs/using/coding-agents/#cursor-cli-login">Cursor CLI login</a>).</li>
|
||
</ul>
|
||
<!-- markdownlint-disable-next-line MD033 -- the section's anchor before its rename, which released versions' help links to -->
|
||
<p><a id="vs-code"></a></p>
|
||
<h3 data-hextra-search-id="vs-code-and-cursor">VS Code and Cursor<span class="hx:absolute hx:-mt-20" id="vs-code-and-cursor"></span>
|
||
<a href="#vs-code-and-cursor" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Over Remote-SSH, VS Code and Cursor reach further than ssh:</p>
|
||
<ul>
|
||
<li><strong>Ports.</strong> They forward the ports that programs they start in the VM listen on to this machine&rsquo;s <code>localhost</code>, whatever <code>devvm ports</code> says. Those programs include their terminals, their tasks and an agent.</li>
|
||
<li><strong>Git sign-in.</strong> They answer git&rsquo;s credential prompts in the VM with your GitHub sign-in in the editor.</li>
|
||
<li><strong>Your editor&rsquo;s own sign-ins.</strong> The editor&rsquo;s extensions run in the VM, its AI features among them, such as GitHub Copilot in VS Code and Cursor&rsquo;s own AI and codebase indexing. They may get the editor&rsquo;s sign-ins to work there, such as Copilot&rsquo;s GitHub token or your Cursor login, and devvm&rsquo;s proxy doesn&rsquo;t hold those back. devvm hasn&rsquo;t checked what reaches the VM, so take it that a program in the VM could read them.</li>
|
||
</ul>
|
||
<p>devvm turns the first two off in each editor&rsquo;s settings for the VM, which are <code>~/.vscode-server/data/Machine/settings.json</code> in the VM for VS Code and <code>~/.cursor-server/data/Machine/settings.json</code> for Cursor. Each time devvm sets the VM up, it sets <code>remote.autoForwardPorts</code>, <code>git.terminalAuthentication</code> and <code>github.gitAuthentication</code> to <code>false</code> in both files and keeps their other settings. A file with comments isn&rsquo;t plain JSON, so devvm leaves it as it is and says so in the run log. A file or folder that devvm can&rsquo;t write is said in the run log too, and the rest of the setup goes on.</p>
|
||
<p>Those settings only cover ordinary use:</p>
|
||
<ul>
|
||
<li>The VM can turn the three back on, and setting them in your own settings on this machine doesn&rsquo;t stop it: in VS Code, the settings on the remote machine and the opened folder&rsquo;s <code>.vscode/settings.json</code>, both of which the VM can write, take precedence over yours for all three. Only a policy that an administrator sets takes precedence over the VM&rsquo;s.</li>
|
||
<li>Even with port forwarding off, an extension or a URL that the editor opens can still forward a port.</li>
|
||
<li>Cursor is built on VS Code, so it most likely works the same way, though devvm hasn&rsquo;t checked it.</li>
|
||
</ul>
|
||
<p>So don&rsquo;t open a VM you don&rsquo;t trust with <code>devvm code</code> or <code>devvm cursor</code>, and use <code>ssh</code> or devvm&rsquo;s shell instead, or sign out of the editor&rsquo;s AI features and its GitHub sign-in first. Programs in the VM can also open URLs in this machine&rsquo;s browser (<code>$BROWSER</code>).</p>
|
||
<h3 data-hextra-search-id="cursors-agent">Cursor&rsquo;s Agent<span class="hx:absolute hx:-mt-20" id="cursors-agent"></span>
|
||
<a href="#cursors-agent" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Recent releases of Cursor run its Agent in the editor&rsquo;s server in the VM, not in the Cursor app on this machine. That server holds your Cursor sign-in in memory and uses it to talk to Cursor, so code in the VM could use your sign-in while the window is open.</p>
|
||
<p>The safest way to use <code>devvm cursor</code> is a VM on the allowlist or none tier without Cursor&rsquo;s CLI:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm --network allowlist --agents claude <span class="c1"># any agents but cursor</span>
|
||
</span></span><span class="line"><span class="cl">devvm cursor</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<ul>
|
||
<li>The VM can&rsquo;t reach Cursor&rsquo;s hosts, so its server can&rsquo;t use your sign-in.</li>
|
||
<li>Agent and Tab still work: Cursor sends their requests through the app on this machine when the VM can&rsquo;t reach Cursor.</li>
|
||
<li><code>devvm network log</code> shows the VM&rsquo;s server trying <code>api2.cursor.sh</code> and <code>downloads.cursor.com</code>, blocked. The second is the server trying to download itself into the VM; Cursor then downloads it on this machine and copies it in.</li>
|
||
</ul>
|
||
<p>A VM with Cursor&rsquo;s CLI has Cursor&rsquo;s hosts on its allowlist, so there the editor&rsquo;s server can use your sign-in. To send Agent&rsquo;s own requests through the app either way, add this line to your Cursor user settings, <code>~/Library/Application Support/Cursor/User/settings.json</code> on macOS or <code>Cursor/User/settings.json</code> in <code>$XDG_CONFIG_HOME</code>, by default <code>~/.config</code>, on Linux:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="s2">&#34;cursorAgentHost.remoteInferenceRoute&#34;</span><span class="err">:</span> <span class="s2">&#34;always&#34;</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Once it finds Cursor&rsquo;s <code>cursor</code> command, <code>devvm cursor</code> reads that file, without changing it, and warns before it opens Cursor when the line isn&rsquo;t there, or when it can&rsquo;t read the file. Cursor reads the setting only from your user settings, never from the VM&rsquo;s. The setting doesn&rsquo;t take your sign-in out of the VM, though: the editor&rsquo;s server still signs in to Cursor where it can reach it, so open only VMs you trust with <code>devvm cursor</code>.</p>
|
||
<h2 data-hextra-search-id="agent-forwarding">Agent forwarding<span class="hx:absolute hx:-mt-20" id="agent-forwarding"></span>
|
||
<a href="#agent-forwarding" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>SSH agent forwarding is off by default. While it&rsquo;s on and you&rsquo;re connected, anything in the VM, coding agents included, can <em>use</em> the agent&rsquo;s keys, for example to push, to log in to servers or to sign any data, as <code>ssh-keygen -Y sign</code> does. It can&rsquo;t copy or remove them, lock the agent or add keys to it (<a href="https://next.devvm.dev/docs/internals/processes/#the-ssh-agents">the SSH agents</a>). Turn forwarding on for one VM when you need git over SSH there.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm --ssh-agent <span class="c1"># a new VM that forwards your SSH agent</span>
|
||
</span></span><span class="line"><span class="cl">devvm ssh-agent <span class="c1"># show this folder&#39;s VM&#39;s choice and devvm&#39;s agent&#39;s keys</span>
|
||
</span></span><span class="line"><span class="cl">devvm ssh-agent on <span class="c1"># forward your SSH agent to this folder&#39;s VM from its next start</span>
|
||
</span></span><span class="line"><span class="cl">devvm ssh-agent add ~/.ssh/deploy_key <span class="c1"># or load one key into devvm&#39;s own agent</span>
|
||
</span></span><span class="line"><span class="cl">devvm ssh-agent devvm <span class="c1"># and forward that agent instead of yours</span>
|
||
</span></span><span class="line"><span class="cl">devvm ssh-agent off <span class="c1"># stop forwarding from the VM&#39;s next start</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<div class="devvm-diagram" style="contain-intrinsic-block-size: auto 220px; --devvm-diagram-width: 687px"><svg xmlns="http://www.w3.org/2000/svg" class="pele pele-flowchart" viewBox="0 0 687 220" width="687" height="220" style="--_bg:var(--pele-bg,#fff);--_fg:var(--pele-fg,#1f1f1f);--_m:var(--pele-muted,#6e6e6e);--_l:var(--pele-line,#1f1f1f);--_s:var(--pele-surface,#f3f3f3);--_a:var(--pele-surface-alt,#e6e6e6);--_b:var(--pele-border,#8a8a8a);--_c:var(--pele-accent,#5b7bd5);color:var(--_fg);--_r:var(--pele-radius,4px);--_fm:var(--pele-font-mono,&quot;Departure Mono&quot;, monospace);font:14px sans-serif;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;font-family:var(--pele-font,&quot;Departure Mono&quot;, monospace)" fill="var(--_fg)" role="graphics-document document" aria-roledescription="flowchart" aria-labelledby="df00e32c0a2b4116b--title" aria-describedby="df00e32c0a2b4116b--desc"><title id="df00e32c0a2b4116b--title">The SSH agent a VM gets</title><desc id="df00e32c0a2b4116b--desc">With devvm ssh-agent off, the default, the VM has no agent, so git over SSH fails. With on, it has your agent while you're connected, and with devvm, it has devvm's own agent, with only the keys you added.</desc><g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round"><g class="pele-edge" data-id="L_choice_off_0"><path d="M304.27,53L304.27,59Q304.27,71 292.27,71L118.18,71Q106.18,71 106.18,83L106.18,126.5"/><path class="pele-marker" d="M106.18,133.5L102.82,125.5L109.54,125.5Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_choice_on_0"><path d="M343.09,53L343.09,126.5"/><path class="pele-marker" d="M343.09,133.5L339.73,125.5L346.45,125.5Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_choice_own_0"><path d="M381.91,53L381.91,59Q381.91,71 393.91,71L568,71Q580,71 580,83L580,126.5"/><path class="pele-marker" d="M580,133.5L576.64,125.5L583.36,125.5Z" fill="var(--_l)" stroke="none"/></g></g><g class="pele-edge-labels" font-size="14"><g class="pele-edge-label" data-id="L_choice_off_0"><rect x="30.91" y="91" width="150.55" height="18" rx="3" fill="var(--_bg)"/><text x="106.18" y="104.2" text-anchor="middle">off, the default</text>
|
||
</g><g class="pele-edge-label" data-id="L_choice_on_0"><rect x="330.18" y="91" width="25.82" height="18" rx="3" fill="var(--_bg)"/><text x="343.09" y="104.2" text-anchor="middle">on</text>
|
||
</g><g class="pele-edge-label" data-id="L_choice_own_0"><rect x="553.73" y="91" width="52.55" height="18" rx="3" fill="var(--_bg)"/><text x="580" y="104.2" text-anchor="middle">devvm</text>
|
||
</g></g><g class="pele-nodes"><g class="pele-node pele-shape-hex" data-id="choice" transform="translate(343.09,30.5)"><polygon points="-84.82,-22.5 84.82,-22.5 96.07,0 84.82,22.5 -84.82,22.5 -96.07,0" fill="var(--_s)" stroke="var(--_b)"/><text class="pele-label" x="0" y="4.9" text-anchor="middle">devvm ssh-agent</text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="off" transform="translate(106.18,163.5)"><rect x="-98.18" y="-30" width="196.36" height="60" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">no agent:</tspan><tspan x="0" y="13.9">git over SSH fails</tspan></text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="on" transform="translate(343.09,163.5)"><rect x="-93.73" y="-30" width="187.45" height="60" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">your agent, while</tspan><tspan x="0" y="13.9">you're connected</tspan></text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="own" transform="translate(580,172.5)"><rect x="-98.18" y="-39" width="196.36" height="78" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-13.1">devvm's own agent,</tspan><tspan x="0" y="4.9">with only the keys</tspan><tspan x="0" y="22.9">you added</tspan></text>
|
||
</g></g></svg></div><ul>
|
||
<li><code>devvm --ssh-agent</code> creates the VM forwarding your agent. <code>devvm ssh-agent on</code>, <code>devvm</code> or <code>off</code> changes it for an existing VM from its next start, and <code>devvm ssh-agent</code> shows it. For a running VM, devvm asks in a terminal whether to restart it now, as <code>devvm restart</code> does, and otherwise, or without a terminal or with <code>--no-input</code>, the change waits for <code>devvm restart</code> or the VM&rsquo;s next start. Until then, each time devvm opens the running VM it asks in a terminal whether to restart it with the change, with no as the default unless an agent&rsquo;s new folders wait too (<a href="https://next.devvm.dev/docs/using/vms/#restarting-and-stopping">restarting</a>).</li>
|
||
<li>The choice applies to devvm&rsquo;s shells and to the ssh entries alike, both as the VM&rsquo;s current start was made with, so a change reaches neither until the VM next starts, whichever folder devvm runs from. When forwarding is on, an entry names the VM&rsquo;s own agent socket, <code>~/.local/share/devvm/run/agent-&lt;hash&gt;.sock</code>, as the agent, so an editor forwards the agent the VM started with however the editor was started. When forwarding is off, an entry says <code>ForwardAgent no</code>, whatever your own <code>Host *</code> settings say, and none of devvm&rsquo;s own connections to the VM carry your agent.</li>
|
||
<li>A VM started outside devvm, such as with <code>devvm limactl start</code>, gets no agent in its ssh entry, because nothing says which agent that start forwards. devvm&rsquo;s shells get its proxy&rsquo;s relay of the agent that devvm last started it with, if any, until devvm starts it again.</li>
|
||
<li>A VM that has run since before you upgraded devvm to this release can still remove the agent&rsquo;s keys, lock the agent and add keys to it until its next start. devvm warns of such a VM each time it opens it or changes its links, and <code>devvm restart</code> in its folder gives it the relay at once.</li>
|
||
<li>With forwarding off, git over SSH in the VM fails. devvm says so when it creates a VM for a repo whose <code>origin</code> is an SSH URL. Use an HTTPS remote with a GitHub token instead, or turn forwarding on.</li>
|
||
<li><strong>No keys loaded.</strong> When a VM forwards your agent, the agent has no keys and <code>~/.ssh</code> has one, devvm offers to load it (<code>ssh-add --apple-use-keychain</code> on macOS). To keep it loaded across reboots, add <code>AddKeysToAgent yes</code>, and <code>UseKeychain yes</code> on macOS, under <code>Host *</code> in <code>~/.ssh/config</code>.</li>
|
||
<li>You can also use an agent that asks you to approve each use, such as 1Password&rsquo;s or Secretive.</li>
|
||
</ul>
|
||
<p>GitHub&rsquo;s host keys are preinstalled in every VM, so a first connection to GitHub doesn&rsquo;t prompt.</p>
|
||
<h3 data-hextra-search-id="devvms-own-agent">devvm&rsquo;s own agent<span class="hx:absolute hx:-mt-20" id="devvms-own-agent"></span>
|
||
<a href="#devvms-own-agent" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>devvm&rsquo;s own agent keeps your other keys out of reach, because it holds only the keys you add to it, such as a deploy key or a key with access to fewer repos.</p>
|
||
<ul>
|
||
<li><code>devvm ssh-agent add ~/.ssh/deploy_key</code> starts the agent and loads the key. The agent&rsquo;s socket is <code>~/.local/share/devvm/agent.sock</code>. <code>devvm ssh-agent devvm</code> makes this folder&rsquo;s VM forward that agent instead of yours, in devvm&rsquo;s shells and in the ssh entries alike. VMs share the agent, but none of them can remove its keys or lock it for the others.</li>
|
||
<li><code>devvm ssh-agent</code> shows this folder&rsquo;s VM&rsquo;s choice, and once you&rsquo;ve added a key, it then lists the keys devvm&rsquo;s agent holds, as <code>ssh-add -l</code> does, and each key you added, with its file, its fingerprint and how it&rsquo;s loaded. It loads the keys the agent lacks before it lists them.</li>
|
||
<li><code>devvm ssh-agent rm ~/.ssh/deploy_key</code> takes the key out of devvm&rsquo;s agent and out of <code>~/.local/share/devvm/agent-keys.json</code>, so devvm doesn&rsquo;t load it again. devvm finds the key in the agent by the fingerprint it recorded, so the key file can have changed or be gone, and devvm leaves the file itself as it is. devvm refuses a key you didn&rsquo;t add, and <code>devvm ssh-agent</code> lists the ones you did.</li>
|
||
<li>devvm loads a key again when a VM that uses the agent launches without it, such as after a reboot or once the key&rsquo;s lifetime ran out, and it asks for the key&rsquo;s passphrase if it has one. It does so only while the file holds the key you added. <code>add</code> records the key&rsquo;s fingerprint, so devvm doesn&rsquo;t load a file that was replaced since, or a link that was swapped to another key. A key you replaced in place needs <code>devvm ssh-agent add</code> again.</li>
|
||
<li>devvm refuses a key inside a folder a VM mounts, and doesn&rsquo;t load it, because that VM could read it. That&rsquo;s every folder that a VM&rsquo;s state says it mounts, whether the VM is running or stopped: its project folder, its agents&rsquo; config folders and the shared tools. Keep the keys for devvm&rsquo;s agent outside project folders.</li>
|
||
<li>An encrypted key in the old PEM format needs converting first, with <code>ssh-keygen -p -f KEY</code>, because devvm can&rsquo;t read its fingerprint without the passphrase.</li>
|
||
</ul>
|
||
<p>The agent drops each key 12 hours after it loads it, so a VM can&rsquo;t keep using the key indefinitely. <code>--lifetime 30m</code> changes that for one key, and it takes a <a href="https://next.devvm.dev/docs/using/command-line/#flags-and-values">duration</a> in minutes, hours, days or weeks, such as <code>30m</code>, <code>8h</code> or <code>1d</code>, or <code>forever</code>. <code>--confirm</code> makes the agent ask you before each use, such as each push or each login, through an <code>ssh-askpass</code> program. macOS doesn&rsquo;t include one, so install one and put it on your <code>PATH</code>, or set <code>SSH_ASKPASS</code> to it. devvm keeps the keys and their options in <code>~/.local/share/devvm/agent-keys.json</code>, and running <code>devvm ssh-agent add</code> on the same key again replaces its options.</p>
|
||
<h3 data-hextra-search-id="devvm-ssh-agent-json">devvm ssh-agent &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-ssh-agent-json"></span>
|
||
<a href="#devvm-ssh-agent-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm ssh-agent --json</code> prints what <code>devvm ssh-agent</code> shows as one JSON object, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes. <code>mode</code> is this folder&rsquo;s VM&rsquo;s choice, <code>off</code>, <code>on</code> or <code>devvm</code>. Each of the <code>keys</code> is a key you added to devvm&rsquo;s agent, with its <code>file</code>, the <code>fingerprint</code> devvm recorded, <code>confirm</code>, its <code>lifetime</code> and <code>loaded</code>, which says whether the agent holds it. As without <code>--json</code>, devvm loads the keys the agent lacks first, and with no key added, <code>keys</code> is <code>[]</code> and devvm doesn&rsquo;t start its agent. With <code>--json</code> the command only shows, so devvm refuses <code>on</code>, <code>devvm</code> or <code>off</code> with it.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;mode&#34;</span><span class="p">:</span> <span class="s2">&#34;devvm&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;keys&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;file&#34;</span><span class="p">:</span> <span class="s2">&#34;/Users/you/.ssh/deploy_key&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;fingerprint&#34;</span><span class="p">:</span> <span class="s2">&#34;SHA256:mVPwvezndPv/ARoIadVY98vAC0g+P/5633yTC4d/wXE&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;confirm&#34;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;lifetime&#34;</span><span class="p">:</span> <span class="s2">&#34;12h&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;loaded&#34;</span><span class="p">:</span> <span class="kc">true</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div></description></item><item><title>Ports and size</title><link>https://next.devvm.dev/docs/using/ports-size/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/ports-size/</guid><description>
|
||
<p>This page covers the ports a VM forwards to this machine and the CPUs, memory and disk it gets. You choose both when devvm makes a VM, and you can change both later with <code>devvm ports</code> and <code>devvm size</code>. <a href="https://next.devvm.dev/docs/internals/ports/">Port forwarding</a> explains how devvm&rsquo;s forwarder works.</p>
|
||
<h2 data-hextra-search-id="size-and-ports">Size and ports<span class="hx:absolute hx:-mt-20" id="size-and-ports"></span>
|
||
<a href="#size-and-ports" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A new VM gets its image&rsquo;s size unless you set one with <code>--cpus</code>, <code>--memory</code> and <code>--disk</code>, as in <code>devvm --cpus 6</code>. For <code>base</code> that&rsquo;s 4 CPUs, 8 GiB of memory and a 100 GiB disk. On a machine with fewer than 4 CPUs, base gets as many CPUs as the machine has, and when 8 GiB would leave the machine less than 2 GiB of its own, base gets half of the machine&rsquo;s memory, which is 4 GiB on an 8 GiB machine. When devvm builds base on such a machine, it says how many CPUs and how much memory base gets, and <code>devvm size -g</code> sets the size that new VMs get instead.</p>
|
||
<ul>
|
||
<li><code>--cpus</code> takes a whole number. <code>--memory</code> and <code>--disk</code> take a size in GiB, written <code>16</code>, <code>16G</code> or <code>16GiB</code>, and decimals are allowed.</li>
|
||
<li>What the flags leave unset comes from the <code>[size]</code> table of <a href="https://next.devvm.dev/docs/using/settings/#configtoml"><code>config.toml</code></a> when it sets it, else from what <code>devvm size -g</code> and <code>devvm setup</code> saved (<a href="#choosing-new-vms-size">choosing new VMs&rsquo; size</a>).</li>
|
||
<li>devvm refuses more CPUs than this machine has, and a disk smaller than the image&rsquo;s, because disks can&rsquo;t shrink. It refuses them before it builds anything.</li>
|
||
<li>devvm also refuses more memory than a VM can have, because a VM that asks for all of this machine&rsquo;s memory doesn&rsquo;t start. A VM can have this machine&rsquo;s memory less 2 GiB, counted in whole GiB, so 6 GiB on an 8 GiB machine. On a machine with 4 GiB or less, it can have half, so 2 GiB on a 4 GiB machine. When you ask for more, devvm says how much memory this machine has and the most you can give a VM, so you can run the command again with that.</li>
|
||
</ul>
|
||
<p>A new VM forwards every TCP port from 1024 up that it listens on, unless <code>--ports</code> says otherwise, as in <code>devvm --ports 5173</code>.</p>
|
||
<ul>
|
||
<li><code>--ports</code> takes <code>all</code>, <code>none</code>, or ports and ranges such as <code>5173,8000-8010</code>.</li>
|
||
<li>Without <code>--ports</code>, the default comes from <code>ports</code> in <a href="https://next.devvm.dev/docs/using/settings/#configtoml"><code>config.toml</code></a> when it sets it, else from what <code>devvm ports -g</code> saved, and without either, a new VM forwards every port.</li>
|
||
<li>When you customize a new VM without <code>--ports</code>, devvm asks whether it forwards every port, none or the ports you type, starting from the default, and saves the answer for that VM alone (<a href="https://next.devvm.dev/docs/using/images/#what-a-new-vm-gets">what a new VM gets</a>).</li>
|
||
</ul>
|
||
<p>devvm refuses a default that isn&rsquo;t a valid value, as it refuses a bad flag, and for one in <code>config.toml</code> it names the file and the line (<a href="https://next.devvm.dev/docs/using/settings/#when-devvm-cant-read-it">when devvm can&rsquo;t read it</a>).</p>
|
||
<h2 data-hextra-search-id="ports">Ports<span class="hx:absolute hx:-mt-20" id="ports"></span>
|
||
<a href="#ports" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A VM forwards the TCP ports it listens on to the same port on this machine&rsquo;s <code>localhost</code>, so a server on <code>:5173</code> in the VM is at <code>localhost:5173</code> here. To change which ports a VM forwards:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm ports <span class="c1"># what this folder&#39;s VM forwards: all, none or a list</span>
|
||
</span></span><span class="line"><span class="cl">devvm ports 5173,8000-8010 <span class="c1"># only these ports and ranges</span>
|
||
</span></span><span class="line"><span class="cl">devvm ports add <span class="m">5432</span> <span class="c1"># one more</span>
|
||
</span></span><span class="line"><span class="cl">devvm ports rm <span class="m">5173</span> <span class="c1"># one fewer, as listed; the last leaves none</span>
|
||
</span></span><span class="line"><span class="cl">devvm ports none <span class="c1"># nothing; devvm ports all forwards every port again</span>
|
||
</span></span><span class="line"><span class="cl">devvm ports -g none <span class="c1"># what new VMs forward (default: all)</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<ul>
|
||
<li>A change applies at once. A stopped VM forwards the new ports from its next start. On a running VM, devvm starts its forwarder again with the new ports while the VM runs on, so a server on an added port reaches this machine within a few seconds. The connections that were open through the old forwarder close, so a client that was connected through it has to connect again.</li>
|
||
<li><code>add</code> and <code>rm</code> take ports and ranges, not <code>all</code> or <code>none</code>. devvm refuses <code>rm</code> on a VM that forwards every port, because there&rsquo;s no list to remove from. <code>-g</code> also works with <code>add</code> and <code>rm</code>.</li>
|
||
<li><code>devvm ports -g</code> shows what new VMs forward, followed by where it came from after a <code>#</code>, and <code>devvm ports -g --json</code> adds it as <code>source</code>. When <a href="https://next.devvm.dev/docs/using/settings/#configtoml"><code>config.toml</code></a> sets <code>ports</code>, <code>devvm ports -g</code> refuses to change it and names the file, so edit <code>config.toml</code> instead (<a href="https://next.devvm.dev/docs/using/settings/#where-a-default-comes-from">where a default comes from</a>).</li>
|
||
<li>devvm forwards ports on every <a href="https://next.devvm.dev/docs/safety/network/#network-tiers">network tier</a>, and it forwards no ports from builds.</li>
|
||
</ul>
|
||
<p>When a VM forwards every port, devvm forwards each TCP port from 1024 up that a server in the VM listens on, whether on the VM&rsquo;s loopback or on all its addresses. When a VM lists its ports, devvm forwards those ports alone, however many there are, ports below 1024 included. A port reaches this machine within a few seconds of the server starting, only on <code>localhost</code> (<code>127.0.0.1</code> and <code>::1</code>), and the forward goes away when the server stops. At most 256 ports are forwarded at once (<a href="https://next.devvm.dev/docs/internals/ports/#when-it-cant-forward">when it can&rsquo;t forward</a>). Your browser sends the cookies of every app you use on <code>localhost</code> to a forwarded port as well, so the server in the VM gets them (<a href="https://next.devvm.dev/docs/safety/attack-vectors/#the-network">your browser</a>).</p>
|
||
<p>A VM never takes a port that a program on this machine already has, a port that another running VM forwards or lists, or a port that devvm uses for its VMs&rsquo; ssh and proxies (<a href="https://next.devvm.dev/docs/internals/ports/#what-it-never-takes">what it never takes</a>):</p>
|
||
<ul>
|
||
<li>When a port you listed is taken by a program on this machine as the VM starts, or as you change its ports, devvm warns you and the VM runs on without that port. The next start or change that finds the port free forwards it.</li>
|
||
<li>A program that starts on a port after the VM&rsquo;s forward does can still bind it on all addresses, as most servers do, and then that program&rsquo;s <code>localhost</code> connections reach the VM.</li>
|
||
<li>When the VM&rsquo;s server listens on a listed port that the VM can&rsquo;t forward, because a program on this machine has it, the VM already forwards 256 ports, or this machine doesn&rsquo;t let devvm use the port, such as one below 1024 on Linux, <code>devvm ports</code> warns you and says which of these it is (<a href="https://next.devvm.dev/docs/using/troubleshooting/#a-listed-port-isnt-forwarded">a listed port isn&rsquo;t forwarded</a>).</li>
|
||
<li>If the forwarder can&rsquo;t start at all, devvm warns you and names its log, and the VM runs on without forwarded ports.</li>
|
||
<li>The ports devvm uses for its VMs&rsquo; ssh are the 17 that every browser refuses, so no page in your browser reaches a VM&rsquo;s ssh, and at most 17 VMs run at once (<a href="https://next.devvm.dev/docs/using/troubleshooting/#too-many-vms-at-once">too many VMs at once</a>). A VM that forwards every port leaves those 17 out, and forwards one only when you list it, which <code>devvm ports</code> and each launch warn of.</li>
|
||
</ul>
|
||
<p><strong>UDP isn&rsquo;t forwarded, on any backend.</strong> Run the UDP client in the VM instead, or tunnel it over a forwarded TCP port with <a href="http://www.dest-unreach.org/socat/doc/socat.html" target="_blank" rel="noopener">socat</a>, installed on both sides. For a UDP server on port 8125 in the VM, with TCP port 9125 forwarded:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">socat TCP-LISTEN:9125,fork,reuseaddr UDP:127.0.0.1:8125 <span class="c1"># in the VM</span>
|
||
</span></span><span class="line"><span class="cl">socat UDP-LISTEN:8125,fork TCP:127.0.0.1:9125 <span class="c1"># on this machine</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>TCP is a stream, so datagrams can arrive merged or split. This suits low-rate request and response traffic, such as DNS, statsd or syslog, but not high-rate or latency-sensitive traffic, such as games, QUIC or WebRTC media.</p>
|
||
<h3 data-hextra-search-id="two-vms-and-one-port">Two VMs and one port<span class="hx:absolute hx:-mt-20" id="two-vms-and-one-port"></span>
|
||
<a href="#two-vms-and-one-port" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Only a running VM holds a port. A stopped VM&rsquo;s listed ports are what it forwards when it runs again, so another VM can forward them meanwhile:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="nb">cd</span> ~/code/a <span class="o">&amp;&amp;</span> devvm ports add <span class="m">5173</span> <span class="o">&amp;&amp;</span> devvm stop <span class="c1"># a lists 5173, then stops</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> ~/code/b <span class="o">&amp;&amp;</span> devvm <span class="c1"># b forwards 5173 while a is stopped</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> ~/code/a <span class="o">&amp;&amp;</span> devvm <span class="c1"># a starts, and warns that b has 5173</span>
|
||
</span></span><span class="line"><span class="cl">devvm ports <span class="c1"># in a: 5173, and the same warning</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<ul>
|
||
<li>The running VM that forwards a port keeps it. When a VM that lists the same port starts, or you change its ports, devvm warns that it forwards the port once the other VM stops forwarding it, and <code>devvm ports</code> repeats that warning while it lasts. When the other VM stops, or stops forwarding the port, the VM forwards it within about 20 seconds, without a restart.</li>
|
||
<li>A VM that lists a port comes before a VM that forwards every port. A VM that forwards every port takes no port that a running VM lists, and it gives up such a port within about 10 seconds of that VM listing it, even when the VM that forwards every port goes quiet. devvm warns about it as about any other VM.</li>
|
||
<li>While devvm starts a VM again, its listed ports stay its own, so no other VM takes them in between.</li>
|
||
<li>When two VMs that list the same port start at once, the first one whose server listens on the port forwards it, and the other waits for it.</li>
|
||
<li>A VM that crashed holds no port, because its forwarder ends with it.</li>
|
||
<li>The ports devvm chooses for VMs&rsquo; ssh, proxies and desktops never take a port that any VM lists, running or not.</li>
|
||
<li><code>devvm ports</code> also warns when a program on this machine has one of a running VM&rsquo;s listed ports, which the VM then doesn&rsquo;t forward.</li>
|
||
</ul>
|
||
<p><strong>While a VM is stopped, another VM serving on its port gets that port&rsquo;s place in your browser.</strong> Your browser keeps site data, storage and service workers for <code>localhost:5173</code> whichever VM answers there, as it would for two projects that use one port on any machine. A service worker that the other VM&rsquo;s app registered can keep answering for <code>localhost:5173</code> after the first VM takes the port back, so clear that site&rsquo;s data in your browser when you switch.</p>
|
||
<h2 data-hextra-search-id="size">Size<span class="hx:absolute hx:-mt-20" id="size"></span>
|
||
<a href="#size" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>To see or change a VM&rsquo;s size:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm size <span class="c1"># what this folder&#39;s VM has: cpus=4 memory=8GiB disk=100GiB</span>
|
||
</span></span><span class="line"><span class="cl">devvm size --cpus <span class="m">6</span> --memory <span class="m">16</span> <span class="c1"># change it; what isn&#39;t given stays</span>
|
||
</span></span><span class="line"><span class="cl">devvm size --disk <span class="m">200</span> <span class="c1"># a bigger disk; never a smaller one</span>
|
||
</span></span><span class="line"><span class="cl">devvm size -g --memory <span class="m">16</span> <span class="c1"># the size new VMs get (default: the image&#39;s)</span>
|
||
</span></span><span class="line"><span class="cl">devvm size -g <span class="c1"># cpus=, memory= and disk= lines, empty for the image&#39;s, each with its source</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<ul>
|
||
<li>The flags take the same values as for a new VM and have the same limits, so devvm refuses more CPUs than this machine has and more memory than a VM can have (<a href="#size-and-ports">size and ports</a>). <code>devvm size -g</code> checks a default size in the same way when you set it. A VM that already has more memory keeps it and still starts, because devvm checks a size only when you set one.</li>
|
||
<li><code>devvm size -g</code> ends each line with where its value came from, after a <code>#</code>: the path of <a href="https://next.devvm.dev/docs/using/settings/#configtoml"><code>config.toml</code></a>, <code>devvm: settings.json</code> for what <code>devvm size -g</code> or <code>devvm setup</code> saved, or <code>devvm: default</code> for the image&rsquo;s. When <code>config.toml</code> sets <code>cpus</code>, <code>memory</code> or <code>disk</code>, <code>devvm size -g</code> refuses to change that one and names the file, so edit <code>config.toml</code> instead (<a href="https://next.devvm.dev/docs/using/settings/#where-a-default-comes-from">where a default comes from</a>).</li>
|
||
<li>A stopped VM gets its new size when it next starts, such as with <code>devvm</code>, and until then <code>devvm size</code> shows what the VM has now and says what changes. For a running VM, devvm asks in a terminal whether to restart it now, which stops anything running in it, and if you answer yes, devvm restarts it as <code>devvm restart</code> does. Otherwise, and without a terminal or with <code>--no-input</code>, the VM keeps its size until it next starts, for example with <code>devvm restart</code>. When devvm opens the running VM while its new size still waits, it asks once more in a terminal, with no as the default unless an agent&rsquo;s new folders wait too, and a yes restarts the VM with its new size before the shell opens (<a href="https://next.devvm.dev/docs/using/vms/#restarting-and-stopping">restarting</a>).</li>
|
||
<li>Disks grow but never shrink, so devvm refuses a disk smaller than the VM&rsquo;s.</li>
|
||
<li>When a VM&rsquo;s state file holds a size that isn&rsquo;t a number, such as after an edit by hand, devvm refuses to start the VM or show its size and names the value, so set that part again, such as with <code>devvm size --cpus 4</code>.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="choosing-new-vms-size">Choosing new VMs&rsquo; size<span class="hx:absolute hx:-mt-20" id="choosing-new-vms-size"></span>
|
||
<a href="#choosing-new-vms-size" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>devvm asks for the CPUs and memory that new VMs get on your first run, before it asks which features base gets, and again whenever you run <code>devvm setup</code>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm setup <span class="c1"># asks its questions, the size among them</span>
|
||
</span></span><span class="line"><span class="cl">devvm size -g --cpus <span class="m">6</span> --memory <span class="m">16</span> <span class="c1"># only the size, without asking</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Before the two questions, devvm says how many CPUs and how much memory this machine has. Each question shows in brackets the value new VMs get now. That&rsquo;s what <a href="https://next.devvm.dev/docs/using/settings/#configtoml"><code>config.toml</code></a> sets or <code>devvm size -g</code> saved, or else base&rsquo;s own size fitted to this machine: 4 CPUs and 8 GiB, or less on a machine that doesn&rsquo;t have room for them (<a href="#size-and-ports">size and ports</a>). Confirm to keep the value, or enter another one. devvm checks what you type as it checks <code>--cpus</code> and <code>--memory</code>, and when this machine can&rsquo;t give it, devvm says why and asks again.</p>
|
||
<p>devvm doesn&rsquo;t ask for a value that <code>config.toml</code> sets, and says so. It saves only the values you type, where <code>devvm size -g</code> saves them, and keeps a saved disk size as it is. When you keep both values, devvm saves nothing, so new VMs go on getting the image&rsquo;s size. Either way, devvm prints the size new VMs get. A new size changes only the VMs made after it, and nothing is rebuilt, so existing VMs keep their size until you change it with <code>devvm size</code>.</p>
|
||
<p>The first run asks once, because that run also chooses base&rsquo;s features, and devvm asks only before they&rsquo;re chosen. It asks only when all of these hold (<a href="https://next.devvm.dev/docs/using/command-line/#questions-devvm-asks">questions devvm asks</a>):</p>
|
||
<ul>
|
||
<li>devvm runs in a terminal</li>
|
||
<li>no size is set</li>
|
||
<li>you didn&rsquo;t give <code>--cpus</code> or <code>--memory</code></li>
|
||
</ul>
|
||
<p>Without a terminal, or with <code>--no-input</code>, devvm asks nothing, and new VMs get the image&rsquo;s size. <code>devvm setup</code> asks only in a terminal, without <code>--no-input</code>, and only when you give it no flags (<a href="https://next.devvm.dev/docs/using/settings/#devvm-setup">devvm setup</a>). To set the size without asking, use <code>devvm size -g --cpus N --memory GiB</code>, which takes the same values and has the same limits.</p>
|
||
<h3 data-hextra-search-id="disk-use">Disk use<span class="hx:absolute hx:-mt-20" id="disk-use"></span>
|
||
<a href="#disk-use" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>A VM&rsquo;s disk size is how far the disk can grow, not how much space it takes. A project VM starts as a copy of its image&rsquo;s disk that shares the image&rsquo;s blocks, so a new VM takes almost nothing until it writes (<a href="https://next.devvm.dev/docs/internals/lima/#clones-and-overlays">clones and overlays</a>):</p>
|
||
<ul>
|
||
<li><strong>macOS:</strong> the copy is an APFS clone. <code>du</code> counts the shared blocks as the clone&rsquo;s own, so it overcounts.</li>
|
||
<li><strong>Linux:</strong> the copy is a qcow2 overlay of the image&rsquo;s disk, which holds only the VM&rsquo;s changes, about 12 MB for a new VM instead of 2 GB.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="free-space">Free space<span class="hx:absolute hx:-mt-20" id="free-space"></span>
|
||
<a href="#free-space" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Before devvm builds an image or makes a VM, it checks the free space on the disk that will hold it, and it refuses to start the step when there&rsquo;s less free than the step needs:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Step</th>
|
||
<th>macOS</th>
|
||
<th>Linux</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>building <code>base</code></td>
|
||
<td>8 GiB</td>
|
||
<td>8 GiB</td>
|
||
</tr>
|
||
<tr>
|
||
<td>building any other image</td>
|
||
<td>2 GiB</td>
|
||
<td>8 GiB</td>
|
||
</tr>
|
||
<tr>
|
||
<td>building shared tool images</td>
|
||
<td>3 GiB for each build VM, and 0.5 GiB for each tool</td>
|
||
<td>9 GiB for each build VM, and 0.5 GiB for each tool</td>
|
||
</tr>
|
||
<tr>
|
||
<td>making a VM</td>
|
||
<td>2 GiB</td>
|
||
<td>2 GiB</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>devvm rounds each number up to whole GiB, so building one shared tool with Lima on macOS needs 4 GiB, and building all ten in one build VM needs 8 GiB. Each build checks again before it starts, which means:</p>
|
||
<ul>
|
||
<li><strong>The first VM on a Mac</strong> builds base, so it needs 8 GiB free.</li>
|
||
<li><strong>Tool images</strong> that build side by side need room for each build VM, up to four, and devvm runs fewer when this machine&rsquo;s memory, its CPUs or this disk has room for fewer.</li>
|
||
<li><strong>A tools build</strong> also checks the disk of devvm&rsquo;s data folder, where the shared tool images come out.</li>
|
||
</ul>
|
||
<p><a href="https://next.devvm.dev/docs/internals/images/#free-space">Free space</a> explains which disks devvm checks, what each one needs and how the numbers were measured. <code>devvm doctor</code> also warns when the disk that holds images has less free space than building base needs, but the warning doesn&rsquo;t make doctor fail. When devvm refuses, see <a href="https://next.devvm.dev/docs/using/troubleshooting/#not-enough-free-space">Not enough free space</a> for how to make room.</p>
|
||
<h2 data-hextra-search-id="as-json">As JSON<span class="hx:absolute hx:-mt-20" id="as-json"></span>
|
||
<a href="#as-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>devvm size --json</code> and <code>devvm ports --json</code> print what the commands show as one JSON object, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes. With <code>-g</code>, they print the same fields for new VMs. With <code>--json</code> they only show, so devvm refuses <code>--cpus</code>, <code>--memory</code>, <code>--disk</code> or a list of ports with it.</p>
|
||
<p><code>devvm size --json</code> has <code>cpus</code>, <code>memory_gib</code> and <code>disk_gib</code>, and leaves out what isn&rsquo;t set. For <code>-g</code>, that&rsquo;s what new VMs take from the image. When the VM&rsquo;s size changes at its next start, <code>pending</code> has the <code>cpus</code>, <code>memory_gib</code> and <code>disk_gib</code> that change.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;cpus&#34;</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;memory_gib&#34;</span><span class="p">:</span> <span class="mi">8</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;disk_gib&#34;</span><span class="p">:</span> <span class="mi">100</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;pending&#34;</span><span class="p">:</span> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;memory_gib&#34;</span><span class="p">:</span> <span class="mi">16</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>With <code>-g</code>, <code>devvm size --json</code> also has <code>sources</code>, which says where each of <code>cpus</code>, <code>memory</code> and <code>disk</code> came from: <code>config.toml</code>, <code>settings.json</code> for what devvm saved, or <code>built-in</code> for the image&rsquo;s (<a href="https://next.devvm.dev/docs/using/settings/#where-a-default-comes-from">where a default comes from</a>).</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;cpus&#34;</span><span class="p">:</span> <span class="mi">6</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;memory_gib&#34;</span><span class="p">:</span> <span class="mi">16</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;sources&#34;</span><span class="p">:</span> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;cpus&#34;</span><span class="p">:</span> <span class="s2">&#34;settings.json&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;disk&#34;</span><span class="p">:</span> <span class="s2">&#34;built-in&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;memory&#34;</span><span class="p">:</span> <span class="s2">&#34;config.toml&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm ports --json</code> has <code>ports</code>, which is <code>all</code>, <code>none</code> or a list of ports and ranges, written as <code>devvm ports</code> takes it. With <code>-g</code>, it also has <code>source</code>, which is <code>config.toml</code>, <code>settings.json</code> or <code>built-in</code>.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;ports&#34;</span><span class="p">:</span> <span class="s2">&#34;5173,8000-8010&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>When another running VM forwards some of the VM&rsquo;s listed ports, <code>devvm ports --json</code> also has <code>held_by</code>, with each such VM&rsquo;s <code>vm</code>, its name, and <code>ports</code>, the ports it forwards that this VM waits for (<a href="#two-vms-and-one-port">two VMs and one port</a>).</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;ports&#34;</span><span class="p">:</span> <span class="s2">&#34;5173,8000-8010&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;held_by&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;vm&#34;</span><span class="p">:</span> <span class="s2">&#34;devvm-b-0123456789abcd&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;ports&#34;</span><span class="p">:</span> <span class="s2">&#34;5173&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div></description></item><item><title>Managing VMs</title><link>https://next.devvm.dev/docs/using/vms/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/vms/</guid><description>
|
||
<p>This page covers a VM from the time devvm makes it until you delete it: opening, restarting and stopping it, deleting it, listing your VMs, and what devvm does when you run a command in a subfolder or when the project folder is made again, moved, deleted or on a disk that isn&rsquo;t connected. <a href="https://next.devvm.dev/docs/internals/overview/">Overview</a> has each step devvm takes for a new VM and an existing one.</p>
|
||
<h2 data-hextra-search-id="opening-a-vm">Opening a VM<span class="hx:absolute hx:-mt-20" id="opening-a-vm"></span>
|
||
<a href="#opening-a-vm" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm makes a new VM from its image of base and the layers you chose, building the image first if it isn&rsquo;t built yet, then starts the VM and opens a shell in it in devvm&rsquo;s place, so devvm ends when the shell does. The VM mounts only the project folder, read-write, and the shared tools and its <a href="https://next.devvm.dev/docs/using/coding-agents/">agents&rsquo; config folders</a>, read-only, or with <code>--clone</code> it gets its own clone of the repo instead of the folder. devvm also locks the <code>.git</code> hooks and config of the folder and of the repos nested in it against changes from the VM. On macOS it locks them with a file flag, and on Linux it makes them read-only in the VM where the kernel lets it and only watches them where it doesn&rsquo;t (<a href="https://next.devvm.dev/docs/safety/git-protection/">.git protection</a>). For a VM that exists, devvm starts it if it&rsquo;s stopped and opens it as it is.</p>
|
||
<p>A VM is running or stopped from the time devvm makes it until you delete it.</p>
|
||
<div class="devvm-diagram" style="contain-intrinsic-block-size: auto 511px; --devvm-diagram-width: 695px"><svg xmlns="http://www.w3.org/2000/svg" class="pele pele-flowchart" viewBox="0 0 695 511" width="695" height="511" style="--_bg:var(--pele-bg,#fff);--_fg:var(--pele-fg,#1f1f1f);--_m:var(--pele-muted,#6e6e6e);--_l:var(--pele-line,#1f1f1f);--_s:var(--pele-surface,#f3f3f3);--_a:var(--pele-surface-alt,#e6e6e6);--_b:var(--pele-border,#8a8a8a);--_c:var(--pele-accent,#5b7bd5);color:var(--_fg);--_fm:var(--pele-font-mono,&quot;Departure Mono&quot;, monospace);font:14px sans-serif;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;font-family:var(--pele-font,&quot;Departure Mono&quot;, monospace)" fill="var(--_fg)" role="graphics-document document" aria-roledescription="flowchart" aria-labelledby="d5580c2579ef0a142--title" aria-describedby="d5580c2579ef0a142--desc"><title id="d5580c2579ef0a142--title">A VM's states</title><desc id="d5580c2579ef0a142--desc">devvm makes a VM, which is then running. devvm restart and devvm update keep it running, devvm stop stops it, and devvm, devvm restart or devvm update start it again. devvm rm deletes it, running or stopped. When its image changes, a VM is outdated, and it keeps its image until devvm update.</desc><g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round"><g class="pele-edge" data-id="L_none_running_0"><path d="M263.88,53L263.88,113"/><path class="pele-marker" d="M263.88,120L260.52,112L267.24,112Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_running_running_0"><path d="M320.32,134.5C346.32,126.5 346.32,158.5 327.01,152.56"/><path class="pele-marker" d="M320.32,150.5L328.95,149.64L326.97,156.06Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_running_stopped_0"><path d="M245.93,165L245.93,172.88Q245.93,183 235.81,183L70.55,183Q58.55,183 58.55,195L58.55,269Q58.55,281 70.55,281L129.36,281Q141.36,281 141.36,293L141.36,308.5"/><path class="pele-marker" d="M141.36,315.5L138,307.5L144.72,307.5Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_stopped_running_0"><path d="M157.36,315.5L157.36,293Q157.36,281 169.36,281L181.45,281Q193.45,281 193.45,269L193.45,205Q193.45,193 205.45,193L249.93,193Q261.93,193 261.93,181L261.93,172"/><path class="pele-marker" d="M261.93,165L265.29,173L258.57,173Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_running_deleted_0"><path d="M277.93,165L277.93,427.5Q277.93,439.5 265.93,439.5L248,439.5Q239.75,439.5 239.75,447.75L239.75,450.5"/><path class="pele-marker" d="M239.75,457.5L236.39,449.5L243.11,449.5Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_stopped_deleted_0"><path d="M149.36,360.5L149.36,427.5Q149.36,439.5 161.36,439.5L215.5,439.5Q223.75,439.5 223.75,447.75L223.75,450.5"/><path class="pele-marker" d="M223.75,457.5L220.39,449.5L227.11,449.5Z" fill="var(--_l)" stroke="none"/></g></g><g class="pele-edge-labels" font-size="14"><g class="pele-edge-label" data-id="L_none_running_0"><rect x="237.61" y="77.5" width="52.55" height="18" rx="3" fill="var(--_bg)"/><text x="263.88" y="90.7" text-anchor="middle">devvm</text>
|
||
</g><g class="pele-edge-label" data-id="L_running_running_0"><rect x="352.32" y="126.5" width="132.73" height="32" rx="3" fill="var(--_bg)"/><text text-anchor="middle" xml:space="preserve"><tspan x="418.68" y="138.7">devvm restart,</tspan><tspan x="418.68" y="154.7">devvm update</tspan></text>
|
||
</g><g class="pele-edge-label" data-id="L_running_stopped_0"><rect x="10" y="228" width="97.09" height="18" rx="3" fill="var(--_bg)"/><text x="58.55" y="241.2" text-anchor="middle">devvm stop</text>
|
||
</g><g class="pele-edge-label" data-id="L_stopped_running_0"><rect x="127.09" y="213" width="132.73" height="48" rx="3" fill="var(--_bg)"/><text text-anchor="middle" xml:space="preserve"><tspan x="193.45" y="225.2">devvm,</tspan><tspan x="193.45" y="241.2">devvm restart,</tspan><tspan x="193.45" y="257.2">devvm update</tspan></text>
|
||
</g><g class="pele-edge-label" data-id="L_running_deleted_0"><rect x="238.3" y="329" width="79.27" height="18" rx="3" fill="var(--_bg)"/><text x="277.93" y="342.2" text-anchor="middle">devvm rm</text>
|
||
</g><g class="pele-edge-label" data-id="L_stopped_deleted_0"><rect x="109.73" y="401.5" width="79.27" height="18" rx="3" fill="var(--_bg)"/><text x="149.36" y="414.7" text-anchor="middle">devvm rm</text>
|
||
</g></g><g class="pele-nodes"><g class="pele-node pele-shape-stadium" data-id="none" transform="translate(263.88,30.5)"><rect x="-47.52" y="-22.5" width="95.05" height="45" rx="22.5" fill="var(--_s)" stroke="var(--_b)"/><text class="pele-label" x="0" y="4.9" text-anchor="middle">no VM</text>
|
||
</g><g class="pele-node pele-shape-stadium" data-id="running" transform="translate(263.88,142.5)"><rect x="-56.43" y="-22.5" width="112.86" height="45" rx="22.5" fill="var(--_s)" stroke="var(--_b)"/><text class="pele-label" x="0" y="4.9" text-anchor="middle">running</text>
|
||
</g><g class="pele-node pele-shape-stadium" data-id="stopped" transform="translate(149.36,338)"><rect x="-56.43" y="-22.5" width="112.86" height="45" rx="22.5" fill="var(--_s)" stroke="var(--_b)"/><text class="pele-label" x="0" y="4.9" text-anchor="middle">stopped</text>
|
||
</g><g class="pele-node pele-shape-stadium" data-id="deleted" transform="translate(231.75,480)"><rect x="-56.43" y="-22.5" width="112.86" height="45" rx="22.5" fill="var(--_s)" stroke="var(--_b)"/><text class="pele-label" x="0" y="4.9" text-anchor="middle">deleted</text>
|
||
</g><g class="pele-node pele-shape-braces" data-id="outdated" transform="translate(527.24,338)"><rect x="-159.18" y="-39" width="318.36" height="78" fill="none" stroke="none"/><path d="M-147.18,-39q-6,0 -6,6V-6q0,6 -6,6q6,0 6,6V33q0,6 6,6" fill="none" stroke="var(--_b)"/><path d="M147.18,-39q6,0 6,6V-6q0,6 6,6q-6,0 -6,6V33q0,6 -6,6" fill="none" stroke="var(--_b)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-13.1">When its image changes, a VM</tspan><tspan x="0" y="4.9">is outdated, and it keeps</tspan><tspan x="0" y="22.9">its image until devvm update.</tspan></text>
|
||
</g></g></svg></div><p>The shell, and an agent&rsquo;s login with <code>devvm agent login</code>, get your terminal&rsquo;s <code>COLORTERM</code> when it&rsquo;s <code>truecolor</code> or <code>24bit</code>, so programs in the VM, such as coding agents, show 24-bit color as they do on this machine (<a href="https://next.devvm.dev/docs/internals/lima/#a-shells-colors">how</a>).</p>
|
||
<h2 data-hextra-search-id="restarting-and-stopping">Restarting and stopping<span class="hx:absolute hx:-mt-20" id="restarting-and-stopping"></span>
|
||
<a href="#restarting-and-stopping" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm restart <span class="c1"># stop this folder&#39;s VM, start it again and open a shell in it</span>
|
||
</span></span><span class="line"><span class="cl">devvm stop <span class="c1"># stop it and its proxy</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm restart</code> stops this folder&rsquo;s VM, then starts it and opens a shell in it as devvm does. Some changes apply only when a VM starts, and a restart applies them:</p>
|
||
<ul>
|
||
<li>a new size for a running VM</li>
|
||
<li>a change into or out of the open tier</li>
|
||
<li>a change to its SSH agent forwarding</li>
|
||
<li>the config folders of an agent that <code>devvm tools add</code> added</li>
|
||
</ul>
|
||
<p>When you make one of these changes to a running VM with <code>devvm size</code>, <code>devvm network</code> into or out of open or <code>devvm ssh-agent</code>, or change its <code>.git</code> protection on macOS with <code>devvm git-protect</code>, which waits for the VM to stop, devvm asks in a terminal whether to restart the VM now, because anything running in it stops. If you answer yes, devvm restarts it as <code>devvm restart</code> does and opens a shell in it. If you answer no, devvm keeps the change and says that <code>devvm restart</code> applies it, and it does the same without asking when there&rsquo;s no terminal or you pass <code>--no-input</code>.</p>
|
||
<p>When devvm opens a running VM that still has changes waiting for its next start, it names them, such as its size and its agent folder mounts, and asks in a terminal once whether to restart the VM now. It names each change on a line of its own, and when more than two wait, it names the first and says how many more there are. The default answer depends on what waits:</p>
|
||
<ul>
|
||
<li><strong>Yes (<code>[Y/n]</code>)</strong> when the VM&rsquo;s agent folder mounts are among the changes, because an agent you just added needs its folders.</li>
|
||
<li><strong>No (<code>[y/N]</code>)</strong> otherwise, because the VM is already running and you may only want its shell.</li>
|
||
</ul>
|
||
<p>If you answer yes, devvm stops the VM, starts it with the changes and opens a shell in it. If you answer no, or there&rsquo;s no terminal, or you pass <code>--no-input</code>, devvm warns about each change and opens a shell in the running VM.</p>
|
||
<p><code>devvm stop</code> stops this folder&rsquo;s VM and its proxy (<a href="https://next.devvm.dev/docs/internals/overview/#stopping-a-vm">stopping a VM</a>). Once the VM is stopped, devvm locks its <code>.git</code> again and checks it, as a launch that finds the VM stopped does, and it takes the VM&rsquo;s entry out of devvm&rsquo;s <a href="https://next.devvm.dev/docs/using/ssh/#ssh-access-by-name">ssh config</a>. devvm, <code>devvm restart</code>, and the commands that need the VM running, such as <code>devvm host</code>, start it again.</p>
|
||
<h2 data-hextra-search-id="deleting-a-vm">Deleting a VM<span class="hx:absolute hx:-mt-20" id="deleting-a-vm"></span>
|
||
<a href="#deleting-a-vm" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm rm <span class="c1"># delete this folder&#39;s VM, after asking</span>
|
||
</span></span><span class="line"><span class="cl">devvm rm --force <span class="c1"># the same without asking, as a script must</span>
|
||
</span></span><span class="line"><span class="cl">devvm rm --no-export <span class="c1"># without exporting its agents&#39; history first</span>
|
||
</span></span><span class="line"><span class="cl">devvm rm devvm-web-71a99b1076d92c <span class="c1"># a VM whose folder is gone, by its name from devvm ls</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm rm</code> deletes this folder&rsquo;s VM together with what devvm keeps for it. That&rsquo;s the VM&rsquo;s state, its own allowlist, its network log, its <code>.git</code> locks or, for a <code>--clone</code> VM, the repo&rsquo;s <code>devvm</code> remote, and its ssh config entry (<a href="https://next.devvm.dev/docs/internals/overview/#deleting-a-vm">deleting a VM</a>). It asks first in a terminal, and <code>--force</code> deletes without asking, which <code>devvm rm</code> needs when there&rsquo;s no terminal.</p>
|
||
<p>When the VM has an agent, devvm first exports the agents&rsquo; history, unless you give <code>--no-export</code>, and when the export fails, devvm keeps the VM (<a href="https://next.devvm.dev/docs/using/coding-agents/#history">history</a>). For a <code>--clone</code> VM, devvm offers to fetch the branches this repo hasn&rsquo;t fetched, and it deletes the VM&rsquo;s uncommitted changes only after you confirm. <code>--no-clone-check</code> skips that check and warns you that the clone&rsquo;s unfetched commits and uncommitted changes go with the VM (<a href="https://next.devvm.dev/docs/using/clone/#deleting-the-vm">deleting the VM</a>). When the VM has opencode, devvm also checks the worktrees opencode made in it, which an export leaves out, and asks before their uncommitted changes go. It starts a stopped VM for that check, even with <code>--no-export</code>, and <code>--no-worktree-check</code> skips the check, so with <code>--no-export</code> as well, devvm deletes a stopped VM without starting it (<a href="https://next.devvm.dev/docs/using/coding-agents/#opencodes-worktrees">opencode&rsquo;s worktrees</a>).</p>
|
||
<p>Some VMs devvm deletes only after you confirm, and it asks these questions only in a terminal, where <code>--force</code> never answers them:</p>
|
||
<ul>
|
||
<li>the VM made for an earlier folder at this path (<a href="#a-folder-made-again">a folder made again</a>)</li>
|
||
<li>in a folder without a VM of its own, the VM of the nearest folder with one that this folder is inside, which <code>devvm rm</code> acts on and names (<a href="#a-subfolder">a subfolder</a>)</li>
|
||
</ul>
|
||
<p>To delete a VM whose folder you deleted or moved, give its name, as in <code>devvm rm devvm-web-71a99b1076d92c</code> (<a href="#a-vm-whose-folder-is-gone">a VM whose folder is gone</a>).</p>
|
||
<h2 data-hextra-search-id="listing-vms">Listing VMs<span class="hx:absolute hx:-mt-20" id="listing-vms"></span>
|
||
<a href="#listing-vms" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>devvm ls</code> prints a table of the project VMs, sorted by name, with a header first. Images and build VMs aren&rsquo;t in it.</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Column</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>NAME</code></td>
|
||
<td>the VM&rsquo;s name, <code>devvm-&lt;folder&gt;-&lt;hash&gt;</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>STATUS</code></td>
|
||
<td>its state as its backend reports it, such as <code>Running</code> or <code>Stopped</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>IMAGE</code></td>
|
||
<td>its image, base and its layers, with a base from a container image as <code>base (from node:24)</code> (<a href="https://next.devvm.dev/docs/using/from/">details</a>)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>TOOLS</code></td>
|
||
<td>its shared tools, joined with commas, such as <code>node,claude</code>, or <code>-</code> for none</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>GIT</code></td>
|
||
<td>its <a href="https://next.devvm.dev/docs/safety/git-protection/"><code>.git</code> protection</a>, <code>on</code> or <code>off</code>, or <code>clone</code> for a <a href="https://next.devvm.dev/docs/using/clone/"><code>--clone</code></a> VM</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>NET</code></td>
|
||
<td>its <a href="https://next.devvm.dev/docs/safety/network/#network-tiers">network tier</a>, <code>open</code>, <code>internet</code>, <code>allowlist</code> or <code>none</code>, or <code>unenforced</code> (<a href="https://next.devvm.dev/docs/internals/network/#the-self-check">the self-check</a>), and <code>internet (learning)</code> while it <a href="https://next.devvm.dev/docs/safety/network/#learning-the-hosts-a-vm-needs">learns the hosts it needs</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>LINKS</code></td>
|
||
<td>how many <a href="https://next.devvm.dev/docs/using/links/">links</a> it has to ports of your other VMs, or <code>-</code> for none</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>FOLDER</code></td>
|
||
<td>its project folder, with <code>(gone)</code> after it when nothing is at that path, which <code>devvm rm VM</code> deals with (<a href="#a-vm-whose-folder-is-gone">a VM whose folder is gone</a>), or <code>(not connected)</code> when the folder was on a disk that isn&rsquo;t connected (<a href="#a-folder-on-a-disk-that-isnt-connected">details</a>)</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>A value the VM&rsquo;s state doesn&rsquo;t have shows as <code>-</code>, so a VM whose creation didn&rsquo;t finish shows only its name and status.</p>
|
||
<h3 data-hextra-search-id="devvm-ls-json">devvm ls &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-ls-json"></span>
|
||
<a href="#devvm-ls-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm ls --json</code> prints the same list as one JSON object, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes. <code>vms</code> has a VM&rsquo;s columns as fields, sorted by name. <code>image</code> is the image alone, <code>tools</code> is the list of its shared tools, <code>[]</code> for none, and <code>from</code> is the container image its base started from, which is left out for a base from Ubuntu&rsquo;s cloud image. A value the VM&rsquo;s state doesn&rsquo;t have is <code>&quot;&quot;</code>. <code>folder</code> is the folder alone, and <code>folder_state</code> is <code>there</code> when something is at its path, <code>gone</code> when nothing is, and <code>not_connected</code> when the folder was on a disk that isn&rsquo;t connected. <code>links</code> is how many links the VM has, <code>0</code> for none. <code>net</code> is the tier alone, and a VM that&rsquo;s learning the hosts it needs also has <code>learning_since</code>, the time it started learning.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;vms&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;devvm-website-71a99b1076d92c&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;status&#34;</span><span class="p">:</span> <span class="s2">&#34;Running&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;image&#34;</span><span class="p">:</span> <span class="s2">&#34;base&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;tools&#34;</span><span class="p">:</span> <span class="p">[</span><span class="s2">&#34;node&#34;</span><span class="p">,</span> <span class="s2">&#34;claude&#34;</span><span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;from&#34;</span><span class="p">:</span> <span class="s2">&#34;node:24&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;git&#34;</span><span class="p">:</span> <span class="s2">&#34;on&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;net&#34;</span><span class="p">:</span> <span class="s2">&#34;internet&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;learning_since&#34;</span><span class="p">:</span> <span class="s2">&#34;2026-11-07T10:00:00Z&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;backend&#34;</span><span class="p">:</span> <span class="s2">&#34;lima&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;folder&#34;</span><span class="p">:</span> <span class="s2">&#34;/Users/you/code/website&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;folder_state&#34;</span><span class="p">:</span> <span class="s2">&#34;there&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;links&#34;</span><span class="p">:</span> <span class="mi">0</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="a-subfolder">A subfolder<span class="hx:absolute hx:-mt-20" id="a-subfolder"></span>
|
||
<a href="#a-subfolder" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="nb">cd</span> ~/some-project/src
|
||
</span></span><span class="line"><span class="cl">devvm <span class="c1"># open the parent folder&#39;s VM, with the shell here</span>
|
||
</span></span><span class="line"><span class="cl">devvm --here <span class="c1"># make a VM for this subfolder instead</span>
|
||
</span></span><span class="line"><span class="cl">devvm --parent <span class="c1"># use the parent folder&#39;s VM even in a repo of its own</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>A VM mounts its whole project folder, so the folders inside it are in the VM at the same paths. When the folder you run a command in has no VM of its own, devvm looks for one in the folders it&rsquo;s inside, starting with the nearest. It stops before your home folder and the filesystem root, so it never uses a VM made for either. It stops at the nearest folder that has a VM, and when that VM was made for an earlier folder at its path (<a href="#a-folder-made-again">a folder made again</a>), or its backend has lost it, the folder you&rsquo;re in has no VM, so devvm never reaches past it to a VM further out. Using a parent folder&rsquo;s VM mounts nothing new, because the subfolder is already inside the folder that VM mounts.</p>
|
||
<p>In such a subfolder, such as <code>~/some-project/src</code>, each command does this:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Command</th>
|
||
<th>In a subfolder</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>devvm</code></td>
|
||
<td>opens the parent folder&rsquo;s VM there, with the shell at the subfolder&rsquo;s path, and first prints a line that names the VM and the folder it was made for. It does the same with or without a terminal, and it asks nothing. <code>--tools</code>, <code>--agents</code> and <code>--layers</code> change nothing on the parent folder&rsquo;s VM, as on any VM that exists, and devvm warns that they don&rsquo;t (<a href="https://next.devvm.dev/docs/using/toolchains/#adding-and-removing-tools">adding and removing tools</a>). In a parent folder&rsquo;s <code>--clone</code> VM, the shell opens in the subfolder when the clone has it (<a href="https://next.devvm.dev/docs/using/clone/#subfolders">subfolders</a>)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm --here</code>, <code>devvm --clone</code></td>
|
||
<td>make a new VM for the subfolder instead, and <code>devvm --clone</code> makes the subfolder&rsquo;s own clone VM. Once the subfolder has its own VM, devvm opens that one</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm stop</code>, <code>restart</code>, <code>tools</code>, <code>size</code>, <code>ports</code>, <code>host</code> and <code>code</code></td>
|
||
<td>use the parent folder&rsquo;s VM in the same way, without asking. Each one first prints a line that names the VM and the folder it was made for. <code>devvm host</code> gives the subfolder as the folder to open in the VM, and <code>devvm code</code> opens the subfolder</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm rm</code></td>
|
||
<td>never deletes a parent folder&rsquo;s VM unasked. In a terminal, it names the VM and its folder and asks before deleting it, with no as the default, and <code>--force</code> never answers that question. Without a terminal, it refuses and tells you to run <code>devvm rm</code> in the parent folder instead</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm adopt</code></td>
|
||
<td>acts only on the VM made for this folder&rsquo;s own path, never on a parent folder&rsquo;s</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>The commands that give the VM more access ask in the same way as <code>devvm rm</code>, because the parent folder&rsquo;s project may not expect them:</p>
|
||
<ul>
|
||
<li><code>devvm secret use</code></li>
|
||
<li><code>devvm ssh-agent on</code> and <code>devvm ssh-agent devvm</code></li>
|
||
<li><code>devvm network</code> with a lower tier, such as <code>devvm network open</code></li>
|
||
<li><code>devvm network allow</code>, and <code>devvm network rm</code> when it removes a deny</li>
|
||
<li><code>devvm git-protect off</code></li>
|
||
</ul>
|
||
<p>In a terminal, each one names the VM and its folder and asks before it changes the VM, with no as the default. Without a terminal, it refuses and tells you to run it in the parent folder, or in a terminal to confirm. The commands that take access away, such as <code>devvm secret unuse</code> and <code>devvm network deny</code>, ask nothing.</p>
|
||
<p>A subfolder that is a git repo of its own is treated as a separate project, and so is a subfolder inside such a repo, when the repo is below the folder with the VM. That covers a nested repo, a submodule and a worktree, which each have a <code>.git</code> folder or file of their own. When you run <code>devvm</code> there, devvm makes a new VM for the subfolder, with or without a terminal, and asks nothing. The other commands don&rsquo;t use the parent folder&rsquo;s VM there, and they say this folder has no VM, as in any folder without one.</p>
|
||
<p>Every command that acts on this folder&rsquo;s VM, <code>devvm</code> included, takes <code>--here</code> and <code>--parent</code>, and each finds the VM in the same way:</p>
|
||
<ul>
|
||
<li><code>--here</code> uses only this folder&rsquo;s own VM, so <code>devvm --here</code> makes one when the folder has none, and the other commands say this folder has no VM.</li>
|
||
<li><code>--parent</code> uses the VM of the nearest folder with one that this folder is inside, even across a git repo of its own and even when this folder has a VM of its own, so <code>devvm --parent</code> in a repo of its own opens the project&rsquo;s VM there. When no folder that this folder is inside has a VM, a command given <code>--parent</code> fails and changes nothing.</li>
|
||
</ul>
|
||
<p>You can&rsquo;t give the two together, or either of them with <code>-g</code>, and <code>devvm --clone</code> doesn&rsquo;t take <code>--parent</code>, because a clone VM is always the folder&rsquo;s own. <code>devvm rm VM</code> takes neither, because it deletes the VM you name, and neither does <code>devvm adopt</code>, because it acts only on this folder&rsquo;s own path. With <code>--parent</code>, <code>devvm rm</code> and the commands that give the VM more access still ask before they change the parent folder&rsquo;s VM.</p>
|
||
<h2 data-hextra-search-id="a-nested-project-replaced">A nested project replaced<span class="hx:absolute hx:-mt-20" id="a-nested-project-replaced"></span>
|
||
<a href="#a-nested-project-replaced" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A project with a VM of its own inside a folder with another VM, such as a nested repo, is in both VMs, because the parent folder&rsquo;s VM mounts everything inside its folder. Code in the parent folder&rsquo;s VM can do two things to it:</p>
|
||
<ul>
|
||
<li>It can change the nested project&rsquo;s files, though not the hooks and config of its <code>.git</code> while the parent folder&rsquo;s VM protects it, as <a href="https://next.devvm.dev/docs/safety/git-protection/#nested-repos"><code>.git</code> protection</a> does for the repos nested in a VM&rsquo;s folder.</li>
|
||
<li>It can move the nested project folder aside and put a link in its place, or another folder. On Linux, if devvm then started the nested project&rsquo;s VM, the VM would mount whatever the link points to, such as your home folder. On macOS the VM mounts the project folder itself, wherever it was moved, and never what a link at its path points to.</li>
|
||
</ul>
|
||
<p>On both, devvm checks the nested project folder just before it starts the VM and again once the VM runs. If the folder is now a link, sits below a link, or is another folder, devvm doesn&rsquo;t start the VM, or it stops the VM again, and it tells you which. Then:</p>
|
||
<ol>
|
||
<li>Find what replaced the folder.</li>
|
||
<li>Move the project folder back to its path.</li>
|
||
<li>Run the command again.</li>
|
||
</ol>
|
||
<p>Replacing the folder while the VM runs never shows the VM what the link points to. On Linux the VM keeps the folder it mounted when it started, and on macOS the VM gets &ldquo;Operation not permitted&rdquo; for its project folder, as it does when the folder was moved aside while the VM started and put back later, so run <code>devvm restart</code> once the folder is back. To keep a nested project out of the parent folder&rsquo;s VM altogether, move it out of the parent folder.</p>
|
||
<p>Each time <code>devvm</code> makes or opens the nested project&rsquo;s VM, it warns once and names the VM of the nearest parent folder that mounts the project. It warns whether that VM runs or not, because the VM can write to the folder whenever it runs. A <code>--clone</code> VM mounts nothing, so devvm doesn&rsquo;t warn when you open one, and a parent folder&rsquo;s <code>--clone</code> VM never counts. The other commands, <code>devvm restart</code> included, don&rsquo;t warn.</p>
|
||
<h2 data-hextra-search-id="a-folder-made-again">A folder made again<span class="hx:absolute hx:-mt-20" id="a-folder-made-again"></span>
|
||
<a href="#a-folder-made-again" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A VM belongs to the folder it was made for, which devvm knows by its path and by the folder itself (<a href="https://next.devvm.dev/docs/internals/security/#one-vm-per-folder">one VM per folder</a>). When that folder was deleted and a new one made at the same path, every command that opens, stops or changes the VM refuses it, such as <code>devvm</code>, <code>devvm stop</code>, <code>devvm restart</code> and <code>devvm tools</code>. Two commands deal with a folder made again, and each acts only after you confirm in a terminal:</p>
|
||
<ul>
|
||
<li><code>devvm rm</code> deletes the VM and never exports its history, because its folder is gone. The VM may hold that project&rsquo;s work, so <code>--force</code> never answers this question.</li>
|
||
<li><code>devvm adopt</code> gives the VM to this folder, with its files, secrets and allowlist. Its <code>.git</code> protection starts again, as if <code>.git</code> had just appeared. <code>devvm adopt --force</code> gives it without asking, which <code>devvm adopt</code> needs when there&rsquo;s no terminal.</li>
|
||
</ul>
|
||
<p>What devvm does in the cases between:</p>
|
||
<ul>
|
||
<li><strong>A restart of your Mac</strong> can give the folder&rsquo;s disk another device number, but that doesn&rsquo;t make it a new folder, so the VM opens as before. The exception is a VM that has recorded its folder&rsquo;s volume, when the folder is on another volume now, such as a copy of the disk with a volume ID of its own, mounted at the same path.</li>
|
||
<li><strong>A folder devvm can&rsquo;t read at all,</strong> as when code in a VM that mounts it took away your read permission, leaves devvm unable to tell whether the folder is the VM&rsquo;s, so every command on the folder&rsquo;s VM refuses it, naming the folder and why it can&rsquo;t be read. Make the folder readable to you again, with <code>chmod u+rx</code> on it, and the VM opens as before.</li>
|
||
<li><strong>A Btrfs snapshot on Linux</strong> that you roll back to at the folder&rsquo;s path is another subvolume, once the VM has recorded its folder&rsquo;s volume, so its folder is another folder, as is the folder after you give its volume a new UUID. You give it the VM with <code>devvm adopt</code>.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="a-moved-or-renamed-folder">A moved or renamed folder<span class="hx:absolute hx:-mt-20" id="a-moved-or-renamed-folder"></span>
|
||
<a href="#a-moved-or-renamed-folder" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">mv ~/code/app ~/work/app
|
||
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> ~/work/app <span class="o">&amp;&amp;</span> devvm <span class="c1"># devvm asks whether to move the VM here</span>
|
||
</span></span><span class="line"><span class="cl">devvm adopt --force <span class="c1"># the same without asking, as a script must</span>
|
||
</span></span><span class="line"><span class="cl">devvm adopt VM <span class="c1"># give a copy on another disk the VM, by its name from devvm ls</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>When you move or rename a project folder on the same disk, as with <code>mv ~/code/app ~/work/app</code>, the folder keeps its VM once you say so. The first time you run a command on this folder&rsquo;s VM at the folder&rsquo;s new path, such as <code>devvm</code> or <code>devvm stop</code>, devvm finds the VM made for the folder at its old path, names the VM and that path, and asks whether to move the VM here, with no as the default:</p>
|
||
<ul>
|
||
<li><strong>Yes:</strong> the VM belongs to the folder at its new path, with its home folder, secrets, allowlist, links and settings, and devvm finds it there from then on without asking.</li>
|
||
<li><strong>No:</strong> the folder has no VM, so <code>devvm</code> makes a new one, and the old VM stays with the old path, where <code>devvm rm VM</code> deletes it (<a href="#a-vm-whose-folder-is-gone">a VM whose folder is gone</a>).</li>
|
||
<li><strong>Without a terminal,</strong> devvm refuses and tells you to run <code>devvm adopt</code> in a terminal, or <code>devvm adopt --force</code>, which moves the VM without asking.</li>
|
||
</ul>
|
||
<p>Once the VM has moved, this is what changes:</p>
|
||
<ul>
|
||
<li>The VM mounts the folder at its new path from its next start. When the VM is running as you move it, it still mounts the old path, so devvm stops it before it moves it, and <code>devvm</code> then starts it with the folder at its new path. If a VM runs with its folder at another path all the same, devvm asks whether to restart it as it opens the VM, with yes as the default, and when you answer no, it warns that the VM mounts the folder at its new path only when it next starts.</li>
|
||
<li>The folder&rsquo;s <code>.git</code> moves with it, locks and all, so its <a href="https://next.devvm.dev/docs/safety/git-protection/">.git protection</a> goes on as before.</li>
|
||
<li>Links to the VM and its group go by the VM&rsquo;s name, so they stay, and a link whose TARGET is the folder&rsquo;s path finds the VM at its new path.</li>
|
||
<li>The folder&rsquo;s path in the VM changes with it.</li>
|
||
</ul>
|
||
<p>Claude Code&rsquo;s history follows the folder. Claude Code keeps a folder&rsquo;s sessions and its settings for that folder, such as whether you trust it and the MCP servers you added there, by the folder&rsquo;s path. At the VM&rsquo;s next start, devvm moves them in the VM from the old path to the new one, so <code>claude --continue</code> and <code>claude --resume</code> offer the sessions from before the move. When Claude Code already has sessions at the new path, the old path&rsquo;s sessions join them, and a session the new path already has stays as it is. Settings that Claude Code already keeps for the new path stay as they are, and the old path&rsquo;s stay under the old path. devvm moves only what Claude Code keeps for the project folder itself, so sessions you started in one of its subfolders stay under that subfolder&rsquo;s old path.</p>
|
||
<p>Codex records each session&rsquo;s folder in the session, and <code>codex resume</code> and <code>codex resume --last</code> look only at the current folder&rsquo;s sessions, so they miss the ones from the old path. To find them:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">codex resume --all <span class="c1"># list the sessions of every folder, the old path&#39;s included</span>
|
||
</span></span><span class="line"><span class="cl">codex resume ID <span class="c1"># resume a session by its ID, wherever it started</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>opencode keeps the sessions of a git repo by the repo&rsquo;s first commit, so they follow the folder without any change. In a folder that isn&rsquo;t a git repo, opencode keeps sessions by the folder&rsquo;s path, so they stay under the old path.</p>
|
||
<p>devvm offers the move only when the folder at the new path is the folder the VM was made for, and when nothing is at the old path any more, or only a symlink to the new path. devvm knows the folder by its device, inode and birth time, or by its volume, inode and birth time after a restart gave its disk another device number (<a href="https://next.devvm.dev/docs/internals/security/#one-vm-per-folder">one VM per folder</a>). There&rsquo;s no offer in these cases:</p>
|
||
<ul>
|
||
<li><strong>A copy:</strong> a copy of the folder is another folder.</li>
|
||
<li><strong>Some file systems:</strong> a folder on a file system that may give a new folder the inode number of a deleted one, such as a network share, a FUSE file system or a USB drive formatted with FAT or exFAT, never gets the offer. <a href="https://next.devvm.dev/docs/internals/security/#one-vm-per-folder">One VM per folder</a> lists the file systems that do.</li>
|
||
<li><strong>Another user&rsquo;s folder:</strong> devvm offers no VM for a folder that another user owns. On a Mac, a volume that ignores ownership, as disk images and external disks often do, shows every folder as yours, so devvm can&rsquo;t tell another user&rsquo;s folder there from yours. Check that a folder on such a volume is yours before you say yes.</li>
|
||
<li><strong>Moved after a restart, before its volume was recorded:</strong> a VM records its folder&rsquo;s volume when it&rsquo;s made, adopted or moved, and a VM made before records it at its first launch that finds its folder. Until then, a folder moved after a restart gets no offer, because the restart may have given its disk another device number. The same goes for a folder whose volume is still to check after a restart when devvm also can&rsquo;t read the volume at the move, and for a folder on a file system whose volume devvm can&rsquo;t tell, such as XFS or tmpfs on Linux. <code>devvm adopt VM</code> moves the VM to it.</li>
|
||
<li><strong>A <code>--clone</code> VM,</strong> which keeps its own clone of the repo at the old path inside the VM.</li>
|
||
<li><strong>Several VMs:</strong> when more than one VM was made for the folder at paths it had before, devvm moves none of them and names them, so you can choose one with <code>devvm adopt VM</code>.</li>
|
||
</ul>
|
||
<p>devvm refuses to move a VM to a folder that it wouldn&rsquo;t make a new VM for, such as your home folder (<a href="https://next.devvm.dev/docs/using/settings/#project-folders-devvm-refuses">project folders devvm refuses</a>). A new folder at the old path gets a new VM of its own, with another name.</p>
|
||
<p>Moving a folder to another disk copies it, so the folder at the new path is another folder, which devvm never offers the VM to on its own. To give the copy the VM, delete the folder at the old path or disconnect its disk, then run <code>devvm adopt VM</code> in the copy, with the VM&rsquo;s name as <code>devvm ls</code> lists it. devvm names the VM and its old path and asks first, with no as the default, and <code>--force</code> moves it without asking, which <code>devvm adopt VM</code> needs when there&rsquo;s no terminal. The VM&rsquo;s <code>.git</code> protection starts again, as if <code>.git</code> had just appeared, because the copy&rsquo;s <code>.git</code> is another folder too. devvm refuses a VM whose folder is still there, a <code>--clone</code> VM, and a folder that has a VM of its own, which you delete first with <code>devvm rm</code>.</p>
|
||
<h2 data-hextra-search-id="a-vm-whose-folder-is-gone">A VM whose folder is gone<span class="hx:absolute hx:-mt-20" id="a-vm-whose-folder-is-gone"></span>
|
||
<a href="#a-vm-whose-folder-is-gone" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When you delete or move a project folder, its VM stays, because the VM may hold work that&rsquo;s nowhere else and devvm never deletes a VM on its own. A folder you moved gets its VM back at its new path once you say so (<a href="#a-moved-or-renamed-folder">a moved or renamed folder</a>), and until then the VM&rsquo;s folder counts as gone. <code>devvm ls</code> writes <code>(gone)</code> after the folder of each VM whose folder is gone (<a href="#listing-vms">listing VMs</a>), and <code>devvm space</code> names each one with its folder. A folder on a disk that isn&rsquo;t connected isn&rsquo;t gone, and <a href="#a-folder-on-a-disk-that-isnt-connected">a folder on a disk that isn&rsquo;t connected</a> covers it. A folder that was deleted and made again at the same path isn&rsquo;t gone, and devvm handles it as <a href="#a-folder-made-again">a folder made again</a>. <a href="https://next.devvm.dev/docs/internals/overview/#a-vm-whose-folder-is-gone">A VM whose folder is gone</a> explains how devvm tells.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm ls <span class="c1"># the VMs, with (gone) after a folder that&#39;s gone</span>
|
||
</span></span><span class="line"><span class="cl">devvm rm devvm-web-71a99b1076d92c <span class="c1"># delete one by its name, after asking</span>
|
||
</span></span><span class="line"><span class="cl">devvm rm devvm-web-71a99b1076d92c --no-export <span class="c1"># a stopped one with an agent, without its history</span>
|
||
</span></span><span class="line"><span class="cl">devvm rm devvm-web-71a99b1076d92c --no-export --no-worktree-check <span class="c1"># a stopped one with opencode, without checking its worktrees</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm rm VM</code> deletes a VM whose folder is gone, and you can run it in any folder. VM is the VM&rsquo;s name, as <code>devvm ls</code> lists it, or the alias that ssh reaches it by. In a terminal, devvm names the VM and its folder and asks before deleting it, with no as the default. <code>--force</code> deletes it without asking, which <code>devvm rm VM</code> needs when there&rsquo;s no terminal. Like <code>devvm rm</code>, it deletes what devvm keeps for the VM, and when the VM has an agent, devvm first exports the agents&rsquo; history unless you give <code>--no-export</code> (<a href="https://next.devvm.dev/docs/using/coding-agents/#history">history</a>).</p>
|
||
<p>The export reads the history from the running VM. Starting a stopped VM would make its folder again, because Lima makes a missing folder that a VM mounts, so for a stopped VM with an agent devvm refuses and tells you to run <code>devvm rm VM --no-export</code>. devvm reads opencode&rsquo;s worktrees from the running VM too, so for a stopped VM with opencode it tells you to run <code>devvm rm VM --no-export --no-worktree-check</code>. If you moved the folder and want the history, run <code>devvm history export</code> or <code>devvm rm</code> in the folder at its new path, which moves the VM there first (<a href="#a-moved-or-renamed-folder">a moved or renamed folder</a>). A <code>--clone</code> VM mounts no project folder, so devvm starts it to export the history. Its clone&rsquo;s work can&rsquo;t be fetched into a repo that&rsquo;s gone, though, so devvm refuses to delete it unless you give <code>--no-clone-check</code>, which deletes the VM and that work with it.</p>
|
||
<p>Given this folder&rsquo;s own VM, <code>devvm rm VM</code> does what <code>devvm rm</code> does. It refuses these:</p>
|
||
<ul>
|
||
<li><strong>A folder that&rsquo;s still there:</strong> devvm refuses a VM whose folder is still there, including a VM made for an earlier folder at that path, and tells you to run <code>devvm rm</code> in that folder.</li>
|
||
<li><strong>A state changed by hand:</strong> a VM whose state names this folder while the folder has a VM of its own, which only a state changed by hand can do, is refused as a VM whose folder is still there, so <code>devvm rm VM</code> never deletes the folder&rsquo;s own VM in its place.</li>
|
||
<li><strong>An unknown name:</strong> devvm refuses a name that isn&rsquo;t one of your VMs.</li>
|
||
<li><strong>A VM its backend lost:</strong> devvm refuses a VM that its backend no longer has, for which <code>devvm gc --orphans</code> deletes what devvm keeps (<a href="https://next.devvm.dev/docs/using/space/#leftovers-of-a-vm-deleted-outside-devvm">leftovers of a VM deleted outside devvm</a>).</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="a-folder-on-a-disk-that-isnt-connected">A folder on a disk that isn&rsquo;t connected<span class="hx:absolute hx:-mt-20" id="a-folder-on-a-disk-that-isnt-connected"></span>
|
||
<a href="#a-folder-on-a-disk-that-isnt-connected" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When a project folder is on an external disk, a USB stick or a network share that isn&rsquo;t connected, nothing is at its path, but the folder may still hold the project&rsquo;s work, and so may the VM. devvm tells this apart from a deleted folder by the disk: it finds the nearest folder above the path that&rsquo;s still there, and when that folder is on another disk than the project folder was, the project folder isn&rsquo;t connected. <code>devvm ls</code> writes <code>(not connected)</code> after such a folder, and <code>devvm space</code> names each such VM with its folder. To use the VM again, connect the disk.</p>
|
||
<p><code>devvm rm VM</code> refuses such a VM when there&rsquo;s no terminal, even with <code>--force</code>, and tells you to connect the disk, or to run <code>devvm rm VM</code> in a terminal to delete the VM anyway. In a terminal, devvm names the VM and its folder and asks before deleting it, with no as the default, and <code>--force</code> never answers that question. Otherwise it deletes the VM as it deletes one whose folder is gone. A folder that you moved to another disk and then deleted counts as not connected too, so devvm asks in that case as well.</p></description></item><item><title>Images and tools</title><link>https://next.devvm.dev/docs/using/images/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/images/</guid><description>
|
||
<p>Every VM is a copy of an image. An image is <code>base</code> with your choice of layers on it, and nothing else. A VM also gets the shared tools you chose for it, such as node or Claude Code, which are mounted into it and are never part of an image. This page covers what a new VM gets, what base brings, the layers and adding them to a VM or taking them out, how the shared tools work, rebuilding, bringing an outdated VM up to date, and how to list, delete and clean up images. <a href="https://next.devvm.dev/docs/internals/images/">Images and caching</a> explains how devvm builds, pins and caches them, and <a href="https://next.devvm.dev/docs/using/toolchains/">toolchains</a> and <a href="https://next.devvm.dev/docs/using/coding-agents/#supported-agents">coding agents</a> list the shared tools.</p>
|
||
<div class="devvm-diagram" style="contain-intrinsic-block-size: auto 498px; --devvm-diagram-width: 496px"><svg xmlns="http://www.w3.org/2000/svg" class="pele pele-flowchart" viewBox="0 0 496 498" width="496" height="498" style="--_bg:var(--pele-bg,#fff);--_fg:var(--pele-fg,#1f1f1f);--_m:var(--pele-muted,#6e6e6e);--_l:var(--pele-line,#1f1f1f);--_s:var(--pele-surface,#f3f3f3);--_a:var(--pele-surface-alt,#e6e6e6);--_b:var(--pele-border,#8a8a8a);--_c:var(--pele-accent,#5b7bd5);color:var(--_fg);--_r:var(--pele-radius,4px);--_fm:var(--pele-font-mono,&quot;Departure Mono&quot;, monospace);font:14px sans-serif;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;font-family:var(--pele-font,&quot;Departure Mono&quot;, monospace)" fill="var(--_fg)" role="graphics-document document" aria-roledescription="flowchart" aria-labelledby="d519b89d51c7bc850--title" aria-describedby="d519b89d51c7bc850--desc"><title id="d519b89d51c7bc850--title">Images, VMs and the shared tools</title><desc id="d519b89d51c7bc850--desc">Ubuntu's cloud image, or a --from image, is the start of base, with the features you chose, and docker is a layer on base. Each VM is a copy of one image, and the shared tools, such as node and claude, are mounted into each VM read-only.</desc><g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round"><g class="pele-edge" data-id="L_ubuntu_base_0"><path d="M124,68L124,116.84"/><path class="pele-marker" d="M124,123.84L120.64,115.84L127.36,115.84Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_base_docker_0"><path d="M99.64,183.84L99.64,282.19"/><path class="pele-marker" d="M99.64,289.19L96.28,281.19L103,281.19Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_base_vm1_0"><path d="M188,183.84L188,200.69Q188,212.69 200,212.69L237.05,212.69Q249.05,212.69 249.05,224.69L249.05,282.19" stroke-dasharray="3 4"/><path class="pele-marker" d="M249.05,289.19L245.69,281.19L252.41,281.19Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_docker_vm2_0"><path d="M99.64,349.19L99.64,399.69Q99.64,411.69 111.64,411.69L206.5,411.69Q214.75,411.69 214.75,419.94L214.75,422.69" stroke-dasharray="3 4"/><path class="pele-marker" d="M214.75,429.69L211.39,421.69L218.11,421.69Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_tools_vm1_0"><path d="M406.11,194.66L406.11,200.69Q406.11,212.69 394.11,212.69L355.86,212.69Q343.86,212.69 343.86,224.69L343.86,282.19"/><path class="pele-marker" d="M343.86,289.19L340.5,281.19L347.22,281.19Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_tools_vm2_0"><path d="M440.05,193.9L440.05,399.69Q440.05,411.69 428.05,411.69L333.18,411.69Q324.93,411.69 324.93,419.94L324.93,422.69"/><path class="pele-marker" d="M324.93,429.69L321.57,421.69L328.29,421.69Z" fill="var(--_l)" stroke="none"/></g></g><g class="pele-edge-labels" font-size="14"><g class="pele-edge-label" data-id="L_base_vm1_0"><rect x="218.32" y="239.69" width="61.45" height="18" rx="3" fill="var(--_bg)"/><text x="249.05" y="252.89" text-anchor="middle">a copy</text>
|
||
</g><g class="pele-edge-label" data-id="L_docker_vm2_0"><rect x="68.91" y="373.69" width="61.45" height="18" rx="3" fill="var(--_bg)"/><text x="99.64" y="386.89" text-anchor="middle">a copy</text>
|
||
</g><g class="pele-edge-label" data-id="L_tools_vm1_0"><rect x="299.77" y="232.69" width="88.18" height="32" rx="3" fill="var(--_bg)"/><text text-anchor="middle" xml:space="preserve"><tspan x="343.86" y="244.89">mounted</tspan><tspan x="343.86" y="260.89">read-only</tspan></text>
|
||
</g><g class="pele-edge-label" data-id="L_tools_vm2_0"><rect x="395.95" y="303.19" width="88.18" height="32" rx="3" fill="var(--_bg)"/><text text-anchor="middle" xml:space="preserve"><tspan x="440.05" y="315.39">mounted</tspan><tspan x="440.05" y="331.39">read-only</tspan></text>
|
||
</g></g><g class="pele-nodes"><g class="pele-node pele-shape-rect" data-id="ubuntu" transform="translate(124,38)"><rect x="-111.55" y="-30" width="223.09" height="60" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">Ubuntu's cloud image,</tspan><tspan x="0" y="13.9">or a --from image</tspan></text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="base" transform="translate(124,153.84)"><rect x="-116" y="-30" width="232" height="60" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">base, with</tspan><tspan x="0" y="13.9">the features you chose</tspan></text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="docker" transform="translate(99.64,319.19)"><rect x="-84.82" y="-30" width="169.64" height="60" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">docker, a layer</tspan><tspan x="0" y="13.9">on base</tspan></text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="vm1" transform="translate(296.45,319.19)"><rect x="-67" y="-30" width="134" height="60" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">VM of base,</tspan><tspan x="0" y="13.9">with node</tspan></text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="vm2" transform="translate(269.84,459.69)"><rect x="-107.09" y="-30" width="214.18" height="60" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">VM of docker,</tspan><tspan x="0" y="13.9">with node and claude</tspan></text>
|
||
</g><g class="pele-node pele-shape-cyl" data-id="tools" transform="translate(411.66,153.84)"><path d="M-75.91,-30A75.91,10.84 0 0 1 75.91,-30V30A75.91,10.84 0 0 1 -75.91,30Z" fill="var(--_s)" stroke="var(--_b)"/><path d="M-75.91,-30A75.91,10.84 0 0 0 75.91,-30" fill="none" stroke="var(--_b)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="1.32">shared tools:</tspan><tspan x="0" y="19.32">node, claude…</tspan></text>
|
||
</g></g></svg></div><h2 data-hextra-search-id="what-a-new-vm-gets">What a new VM gets<span class="hx:absolute hx:-mt-20" id="what-a-new-vm-gets"></span>
|
||
<a href="#what-a-new-vm-gets" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><div class="devvm-diagram" style="contain-intrinsic-block-size: auto 875px; --devvm-diagram-width: 540px"><svg xmlns="http://www.w3.org/2000/svg" class="pele pele-flowchart" viewBox="0 0 540 875" width="540" height="875" style="--_bg:var(--pele-bg,#fff);--_fg:var(--pele-fg,#1f1f1f);--_m:var(--pele-muted,#6e6e6e);--_l:var(--pele-line,#1f1f1f);--_s:var(--pele-surface,#f3f3f3);--_a:var(--pele-surface-alt,#e6e6e6);--_b:var(--pele-border,#8a8a8a);--_c:var(--pele-accent,#5b7bd5);color:var(--_fg);--_r:var(--pele-radius,4px);--_fm:var(--pele-font-mono,&quot;Departure Mono&quot;, monospace);font:14px sans-serif;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;font-family:var(--pele-font,&quot;Departure Mono&quot;, monospace)" fill="var(--_fg)" role="graphics-document document" aria-roledescription="flowchart" aria-labelledby="d196989d9562bc717--title" aria-describedby="d196989d9562bc717--desc"><title id="d196989d9562bc717--title">What a new VM gets</title><desc id="d196989d9562bc717--desc">devvm starts from the defaults, the folder's toolchains and devvm setup's agents and layers, each flag given replaces its part, and the summary says what the VM gets. In a terminal, without --no-input and with something left to choose, devvm asks whether to customize it, and y opens the list, the tier, the CPUs, memory and disk. Then devvm builds the image if it isn't built and makes the VM as a copy of it, with its shared tools mounted.</desc><g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round"><g class="pele-edge" data-id="L_run_defaults_0"><path d="M195.27,68L195.27,106"/><path class="pele-marker" d="M195.27,113L191.91,105L198.63,105Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_defaults_flags_0"><path d="M195.27,173L195.27,211"/><path class="pele-marker" d="M195.27,218L191.91,210L198.63,210Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_flags_summary_0"><path d="M195.27,296L195.27,334"/><path class="pele-marker" d="M195.27,341L191.91,333L198.63,333Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_summary_term_0"><path d="M195.27,386L195.27,424"/><path class="pele-marker" d="M195.27,431L191.91,423L198.63,423Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_term_copy_0"><path d="M115.62,491L115.62,781.5"/><path class="pele-marker" d="M115.62,788.5L112.26,780.5L118.98,780.5Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_term_ask_0"><path d="M274.92,491L274.92,551"/><path class="pele-marker" d="M274.92,558L271.56,550L278.28,550Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_ask_copy_0"><path d="M218.28,603L218.28,609Q218.28,621 206.28,621L181.72,621Q169.72,621 169.72,633L169.72,781.5"/><path class="pele-marker" d="M169.72,788.5L166.36,780.5L173.08,780.5Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_ask_pick_0"><path d="M331.56,603L331.56,609Q331.56,621 343.56,621L368.13,621Q380.13,621 380.13,633L380.13,676.5"/><path class="pele-marker" d="M380.13,683.5L376.77,675.5L383.49,675.5Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_pick_copy_0"><path d="M380.13,743.5L380.13,754Q380.13,766 368.13,766L306.08,766Q294.45,766 294.45,777.63L294.45,781.5"/><path class="pele-marker" d="M294.45,788.5L291.09,780.5L297.81,780.5Z" fill="var(--_l)" stroke="none"/></g></g><g class="pele-edge-labels" font-size="14"><g class="pele-edge-label" data-id="L_term_copy_0"><rect x="102.72" y="571.5" width="25.82" height="18" rx="3" fill="var(--_bg)"/><text x="115.62" y="584.7" text-anchor="middle">no</text>
|
||
</g><g class="pele-edge-label" data-id="L_term_ask_0"><rect x="257.56" y="515.5" width="34.73" height="18" rx="3" fill="var(--_bg)"/><text x="274.92" y="528.7" text-anchor="middle">yes</text>
|
||
</g><g class="pele-edge-label" data-id="L_ask_copy_0"><rect x="143.44" y="704.5" width="52.55" height="18" rx="3" fill="var(--_bg)"/><text x="169.72" y="717.7" text-anchor="middle">Enter</text>
|
||
</g><g class="pele-edge-label" data-id="L_ask_pick_0"><rect x="371.67" y="641" width="16.91" height="18" rx="3" fill="var(--_bg)"/><text x="380.13" y="654.2" text-anchor="middle">y</text>
|
||
</g></g><g class="pele-nodes"><g class="pele-node pele-shape-rect" data-id="run" transform="translate(195.27,38)"><rect x="-93.73" y="-30" width="187.45" height="60" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">devvm in a folder</tspan><tspan x="0" y="13.9">without a VM</tspan></text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="defaults" transform="translate(195.27,143)"><rect x="-187.27" y="-30" width="374.55" height="60" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">the defaults: the folder's toolchains,</tspan><tspan x="0" y="13.9">devvm setup's agents and layers</tspan></text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="flags" transform="translate(195.27,257)"><rect x="-169.45" y="-39" width="338.91" height="78" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-13.1">each flag given replaces its part:</tspan><tspan x="0" y="4.9">--tools, --agents, --layers,</tspan><tspan x="0" y="22.9">--network, --cpus, --memory</tspan></text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="summary" transform="translate(195.27,363.5)"><rect x="-165" y="-22.5" width="330" height="45" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="0" y="4.9" text-anchor="middle">the summary says what the VM gets</text>
|
||
</g><g class="pele-node pele-shape-hex" data-id="term" transform="translate(195.27,461)"><polygon points="-156.09,-30 156.09,-30 171.09,0 156.09,30 -156.09,30 -171.09,0" fill="var(--_s)" stroke="var(--_b)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">a terminal, without --no-input,</tspan><tspan x="0" y="13.9">and something left to choose?</tspan></text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="copy" transform="translate(199.27,827.5)"><rect x="-147.18" y="-39" width="294.36" height="78" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-13.1">its image built if it isn't,</tspan><tspan x="0" y="4.9">and the VM is a copy of it,</tspan><tspan x="0" y="22.9">with its shared tools mounted</tspan></text>
|
||
</g><g class="pele-node pele-shape-hex" data-id="ask" transform="translate(274.92,580.5)"><polygon points="-102.64,-22.5 102.64,-22.5 113.89,0 102.64,22.5 -102.64,22.5 -113.89,0" fill="var(--_s)" stroke="var(--_b)"/><text class="pele-label" x="0" y="4.9" text-anchor="middle">Customize it? [y/N]</text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="pick" transform="translate(380.13,713.5)"><rect x="-151.64" y="-30" width="303.27" height="60" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">the list, then the tier,</tspan><tspan x="0" y="13.9">then the CPUs, memory and disk</tspan></text>
|
||
</g></g></svg></div><p>Before devvm makes a new VM, it shows a summary of what the VM gets. The summary names each toolchain, coding agent and layer with why the VM gets it, such as <code>for package.json</code>, <code>from devvm setup</code> or <code>from --tools</code>, and then the VM&rsquo;s size, its network tier, its ports and the folder&rsquo;s <code>devcontainer.json</code>, when there is one:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">==&gt; This folder&#39;s new VM, devvm-some-project-71a99b1076d92c, gets:
|
||
</span></span><span class="line"><span class="cl"> toolchain node, for package.json
|
||
</span></span><span class="line"><span class="cl"> agent claude, from devvm setup
|
||
</span></span><span class="line"><span class="cl"> layers: none
|
||
</span></span><span class="line"><span class="cl"> size: 4 CPUs, 8 GiB of memory and a 100 GiB disk
|
||
</span></span><span class="line"><span class="cl"> network tier: allowlist
|
||
</span></span><span class="line"><span class="cl"> ports: all
|
||
</span></span><span class="line"><span class="cl"> devcontainer.json: .devcontainer/devcontainer.json, which devvm --no-devcontainer skips
|
||
</span></span><span class="line"><span class="cl">Customize it? [y/N]</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>In a terminal, devvm then asks whether to customize the VM, with no as the default, so confirming makes it as shown. When you customize it, devvm shows the three parts in one list under three headings, Toolchains, Coding agents and Layers, with what the summary showed already chosen (<a href="#choosing-in-a-list">choosing in a list</a>). The Layers heading says that a layer is extra software built into the VM&rsquo;s image:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Choose what devvm-some-project-71a99b1076d92c gets. Use up and down to move, space to toggle and enter to confirm.
|
||
</span></span><span class="line"><span class="cl">Toolchains
|
||
</span></span><span class="line"><span class="cl">&gt; [x] node for package.json
|
||
</span></span><span class="line"><span class="cl"> [ ] python
|
||
</span></span><span class="line"><span class="cl"> [ ] rust
|
||
</span></span><span class="line"><span class="cl"> [ ] go
|
||
</span></span><span class="line"><span class="cl">Coding agents, which you start in the VM&#39;s shell
|
||
</span></span><span class="line"><span class="cl"> [x] claude from devvm setup
|
||
</span></span><span class="line"><span class="cl"> [ ] codex
|
||
</span></span><span class="line"><span class="cl"> [ ] opencode
|
||
</span></span><span class="line"><span class="cl"> [ ] pi
|
||
</span></span><span class="line"><span class="cl">Layers: extra software built into the VM&#39;s image, such as docker, nix or desktop
|
||
</span></span><span class="line"><span class="cl"> [ ] desktop an Xfce desktop, which devvm desktop opens
|
||
</span></span><span class="line"><span class="cl"> [ ] docker Docker&#39;s engine, CLI, BuildKit and Compose
|
||
</span></span><span class="line"><span class="cl"> [ ] nix Nix, direnv and nix-direnv</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>After the list, devvm asks three more questions, in this order:</p>
|
||
<ol>
|
||
<li>Unless you gave <code>--network</code>, devvm lists the four network tiers, with <code>learn</code> after <code>internet</code> for a VM that <a href="https://next.devvm.dev/docs/safety/network/#learning-the-hosts-a-vm-needs">learns the hosts it needs</a>, each with what it reaches, and you choose one, starting from the tier the summary showed: allowlist, or the tier you saved for new VMs with <code>devvm network -g</code> (<a href="https://next.devvm.dev/docs/safety/network/#choosing-a-tier">choosing a tier</a>).</li>
|
||
<li>Unless you gave <code>--ports</code>, devvm lists the ports the VM can forward: every port, none, which you add later with <code>devvm ports add</code>, or the ports you type, which devvm checks as <code>--ports</code> checks them and asks for again when they aren&rsquo;t a list. The list starts on what the summary showed, every port unless <code>config.toml</code> or <code>devvm ports -g</code> set another (<a href="https://next.devvm.dev/docs/using/ports-size/#size-and-ports">size and ports</a>), and the ports you choose are this VM&rsquo;s alone.</li>
|
||
<li>Last, it asks for the VM&rsquo;s CPUs, memory and disk, starting from the summary&rsquo;s, and confirming keeps each one. Each question is skipped when you gave its flag, <code>--cpus</code>, <code>--memory</code> or <code>--disk</code>. Before the disk&rsquo;s question, devvm says that the disk can grow later with <code>devvm size --disk</code> but never shrinks, and that it takes up only the space the VM writes. A disk smaller than the image&rsquo;s, 100 GiB for base, is refused as <code>--disk</code> refuses it, and devvm asks again, as it does for a value that isn&rsquo;t a size. The size you type is this VM&rsquo;s alone, and devvm saves it for no other VM.</li>
|
||
</ol>
|
||
<p>Each part has a default:</p>
|
||
<ul>
|
||
<li><strong>Toolchains:</strong> the ones the folder&rsquo;s files call for, each naming its file in the summary and the list, such as <code>package.json</code>.</li>
|
||
<li><strong>Coding agents:</strong> the ones you chose with <a href="https://next.devvm.dev/docs/using/settings/#coding-agents-for-new-vms">devvm setup</a>, which the summary and the list say. The summary says <code>from config.toml</code> for the ones that <code>config.toml</code> sets. Until you choose some, there are none.</li>
|
||
<li><strong>Layers:</strong> the ones you chose with <a href="https://next.devvm.dev/docs/using/settings/#layers-for-new-vms">devvm setup</a>, bottom first, which the summary and the list say in the same way. Until you choose some, there are none. A layer that a project file calls for, such as <code>nix</code> for a <code>flake.nix</code>, names the file in its row of the list but isn&rsquo;t chosen unless devvm setup chose it, so you choose it when you want it.</li>
|
||
</ul>
|
||
<p>Three flags choose the parts on the command line. <code>--tools</code> takes the toolchains, as in <code>--tools node,python</code>, <code>--agents</code> takes the coding agents, as in <code>--agents claude,codex</code>, and <code>--layers</code> takes the layers bottom first, as in <code>--layers docker,mine</code>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm --tools node,python --agents claude,codex --layers docker <span class="c1"># choose every part, without the list</span>
|
||
</span></span><span class="line"><span class="cl">devvm --agents none <span class="c1"># no agents, the rest as the summary shows</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Each is the exact list for its part and replaces that part&rsquo;s default, and <code>none</code> chooses none of it, as in <code>--agents none</code>. A part whose flag you leave out takes its default. devvm checks each name before it does anything. For a name that belongs to another part, such as <code>--tools claude</code>, it names the flag that takes it, and for a name it doesn&rsquo;t know, it suggests the closest one.</p>
|
||
<p>A part, tier or size that a flag gives is taken as given, and the summary says so. devvm still asks whether to customize the VM while anything is left to choose, because a flag answers only its own part. When you customize it, the list shows a part that a flag gave greyed out, and the cursor skips it. Each question is skipped in its own case:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Question</th>
|
||
<th>Skipped when</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>the list</td>
|
||
<td><code>--tools</code>, <code>--agents</code> and <code>--layers</code> give all three parts</td>
|
||
</tr>
|
||
<tr>
|
||
<td>the tier</td>
|
||
<td>you give <code>--network</code> or saved a tier, or the backend&rsquo;s VMs can only be open</td>
|
||
</tr>
|
||
<tr>
|
||
<td>the ports</td>
|
||
<td>you give <code>--ports</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>the CPUs, the memory or the disk</td>
|
||
<td>you give <code>--cpus</code>, <code>--memory</code> or <code>--disk</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>whether to customize the VM</td>
|
||
<td>the flags give every part, the ports, the CPUs, the memory and the disk, and the tier is given or saved</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>Without a terminal, or with <code>--no-input</code>, devvm asks nothing and doesn&rsquo;t fail. The VM gets what the summary shows, and the summary ends with the flags that choose others.</p>
|
||
<p>devvm looks at the folder&rsquo;s top level for the files that call for a toolchain, in this order:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Toolchain</th>
|
||
<th>Files</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>node</td>
|
||
<td><code>package.json</code>, <code>bun.lock</code>, <code>bun.lockb</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>python</td>
|
||
<td><code>pyproject.toml</code>, <code>requirements.txt</code>, <code>uv.lock</code>, <code>setup.py</code>, <code>Pipfile</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>rust</td>
|
||
<td><code>Cargo.toml</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>go</td>
|
||
<td><code>go.mod</code></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>The defaults combine this way:</p>
|
||
<ul>
|
||
<li>If more than one toolchain matches, the VM gets them all, so <code>package.json</code> and <code>pyproject.toml</code> give node and python. A Nix project&rsquo;s files call for the <a href="#nix"><code>nix</code> layer</a>, whose row names them. Those files are <code>flake.nix</code>, <code>shell.nix</code> and <code>devenv.nix</code>, and a <code>default.nix</code> that makes a shell with <code>mkShell</code>. In a folder with none of these files, the default is no toolchains, so a VM made without a terminal or flags gets devvm setup&rsquo;s layers and agents.</li>
|
||
<li>A folder&rsquo;s <code>devcontainer.json</code> adds what its features map to, such as toolchains or the <code>docker</code> layer, to the defaults, each naming the file in the summary and the list (<a href="https://next.devvm.dev/docs/using/devcontainer/"><code>devcontainer.json</code></a>). Its layers go on top of devvm setup&rsquo;s.</li>
|
||
<li>The VM&rsquo;s image is base with its layers, in the order you give them, bottom first, so <code>--layers docker,mine</code> makes the image <code>docker+mine</code>. When you check layers in the list, devvm setup&rsquo;s stay in their order at the bottom, and the ones you add go on top in the list&rsquo;s order. Its shared tools are a list of their own, the toolchains first, then the agents.</li>
|
||
</ul>
|
||
<p>If the image isn&rsquo;t built yet, devvm builds it first, then the shared tools the share lacks, and the VM is a copy of the image with its shared tools mounted. A VM keeps the image and tools it was made from, and the options for a new VM change nothing on a VM that exists, which ignores them with a warning. The warning names the command that changes the same on that VM:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Option</th>
|
||
<th>The command the warning names</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>--tools</code></td>
|
||
<td><code>devvm tools</code>, which <a href="https://next.devvm.dev/docs/using/toolchains/#adding-and-removing-tools">changes its shared tools</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--layers</code></td>
|
||
<td><code>devvm layer add</code>, which <a href="#adding-layers-to-a-vm">adds layers</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--cpus</code></td>
|
||
<td><code>devvm size</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--from</code>, <code>--no-devcontainer</code></td>
|
||
<td>none</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>Only <code>devvm</code> takes these options, and another command given one fails as it does for any flag it doesn&rsquo;t know (<a href="https://next.devvm.dev/docs/using/command-line/#flags-and-values">flags and values</a>).</p>
|
||
<h3 data-hextra-search-id="choosing-in-a-list">Choosing in a list<span class="hx:absolute hx:-mt-20" id="choosing-in-a-list"></span>
|
||
<a href="#choosing-in-a-list" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>devvm&rsquo;s lists work the same way everywhere: the new VM&rsquo;s list, its network tiers and ports, <code>devvm tools</code>, base&rsquo;s features in <code>devvm setup</code>, and the hosts in <code>devvm network lock</code>.</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Key</th>
|
||
<th>What it does</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>Up and down, or <code>k</code> and <code>j</code></td>
|
||
<td>move the cursor, and in a list where you choose one, such as the network tiers, moving chooses it</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Space</td>
|
||
<td>in a list where you choose several, such as the toolchains, coding agents and layers, chooses or unchooses the row under the cursor</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>a</code></td>
|
||
<td>in a list where you choose several, chooses every row, or unchooses them all when they&rsquo;re all chosen already</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Enter</td>
|
||
<td>confirms, and at a question with a value in brackets, such as a size, keeps that value</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>A row that&rsquo;s greyed out, such as a part a flag gave or a VM&rsquo;s layers in <code>devvm tools</code>, can&rsquo;t change, and the cursor skips it. A list longer than the terminal scrolls with the cursor, with a line above and below that says how many more rows there are, and each row is cut to the terminal&rsquo;s width.</p>
|
||
<h2 data-hextra-search-id="base">Base<span class="hx:absolute hx:-mt-20" id="base"></span>
|
||
<a href="#base" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>base</code> is the image that every other image is built on. It is Ubuntu 26.04&rsquo;s cloud image with git, git-lfs, build-essential, ripgrep, jq, sqlite3 and mise added, followed by the optional <a href="https://next.devvm.dev/docs/using/customizing/#base-image-features">features</a> you chose, such as oh-my-bash and fzf. Docker comes as a <a href="#built-in-layers">layer of devvm&rsquo;s</a>, so you choose it when you customize a new VM, or give <code>devvm --layers docker</code>. With <code>--from</code>, base starts from a container image instead of Ubuntu&rsquo;s (<a href="https://next.devvm.dev/docs/using/from/">details</a>). A VM made from base gets 4 CPUs, 8 GiB of memory and a 100 GiB disk unless you give it another size, and on a small machine it gets fewer CPUs and less memory (<a href="https://next.devvm.dev/docs/using/ports-size/#size-and-ports">size and ports</a>).</p>
|
||
<p>Your VMs use Ubuntu&rsquo;s live archive, and base keeps no package lists, so run <code>sudo apt update</code> in a VM before you install a package, and <code>apt upgrade</code> then gets the current updates:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo apt update <span class="o">&amp;&amp;</span> sudo apt install PACKAGE <span class="c1"># in the VM: fetch the lists first, as base keeps none</span>
|
||
</span></span><span class="line"><span class="cl">sudo apt upgrade <span class="c1"># the current updates</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>base drops the server extras that Ubuntu&rsquo;s cloud image comes with, such as snapd and apt&rsquo;s background updates, which saves 0.9 GB of disk and 100 MB of memory per VM (<a href="https://next.devvm.dev/docs/internals/images/#bases-size">base&rsquo;s size</a>). The everyday tools stay, such as htop, tmux, lsof, strace, tcpdump, rsync and nano.</p>
|
||
<p>The first time devvm builds base on this machine, it starts from the newest release of Ubuntu&rsquo;s cloud image and installs the newest packages from Ubuntu&rsquo;s archive, or first from a <a href="https://next.devvm.dev/docs/using/settings/#an-ubuntu-mirror">mirror you set</a>. devvm keeps a copy of each package it installed, so building the same base again, such as after <code>devvm images rm base</code>, installs exactly those packages from the copies, with no network for them. <code>devvm rebuild base</code> starts again from the newest image and packages (<a href="#rebuilding">rebuilding</a>).</p>
|
||
<h2 data-hextra-search-id="layers">Layers<span class="hx:absolute hx:-mt-20" id="layers"></span>
|
||
<a href="#layers" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>An image is base with layers on it, named bottom first and joined with <code>+</code>, so <code>foo+bar</code> is <code>bar</code> on <code>foo</code> on <code>base</code>. You can leave <code>base</code> itself out, which makes <code>base+foo</code> the same as <code>foo</code>. An image name never holds <a href="#shared-tools">shared tools</a>, which aren&rsquo;t layers, so <code>devvm build</code>, <code>devvm rebuild</code> and <code>devvm images rm</code> refuse a shared tool&rsquo;s name, such as <code>node</code>, and point you to <code>devvm tools</code>.</p>
|
||
<p>A layer is a script that bash runs in the image&rsquo;s VM as the VM&rsquo;s user, who has sudo. It is either one of devvm&rsquo;s <a href="#built-in-layers">built-in layers</a> or one of yours, at <code>~/.config/devvm/layers/&lt;name&gt;.sh</code>, and <code>devvm layer new NAME</code> starts a layer of your own (<a href="https://next.devvm.dev/docs/using/customizing/#your-own-layers">details</a>). devvm refuses a layer whose script is missing, and it refuses any name in an image that breaks these rules:</p>
|
||
<ul>
|
||
<li>A layer&rsquo;s name is made of lowercase letters, digits and dashes.</li>
|
||
<li>It starts with a letter or digit.</li>
|
||
<li>It is neither <code>base</code>, a built-in layer&rsquo;s name nor a shared tool&rsquo;s name.</li>
|
||
</ul>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm build foo+bar <span class="c1"># builds base, foo and foo+bar, unless they&#39;re built</span>
|
||
</span></span><span class="line"><span class="cl">devvm rebuild foo <span class="c1"># builds foo again, and deletes the old foo and foo+bar</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="built-in-layers">Built-in layers<span class="hx:absolute hx:-mt-20" id="built-in-layers"></span>
|
||
<a href="#built-in-layers" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>devvm ships three layers, <code>desktop</code>, <code>docker</code> and <code>nix</code>. You choose them like any other layer, in the list devvm shows for a new VM or as in <code>devvm --layers docker</code>, and you build one with <code>devvm build nix</code>. To give every new VM one, choose it with <a href="https://next.devvm.dev/docs/using/settings/#layers-for-new-vms"><code>devvm setup --layers</code></a>, and to give a VM you have one, run <code>devvm layer add</code> (<a href="#adding-layers-to-a-vm">adding layers to a VM</a>). Their names are reserved, so devvm refuses <code>devvm layer new docker</code> and never reads a <code>desktop.sh</code>, <code>docker.sh</code> or <code>nix.sh</code> of yours. The hosts that each layer needs are in its own <a href="https://next.devvm.dev/docs/safety/network/#allowlists">allowlist</a>.</p>
|
||
<h4 data-hextra-search-id="desktop">desktop<span class="hx:absolute hx:-mt-20" id="desktop"></span>
|
||
<a href="#desktop" class="subheading-anchor" aria-label="Permalink for this section"></a></h4><p>The <code>desktop</code> layer installs an Xfce desktop with TigerVNC&rsquo;s server, which <a href="https://next.devvm.dev/docs/using/desktop/"><code>devvm desktop</code></a> opens in Screen Sharing, and adds about 370 MB to the image. Its packages come from the distribution&rsquo;s archive as it is when the layer builds, which on a base made <code>--from alpine</code> means Alpine&rsquo;s own packages, and they aren&rsquo;t pinned. It needs no hosts of its own on the allowlist tier, and a VM without the layer has no desktop.</p>
|
||
<h4 data-hextra-search-id="docker">docker<span class="hx:absolute hx:-mt-20" id="docker"></span>
|
||
<a href="#docker" class="subheading-anchor" aria-label="Permalink for this section"></a></h4><p>The <code>docker</code> layer installs Docker&rsquo;s engine, CLI, BuildKit and Compose from Docker&rsquo;s apt repository, adds the VM&rsquo;s user to the <code>docker</code> group, and starts the daemon at each boot. On a base made <code>--from alpine</code>, it installs Alpine&rsquo;s own packages instead. A VM without the layer has no Docker.</p>
|
||
<p>A VM with the layer can be on any network tier like any other, because its containers&rsquo; connections go through the VM&rsquo;s network, which devvm confines from outside the VM (<a href="https://next.devvm.dev/docs/safety/network/#network-tiers">network tiers</a>). devvm gives every container the VM&rsquo;s proxy settings, and on a confined tier, a container that ignores them, or was made without them through Docker&rsquo;s API, reaches the hosts the VM&rsquo;s rules allow by name through <a href="https://next.devvm.dev/docs/safety/network/#tools-that-ignore-the-proxy">transparent mode</a>, on Docker&rsquo;s default bridge and on networks that <code>docker network create</code> and Compose make. Such a container doesn&rsquo;t trust the VM&rsquo;s CA, so a blocked HTTPS host gives it a certificate error rather than the proxy&rsquo;s <code>403</code>, and the block is logged all the same. A container run with <code>--network none</code>, or on an <code>--internal</code> network, reaches nothing.</p>
|
||
<h4 data-hextra-search-id="nix">nix<span class="hx:absolute hx:-mt-20" id="nix"></span>
|
||
<a href="#nix" class="subheading-anchor" aria-label="Permalink for this section"></a></h4><p>The <code>nix</code> layer installs <a href="https://nixos.org" target="_blank" rel="noopener">Nix</a> with flakes and the <code>nix</code> command turned on, and <a href="https://direnv.net" target="_blank" rel="noopener">direnv</a> with <a href="https://github.com/nix-community/nix-direnv" target="_blank" rel="noopener">nix-direnv</a>, so a project&rsquo;s <code>flake.nix</code>, <code>shell.nix</code> or <code>devenv.nix</code> can supply its toolchain. Each VM has a Nix store and daemon of its own, which no other VM and nothing on this machine shares. VMs share their downloads from Nix&rsquo;s binary cache through a cache on this machine that only devvm fills. <a href="https://next.devvm.dev/docs/using/toolchains/#nix-projects">Nix projects</a> explains that cache, and how a flake&rsquo;s dev shell and the shared tools work together.</p>
|
||
<p>The <code>nix</code> layer works on a base from Ubuntu, Debian or Alpine. On a base made <code>--from alpine</code>, it installs Alpine&rsquo;s <code>xz</code> package, which isn&rsquo;t pinned, and runs Nix&rsquo;s daemon as an OpenRC service.</p>
|
||
<h2 data-hextra-search-id="adding-layers-to-a-vm">Adding layers to a VM<span class="hx:absolute hx:-mt-20" id="adding-layers-to-a-vm"></span>
|
||
<a href="#adding-layers-to-a-vm" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A VM keeps the layers devvm made it with, because a layer&rsquo;s script changes the VM&rsquo;s disk. <code>devvm layer add LAYER...</code> gives a VM more layers by making it again. devvm builds an image with the new layers on top of the VM&rsquo;s own, in the order you give them, and gives the VM a new disk, copied from that image. A VM of <code>docker</code> with <code>desktop</code> added is made again from <code>docker+desktop</code>, so the images it already uses stay as they are. devvm names the layers the VM has already and leaves them where they are, and when the VM has all of them, devvm says so and changes nothing.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm layer add desktop <span class="c1"># make this folder&#39;s VM again with the desktop layer on top</span>
|
||
</span></span><span class="line"><span class="cl">devvm layer add docker nix <span class="c1"># docker, then nix on top of it</span>
|
||
</span></span><span class="line"><span class="cl">devvm layer add desktop --force <span class="c1"># the same without asking, as a script must</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Everything on the VM&rsquo;s disk that devvm doesn&rsquo;t keep is lost, so in a terminal devvm names the image and asks first, with no as the default. Without a terminal, it refuses unless you give <code>--force</code>. When the VM has a coding agent, devvm first exports the agents&rsquo; history, as <code>devvm rm</code> does, unless you give <code>--no-export</code> (<a href="https://next.devvm.dev/docs/using/coding-agents/#history">history</a>). In a subfolder of a folder with a VM, devvm asks in a terminal whether to make that folder&rsquo;s VM again, and refuses without one.</p>
|
||
<p>devvm refuses before it changes anything in these cases:</p>
|
||
<ul>
|
||
<li>A name isn&rsquo;t a layer, or is a shared tool&rsquo;s name, which <code>devvm tools add</code> adds instead.</li>
|
||
<li>The VM&rsquo;s backend can&rsquo;t run one of the layers.</li>
|
||
<li>The VM&rsquo;s creation didn&rsquo;t finish.</li>
|
||
<li>The VM is a <code>--clone</code> VM, whose clone of the repo is on its disk. To give a <code>--clone</code> VM more layers, run <code>devvm clone off</code>, which offers to fetch the clone&rsquo;s work first, then <code>devvm layer add</code> and <code>devvm clone on</code> (<a href="https://next.devvm.dev/docs/using/clone/#switching-a-vm-that-exists">switching a VM that exists</a>).</li>
|
||
</ul>
|
||
<p>devvm then works in this order:</p>
|
||
<ol>
|
||
<li>It builds the new image, so a build that fails leaves the VM as it was.</li>
|
||
<li>It exports the agents&rsquo; history and saves the VM&rsquo;s home folder on this machine.</li>
|
||
<li>It stops the VM and sets its old disk aside under another name.</li>
|
||
<li>It makes the VM again from the new image, with the same name and settings, and starts it.</li>
|
||
<li>It copies the home folder onto the new disk and deletes the old disk, then opens a shell in the VM.</li>
|
||
</ol>
|
||
<p>Until the new VM has started with its home folder, a step that fails, or Ctrl+C, deletes the new disk and puts the old one back as it was. While one devvm makes a VM again, another devvm that would make the same VM again refuses, and so does <code>devvm</code> in its folder, so wait for the first to finish. While devvm makes the VM again, the old disk, the new one and the saved home folder take room on this machine at the same time, and devvm checks for free space before it starts.</p>
|
||
<h3 data-hextra-search-id="what-a-vm-made-again-keeps">What a VM made again keeps<span class="hx:absolute hx:-mt-20" id="what-a-vm-made-again-keeps"></span>
|
||
<a href="#what-a-vm-made-again-keeps" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>devvm keeps the project folder, which is on this machine, the VM&rsquo;s home folder, and everything it keeps for the VM:</p>
|
||
<ul>
|
||
<li>The VM keeps its name, its shared tools, its size, its ports, its network tier and allowlist, its secrets&rsquo; bindings, its SSH agent choice and its <code>.git</code> protection.</li>
|
||
<li>It keeps its links, group and published ports, its desktop&rsquo;s password and port, and what its <code>devcontainer.json</code> gave it. The commands in its <code>devcontainer.json</code> that run once, such as <code>postCreateCommand</code>, run again on the new disk.</li>
|
||
<li>It keeps its identity, so <a href="https://next.devvm.dev/docs/using/links/#which-vm-a-link-reaches">links</a> to it still reach it. It gets new SSH host keys, which devvm pins as it does for any new VM.</li>
|
||
</ul>
|
||
<p>devvm reads the home folder as the VM&rsquo;s user before it stops the VM, and copies it onto the new disk before devvm&rsquo;s own setup runs there. <code>--clean-home</code> gives the VM the new image&rsquo;s home folder instead. Some of the home folder stays behind:</p>
|
||
<ul>
|
||
<li>What other shells in the VM write after devvm reads the folder is lost, so close them first.</li>
|
||
<li>A file that the new image puts in your home itself, such as <code>~/.bashrc</code>, stays the image&rsquo;s, so put shell settings of your own in a file of yours in <code>~/.bashrc.d</code>.</li>
|
||
<li>devvm leaves out what the new VM gets from devvm itself: <code>~/.config/devvm</code>, <code>~/.ssh/authorized_keys</code>, the agents&rsquo; logins, and the agents&rsquo; folders and files that devvm links or copies from this machine. It leaves out <code>~/.cache</code> too. It keeps opencode&rsquo;s <code>~/.local/state/opencode/machine</code>, which an export of the VM&rsquo;s history leaves out, so the machines that opencode paired still trust the VM.</li>
|
||
<li>Claude Code&rsquo;s logins to MCP servers, which it keeps in its login file, don&rsquo;t come along, so you log in to those servers again in the new VM (<a href="https://next.devvm.dev/docs/using/coding-agents/#mcp-servers-logins">MCP servers&rsquo; logins</a>).</li>
|
||
<li>devvm keeps only files, folders and symlinks, without setuid bits, and nothing from a filesystem mounted inside your home.</li>
|
||
</ul>
|
||
<p>Everything else on the VM&rsquo;s disk is lost:</p>
|
||
<ul>
|
||
<li>the packages you installed with apt</li>
|
||
<li>programs installed outside your home</li>
|
||
<li>Docker&rsquo;s images, containers and volumes</li>
|
||
<li>the Nix store</li>
|
||
<li>the processes that ran in it</li>
|
||
</ul>
|
||
<p>When saving the home folder fails, devvm keeps the VM as it was, and <code>--clean-home</code> goes ahead without it. With <code>--clean-home</code>, opencode&rsquo;s worktrees go with the home folder, so devvm checks them for uncommitted changes first and asks before they go, as <code>devvm rm</code> does. <code>--no-worktree-check</code>, which works only with <code>--clean-home</code>, skips that check (<a href="https://next.devvm.dev/docs/using/coding-agents/#opencodes-worktrees">opencode&rsquo;s worktrees</a>).</p>
|
||
<h3 data-hextra-search-id="a-remake-that-stops-halfway">A remake that stops halfway<span class="hx:absolute hx:-mt-20" id="a-remake-that-stops-halfway"></span>
|
||
<a href="#a-remake-that-stops-halfway" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>If devvm itself is killed while it makes a VM again, such as when this machine loses power, the VM&rsquo;s state records the remake. The next <code>devvm</code>, <code>devvm layer add</code>, <code>devvm layer rm</code>, <code>devvm update</code>, <code>devvm clone on</code> or <code>devvm clone off</code> in the folder finishes it without asking. When the new VM already has its home folder, devvm only deletes the old disk. When the old disk is still set aside otherwise, devvm puts it back and makes the VM again from the start, and when it&rsquo;s gone, devvm makes the new VM with the home folder it saved. Until then, other commands on the VM refuse and name <code>devvm</code>, and <code>devvm rm</code> deletes the VM together with its old disk.</p>
|
||
<h2 data-hextra-search-id="taking-layers-out-of-a-vm">Taking layers out of a VM<span class="hx:absolute hx:-mt-20" id="taking-layers-out-of-a-vm"></span>
|
||
<a href="#taking-layers-out-of-a-vm" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>devvm layer rm LAYER...</code> takes layers out of a VM by making it again, in the same way that <code>devvm layer add</code> puts them in. devvm builds an image of the VM&rsquo;s other layers, in the order they had, and gives the VM a new disk, copied from that image. A VM of <code>docker+nix+desktop</code> without <code>nix</code> is made again from <code>docker+desktop</code>, and a VM without any of its layers is made again from <code>base</code>. devvm names the layers that the VM doesn&rsquo;t have and leaves them out, and when the VM has none of them, devvm says so and changes nothing.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm layer rm desktop <span class="c1"># make this folder&#39;s VM again without the desktop layer</span>
|
||
</span></span><span class="line"><span class="cl">devvm layer rm docker nix <span class="c1"># take out docker and nix</span>
|
||
</span></span><span class="line"><span class="cl">devvm layer rm desktop --force <span class="c1"># the same without asking, as a script must</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>The VM keeps what <a href="#what-a-vm-made-again-keeps">a VM made again keeps</a>, its home folder included, and everything else on its disk is lost, such as what the layers you took out installed and Docker&rsquo;s images. So devvm asks first in a terminal, with no as the default, and refuses without one unless you give <code>--force</code>. It takes the same flags as <code>devvm layer add</code> and works in the same steps. Before it changes anything, it refuses these:</p>
|
||
<ul>
|
||
<li>It refuses the same VMs as <code>devvm layer add</code>, which are a <code>--clone</code> VM, one whose creation didn&rsquo;t finish, and one whose backend can&rsquo;t run the layers left.</li>
|
||
<li>It refuses <code>base</code>, and a shared tool&rsquo;s name, which <code>devvm tools rm</code> takes out instead.</li>
|
||
<li>It refuses a name that isn&rsquo;t a layer.</li>
|
||
</ul>
|
||
<p>You can still take out a layer of yours whose script you deleted, and that&rsquo;s the one way to make such a VM again with its home folder and settings, because <code>devvm layer add</code> and <code>devvm update</code> need every layer&rsquo;s script to build the VM&rsquo;s image.</p>
|
||
<h2 data-hextra-search-id="shared-tools">Shared tools<span class="hx:absolute hx:-mt-20" id="shared-tools"></span>
|
||
<a href="#shared-tools" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>The toolchains and coding agents are shared tools, not image layers. A VM of any image can have them, in any mix, such as node and Claude Code on base, or go and Codex on <code>foo</code>. A VM&rsquo;s state lists its shared tools apart from its image. <a href="https://next.devvm.dev/docs/using/toolchains/">Toolchains</a> lists the toolchains, with what each brings, and <a href="https://next.devvm.dev/docs/using/coding-agents/#supported-agents">supported agents</a> lists the coding agents.</p>
|
||
<p>devvm builds each tool version once and mounts it read-only into every VM that has it, so any mix of tools works without building anything new, and ten VMs with node share one copy of it. The builds are in <code>~/.local/share/devvm/tools</code>. Each C library gets a build of its own, so when an Alpine VM and an Ubuntu VM both have node 24, <code>devvm images</code> lists two builds of that version (<a href="https://next.devvm.dev/docs/using/space/#shared-tools">what devvm keeps</a>). An Alpine VM&rsquo;s builds are only ever shared with VMs on the same container image, as <a href="https://next.devvm.dev/docs/using/from/#shared-tools-and-glibc">shared tools and glibc</a> explains. <a href="https://mise.jdx.dev" target="_blank" rel="noopener">mise</a> runs the tools:</p>
|
||
<ul>
|
||
<li><strong>They work as usual.</strong> Each toolchain&rsquo;s commands, such as <code>npm i -g</code> (into <code>~/.npm-global</code>) or <code>go install</code> (into <code>~/go/bin</code>), work from any shell, including <code>bash -c</code> from agents and from editors over SSH. Global installs go into your home, as <a href="https://next.devvm.dev/docs/using/toolchains/">each toolchain&rsquo;s section</a> says.</li>
|
||
<li><strong>A project&rsquo;s own version files win.</strong> A toolchain&rsquo;s version files, such as <code>.nvmrc</code> for node, pick its version, which installs into the VM the first time it&rsquo;s used, and <a href="https://next.devvm.dev/docs/using/toolchains/">each toolchain&rsquo;s section</a> names its files. mise also reads a <code>mise.toml</code> in the project folder, and devvm trusts it without asking, because the folder is yours.</li>
|
||
<li><strong>They&rsquo;re read-only.</strong> A VM can&rsquo;t change the shared tools, even as root. The tools can&rsquo;t update themselves, and <code>rustup component add</code> can&rsquo;t change the shared toolchain.</li>
|
||
<li><strong>They&rsquo;re mounted, or the launch stops.</strong> When one of a VM&rsquo;s tools is missing or the VM can&rsquo;t mount it, devvm stops the launch and names the tool, and the VM never downloads its own copy in its place (<a href="https://next.devvm.dev/docs/using/troubleshooting/#a-shared-tool-doesnt-mount">a shared tool doesn&rsquo;t mount</a>). Only the versions that a project&rsquo;s own version files pick install into the VM.</li>
|
||
</ul>
|
||
<p>devvm doesn&rsquo;t pin the tools&rsquo; versions, because agents like Claude Code release several times a week. It follows the newest release of each tool, with Node 24 for node and opencode 2 for opencode. The first time a tool is needed, devvm looks up its newest release, which needs this machine to be online once. When it makes a new VM, devvm also checks for newer releases if its last check was more than a day ago, and <code>DEVVM_NO_TOOL_CHECK=1</code> turns that check off.</p>
|
||
<p>A new VM gets the tools chosen for it when devvm makes it, and keeps those versions. <code>devvm tools</code> shows them, and in a terminal lets you choose them. <code>devvm tools add</code>, <code>devvm tools rm</code> and <code>devvm tools update</code> change them too, as does the first step of <code>devvm update</code>, and changing them never changes the VM&rsquo;s disk (<a href="https://next.devvm.dev/docs/using/toolchains/#adding-and-removing-tools">adding and removing tools</a>).</p>
|
||
<h2 data-hextra-search-id="rebuilding">Rebuilding<span class="hx:absolute hx:-mt-20" id="rebuilding"></span>
|
||
<a href="#rebuilding" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When you edit a layer&rsquo;s script, devvm builds that layer again the next time it&rsquo;s used, together with every layer built on it, and it reuses the layers below. A new choice of base&rsquo;s features rebuilds base and everything on it in the same way. To build an image again yourself:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm rebuild base <span class="c1"># base again from the newest packages (on Lima, the newest cloud image too)</span>
|
||
</span></span><span class="line"><span class="cl">devvm rebuild docker <span class="c1"># the docker layer again, on base as it is now</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm rebuild IMAGE</code> builds an image again from its parent as the parent is now, where IMAGE is base or a stack of layers, such as <code>docker</code> or <code>foo+bar</code>. That&rsquo;s how you get the newest packages that a script installs without a pin. On Lima, <code>devvm rebuild base</code> also starts base again from the newest release of Ubuntu&rsquo;s cloud image, which devvm otherwise picks only the first time it builds base on this machine. devvm also builds the images on it again, on the new image, the next time they&rsquo;re needed. When there are such images, devvm lists them first and, in a terminal, asks before it goes on. After the build, devvm deletes the old images that no VM uses.</p>
|
||
<p>Shared tools aren&rsquo;t images, so <code>devvm rebuild</code> refuses a shared tool&rsquo;s name, and <code>devvm update</code> and <code>devvm tools update</code> get their newer versions. <a href="https://next.devvm.dev/docs/internals/images/#rebuilding">Rebuilding</a> explains how devvm tells which images to build again.</p>
|
||
<h2 data-hextra-search-id="outdated-vms">Outdated VMs<span class="hx:absolute hx:-mt-20" id="outdated-vms"></span>
|
||
<a href="#outdated-vms" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A VM keeps the image it was made from. When that image, or one it&rsquo;s built on, changes after an edited script, another choice of base&rsquo;s features or a <a href="#rebuilding">rebuild</a>, the VM is outdated. devvm then warns on each launch, names the images that changed and <code>devvm update</code>, and leaves the VM as it is.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm update <span class="c1"># move the VM to the newest shared tools, and to its image&#39;s new build after asking</span>
|
||
</span></span><span class="line"><span class="cl">devvm update --force <span class="c1"># the same without asking, as a script must</span>
|
||
</span></span><span class="line"><span class="cl">devvm update --clean-home <span class="c1"># the same, with the new image&#39;s home folder</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm update</code> brings this folder&rsquo;s VM up to date in two steps:</p>
|
||
<ol>
|
||
<li>It moves the VM to the newest shared tools, as <code>devvm tools update</code> does, and that needs no question, because the shared tools aren&rsquo;t part of the image and nothing on the VM&rsquo;s disk changes (<a href="https://next.devvm.dev/docs/using/toolchains/#adding-and-removing-tools">adding and removing tools</a>).</li>
|
||
<li>When the VM is outdated, devvm makes it again from its own image as it builds now, with the same layers, in the same way that <code>devvm layer add</code> makes a VM again with more layers. devvm builds the image first, then gives the VM a new disk copied from it, and keeps its home folder, the project folder and its settings (<a href="#what-a-vm-made-again-keeps">what a VM made again keeps</a>). Everything else on its disk is lost, such as the packages you installed with apt and Docker&rsquo;s images, so in a terminal devvm names the images that changed and asks first, with no as the default.</li>
|
||
</ol>
|
||
<p>When the folder&rsquo;s <code>devcontainer.json</code> changed since devvm made the VM, or is gone, or has appeared, devvm also makes the VM again, after asking, as the file says now (<a href="https://next.devvm.dev/docs/using/devcontainer/#updating-a-vm-from-the-file">updating a VM from the file</a>).</p>
|
||
<p>What <code>devvm update</code> does in each case:</p>
|
||
<ul>
|
||
<li>When only the shared tools are newer, devvm moves the VM to them and opens a shell in it without asking, because newer tools don&rsquo;t need the VM made again.</li>
|
||
<li>When you answer no, devvm keeps the VM with any newer shared tools it moved to, and opens a shell in it if there were some.</li>
|
||
<li>Without a terminal, devvm refuses an outdated VM unless you give <code>--force</code>, and it refuses before it changes anything, the VM&rsquo;s shared tools included.</li>
|
||
<li>When the VM has the newest shared tools and nothing it was made from has changed, devvm says that the VM is current and changes nothing. To make a current VM again with the newest packages that a script installs without a pin, run <code>devvm rebuild</code> on its image first, which makes the VM outdated, then <code>devvm update</code> (<a href="#rebuilding">rebuilding</a>).</li>
|
||
<li>For a VM made with <code>--from</code>, devvm tells whether the VM is outdated from the digest it last recorded, without looking anything up, so a moved tag shows only once a build has looked it up. When devvm makes the VM again, a tag that has moved gives the VM the container image&rsquo;s newer version, and a pinned digest stays as it is (<a href="https://next.devvm.dev/docs/using/from/#tags-and-digests">tags and digests</a>, <a href="https://next.devvm.dev/docs/internals/images/#digests">digests</a>).</li>
|
||
</ul>
|
||
<p><code>devvm update</code> takes the same flags as <code>devvm layer add</code>, and it refuses the same VMs, before it changes anything: a <code>--clone</code> VM, one whose creation didn&rsquo;t finish, and one whose backend can&rsquo;t run its layers. It exports the agents&rsquo; history first unless you give <code>--no-export</code>, and <code>--clean-home</code> gives the VM the new image&rsquo;s home folder instead of its own. In a subfolder of a folder with a VM, devvm asks in a terminal whether to make that folder&rsquo;s VM again, and refuses without one. The steps, and what happens when one fails, are those of <a href="#adding-layers-to-a-vm">adding layers to a VM</a>.</p>
|
||
<p><code>devvm tools update</code> moves the VM to newer shared tools alone, and it never makes the VM again, even when the VM is outdated (<a href="https://next.devvm.dev/docs/using/toolchains/#adding-and-removing-tools">adding and removing tools</a>).</p>
|
||
<h2 data-hextra-search-id="listing-images">Listing images<span class="hx:absolute hx:-mt-20" id="listing-images"></span>
|
||
<a href="#listing-images" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>devvm images</code> prints two tables, each with a header, and it shows what a row lacks as <code>-</code>. The first table lists the images by name, with unfinished builds last:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Column</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>IMAGE</code></td>
|
||
<td>its name, such as <code>base</code> or <code>foo+bar</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>FROM</code></td>
|
||
<td>what its base started from: the <code>--from</code> image, or Ubuntu&rsquo;s cloud image with its release&rsquo;s date, <code>ubuntu 26.04 (20261001)</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>DIGEST</code></td>
|
||
<td>the first 12 hex digits of that image&rsquo;s SHA-256</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>KEY</code></td>
|
||
<td>its key, which <code>devvm images rm</code> also takes</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>STATE</code></td>
|
||
<td><code>current</code>, <code>stale</code> when what it&rsquo;s built from has changed since it was built, <code>unfinished</code> for a build that didn&rsquo;t finish, or <code>building</code> while another devvm builds it</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>SIZE</code></td>
|
||
<td>the disk it takes, in powers of 1024 (<code>2.1G</code>). On macOS an image is a clone of its parent&rsquo;s disk, and the blocks they share count for both</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>The second table lists the <a href="#shared-tools">shared tools</a> that devvm has built, by the name you choose them by, such as <code>node</code> for node, pnpm and bun. The toolchains come first, then the agents, with each tool&rsquo;s versions newest first:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Column</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>NAME</code></td>
|
||
<td>a <a href="https://next.devvm.dev/docs/using/toolchains/">toolchain</a>&rsquo;s name, such as <code>node</code>, or an agent&rsquo;s, such as <code>claude</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>TOOL</code>, <code>VERSION</code></td>
|
||
<td>the tool and its version</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>LIBC</code></td>
|
||
<td>the C library (<code>gnu</code>, or <code>musl</code> for an Alpine base) that this build is for, because each gets a build of its own, or <code>-</code> when devvm can&rsquo;t tell</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>SIZE</code></td>
|
||
<td>the disk it takes</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>VMS</code></td>
|
||
<td>how many VMs have it</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>STATE</code></td>
|
||
<td><code>current</code> for the version new VMs get, <code>in use</code> for another version a VM has, <code>unused</code> for neither, <code>not built</code> for the current version of a tool devvm has other versions of, and <code>not installed</code> when devvm has no version of it</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>After the tables, devvm says on stderr how many images are stale or unfinished and how much disk the unused tools take, when there are any. It ends with the disk that the images and shared tools take together, and when the <a href="https://next.devvm.dev/docs/using/toolchains/#nix-projects">shared Nix cache</a> holds anything, the disk it takes of its cap. <code>devvm space</code> shows the rest of what devvm keeps (<a href="https://next.devvm.dev/docs/using/space/#devvm-space">what devvm keeps</a>).</p>
|
||
<h3 data-hextra-search-id="devvm-images-json">devvm images &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-images-json"></span>
|
||
<a href="#devvm-images-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm images --json</code> prints the same as one JSON object, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes, and devvm still says the same on stderr. <code>images</code> and <code>tools</code> have the tables&rsquo; columns as fields, with sizes in bytes, and a value an image lacks, such as an unfinished build&rsquo;s name, is <code>&quot;&quot;</code>. These fields go beyond the tables:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Field</th>
|
||
<th>What it holds</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>backend</code></td>
|
||
<td>the <a href="https://next.devvm.dev/docs/backends/">backend</a> that has the image or built the tool, <code>lima</code>. Only a built tool has it</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>digest</code></td>
|
||
<td>an image&rsquo;s full SHA-256 of what its base started from</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>sized</code></td>
|
||
<td>whether devvm knows an image&rsquo;s size</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>built</code></td>
|
||
<td>whether devvm has built a tool image. Only a built one has <code>backend</code> and <code>libc</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>total</code></td>
|
||
<td>the disk the images and shared tools take together</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>unused_tools</code></td>
|
||
<td>the part the unused tool images take</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>nix_cache</code></td>
|
||
<td>the shared Nix cache&rsquo;s files, the disk they take and its cap</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;images&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;base&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;from&#34;</span><span class="p">:</span> <span class="s2">&#34;ubuntu 26.04 (20261001)&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;digest&#34;</span><span class="p">:</span> <span class="s2">&#34;sha256:8eb876c2ccc4b6ff89e4a65d511815923b285e04503ba465809bf587f763da24&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;key&#34;</span><span class="p">:</span> <span class="s2">&#34;7a76021c46ef&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;state&#34;</span><span class="p">:</span> <span class="s2">&#34;current&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;size&#34;</span><span class="p">:</span> <span class="mi">2254857830</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;sized&#34;</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;backend&#34;</span><span class="p">:</span> <span class="s2">&#34;lima&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;tools&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;node&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;tool&#34;</span><span class="p">:</span> <span class="s2">&#34;node&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="s2">&#34;24.11.0&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;built&#34;</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;backend&#34;</span><span class="p">:</span> <span class="s2">&#34;lima&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;libc&#34;</span><span class="p">:</span> <span class="s2">&#34;gnu&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;size&#34;</span><span class="p">:</span> <span class="mi">125829120</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;vms&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;state&#34;</span><span class="p">:</span> <span class="s2">&#34;current&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;total&#34;</span><span class="p">:</span> <span class="mi">2380686950</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;unused_tools&#34;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;nix_cache&#34;</span><span class="p">:</span> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;files&#34;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;size&#34;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;cap&#34;</span><span class="p">:</span> <span class="mi">10737418240</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="deleting-images">Deleting images<span class="hx:absolute hx:-mt-20" id="deleting-images"></span>
|
||
<a href="#deleting-images" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm images rm IMAGE|KEY...</code> deletes images. You name each one by its name or by the key that <code>devvm images</code> shows:</p>
|
||
<ul>
|
||
<li>A name means its image as it is now, on base from <code>--from</code> when you give it. A stale or unfinished image has only its key.</li>
|
||
<li>Each image must be built, or devvm deletes nothing. Shared tools aren&rsquo;t images, so devvm refuses a name that has one, such as <code>node+foo</code>, and <code>devvm gc</code> deletes the shared tools no VM has.</li>
|
||
<li>devvm also deletes nothing while another devvm is building one of the images, so run the command again once that build ends. <code>devvm gc</code> and <code>devvm rebuild</code> leave such an image alone too.</li>
|
||
<li>A deleted image is built again the next time it&rsquo;s needed. VMs made from it keep working, because on macOS they&rsquo;re clones of its disk. On Linux hosts, devvm refuses to delete an image whose disk VMs are overlays of, and names those VMs.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="cleaning-up">Cleaning up<span class="hx:absolute hx:-mt-20" id="cleaning-up"></span>
|
||
<a href="#cleaning-up" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm gc <span class="c1"># stale and unfinished images, unused tools, old mise, the Nix cache over its cap</span>
|
||
</span></span><span class="line"><span class="cl">devvm gc --tool-images node <span class="c1"># also node&#39;s current builds that no VM has</span>
|
||
</span></span><span class="line"><span class="cl">devvm gc --history --older-than 30d <span class="c1"># also the history exports written 30 days ago or more</span>
|
||
</span></span><span class="line"><span class="cl">devvm gc --orphans <span class="c1"># also what&#39;s left of VMs deleted outside devvm</span>
|
||
</span></span><span class="line"><span class="cl">devvm gc --caches <span class="c1"># also devvm&#39;s share of Lima&#39;s caches</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm gc</code> deletes four things:</p>
|
||
<ol>
|
||
<li>what <code>devvm images</code> lists as stale or unfinished</li>
|
||
<li>the shared tools it lists as <code>unused</code></li>
|
||
<li>the older versions of the mise that devvm runs on this machine to look up the tools&rsquo; versions, which an upgrade of devvm leaves behind, except one that changed in the last hour, because another devvm may be downloading it</li>
|
||
<li>the <a href="https://next.devvm.dev/docs/using/toolchains/#nix-projects">shared Nix cache</a>&rsquo;s least recently used files, while it takes more than its cap, the <code>nix-cache.size</code> <a href="https://next.devvm.dev/docs/using/settings/#retention">retention setting</a>, which is 10 GiB when it&rsquo;s off</li>
|
||
</ol>
|
||
<p>devvm&rsquo;s mise and the shared Nix cache are both in <code>cache/</code> in <a href="https://next.devvm.dev/docs/using/space/#devvms-data-folder">devvm&rsquo;s data folder</a>, which holds only what devvm makes again when it needs it, so you can also delete that folder yourself at any time. gc lists them all first and, in a terminal, asks. Without a terminal, it deletes nothing unless you give <code>--force</code>, which deletes without asking, in a terminal too. Its flags do more:</p>
|
||
<ul>
|
||
<li><code>devvm gc --tool-images</code> also deletes the current shared tools that no VM has, such as a toolchain you tried once, for every C library. <code>devvm gc --tool-images node claude</code> deletes only those tools&rsquo; builds, by the names you choose them by, so <code>node</code> also covers pnpm and bun. A tool that a VM&rsquo;s state lists stays, including a stopped VM&rsquo;s, and a tool that no VM has goes however recently it was built.</li>
|
||
<li>While devvm is making a VM, or giving one new shared tools through <code>devvm tools add</code> or <code>devvm tools update</code>, gc keeps every current shared tool that no VM has, names them, and deletes the rest of what it would, so run it again once that&rsquo;s done. A devvm that starts to make a VM meanwhile waits for gc and says so, and in a terminal, gc makes it wait while gc asks you, so answer it first (<a href="https://next.devvm.dev/docs/internals/images/#listing-and-cleaning-up">listing and cleaning up</a>). A VM that has a deleted tool builds it again when it needs it.</li>
|
||
<li>When a shared tool that a new VM&rsquo;s state lists is gone before the VM&rsquo;s first shell, for example because you deleted it by hand, devvm names the tools it couldn&rsquo;t mount and stops, and the VM stays. Run <code>devvm tools update</code> in the folder, which builds the missing tools again and opens the VM (<a href="https://next.devvm.dev/docs/using/troubleshooting/#a-shared-tool-doesnt-mount">a shared tool doesn&rsquo;t mount</a>).</li>
|
||
<li><code>devvm gc --history</code> also deletes the <a href="https://next.devvm.dev/docs/using/coding-agents/#history">exports</a> of agents&rsquo; history that <code>devvm history export</code> and <code>devvm rm</code> saved, which are the only copy of a deleted VM&rsquo;s history, and <code>--older-than DURATION</code> keeps those newer than that <a href="https://next.devvm.dev/docs/using/command-line/#flags-and-values">duration</a>, such as <code>12h</code>, <code>30d</code> or <code>2w</code>. gc never deletes exports without <code>--history</code>.</li>
|
||
<li><code>devvm gc --nix-cache</code> also deletes the rest of the shared Nix cache. VMs download its packages again when they need them.</li>
|
||
<li><code>devvm gc --orphans</code> also deletes what devvm keeps for VMs that their backend no longer has, such as one you deleted with <code>limactl delete</code> instead of <code>devvm rm</code>, and with it the hold their state has on their shared tools (<a href="https://next.devvm.dev/docs/using/space/#leftovers-of-a-vm-deleted-outside-devvm">leftovers</a>).</li>
|
||
<li><code>devvm gc --caches</code> then frees devvm&rsquo;s share of Lima&rsquo;s own caches, such as its downloads of Ubuntu&rsquo;s cloud image, after asking, or without asking with <code>--force</code>, which it needs without a terminal (<a href="https://next.devvm.dev/docs/using/space/#limas-caches">Lima&rsquo;s caches</a>).</li>
|
||
<li><code>devvm gc --retention</code> then applies the <a href="https://next.devvm.dev/docs/using/settings/#retention">retention settings</a> at once, which devvm otherwise applies at most once a day. They&rsquo;re all off until you set them.</li>
|
||
<li>When Lima can&rsquo;t list its images while one of your VMs uses it, for example because Lima isn&rsquo;t installed, gc warns and leaves Lima&rsquo;s images, shared tools, VM leftovers and caches alone. It also leaves the shared tools whose record doesn&rsquo;t name the backend that built them, because they may be Lima&rsquo;s. gc still succeeds, so run <code>devvm doctor</code> to see what&rsquo;s wrong with Lima, then run gc again once it answers. <code>devvm images</code> fails instead, because it lists all the images or none.</li>
|
||
<li>gc never deletes your VMs, and it keeps current images, which <code>devvm images rm</code> deletes (<a href="#deleting-images">deleting images</a>). It does delete, without asking, the build VMs that a killed or failed tools build left, which hold nothing of yours, and it names each one (<a href="https://next.devvm.dev/docs/using/space/#vms-devvm-has-no-state-for">VMs devvm has no state for</a>). Without <code>--tool-images</code> it keeps the current shared tools. It always keeps every shared tool that any VM has, including a stopped VM&rsquo;s and that of a VM deleted outside devvm whose state is left, until <code>--orphans</code> deletes that state.</li>
|
||
<li>On Linux hosts, a stale image whose disk VMs are overlays of stays, and devvm says which VMs use it.</li>
|
||
<li>After an Alpine VM is gone, the shared tools built for Alpine are unused, unless you give gc that <code>--from</code>.</li>
|
||
</ul>
|
||
<p><a href="https://next.devvm.dev/docs/internals/images/#listing-and-cleaning-up">Images and caching</a> has the details of what counts as current and unused. To see what gc would free before you run it, and what takes the rest of the space, run <code>devvm space</code> (<a href="https://next.devvm.dev/docs/using/space/#devvm-space">what devvm keeps</a>).</p></description></item><item><title>Customizing images</title><link>https://next.devvm.dev/docs/using/customizing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/customizing/</guid><description>
|
||
<p>You customize images with your own layers, which add what a project needs, and by choosing base&rsquo;s features, which are devvm&rsquo;s optional extras that every VM gets. Your layers live in <code>~/.config/devvm</code> (<code>$XDG_CONFIG_HOME/devvm</code>), not next to devvm&rsquo;s binary, so upgrading devvm keeps them. To give every new VM something of your own, write it as a layer and make it one of the layers new VMs get (<a href="#extras-of-your-own">extras of your own</a>).</p>
|
||
<h2 data-hextra-search-id="your-own-layers">Your own layers<span class="hx:absolute hx:-mt-20" id="your-own-layers"></span>
|
||
<a href="#your-own-layers" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm layer new mailpit <span class="c1"># writes ~/.config/devvm/layers/mailpit.sh and mailpit.policy</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nv">$EDITOR</span> ~/.config/devvm/layers/mailpit.sh
|
||
</span></span><span class="line"><span class="cl">devvm --layers mailpit <span class="c1"># a new VM with your layer; or devvm build mailpit</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>When you customize a new VM, its list also shows your layers under Layers, so you can choose <code>mailpit</code> there instead of giving <code>--layers</code> (<a href="https://next.devvm.dev/docs/using/images/#what-a-new-vm-gets">what a new VM gets</a>). To give every new VM your layer, choose it with <code>devvm setup --layers mailpit</code>, or add it to the <code>layers</code> key in <code>config.toml</code> (<a href="https://next.devvm.dev/docs/using/settings/#layers-for-new-vms">layers for new VMs</a>). When you delete a layer&rsquo;s script that you chose there, new VMs are made without it, and devvm warns you.</p>
|
||
<p>A <a href="https://next.devvm.dev/docs/using/images/#layers">layer</a> is a script, <code>~/.config/devvm/layers/&lt;name&gt;.sh</code>, that bash runs once as the VM&rsquo;s user, who has sudo, in an image on top of its parent. <code>devvm layer new NAME</code> writes a starter script, and also <code>NAME.policy</code> next to it unless that file exists. It refuses to overwrite a script that exists.</p>
|
||
<ul>
|
||
<li><strong>Names</strong> are made of lowercase letters, digits and dashes, and start with a letter or digit. A name can&rsquo;t be <code>base</code>, a <a href="https://next.devvm.dev/docs/using/images/#built-in-layers">built-in layer&rsquo;s</a> name (<code>desktop</code>, <code>docker</code> or <code>nix</code>) or a shared tool&rsquo;s name (<code>node</code>, <code>claude</code> and so on). A command&rsquo;s name, such as <code>log</code>, is fine, because devvm takes layers only through <code>--layers</code>, the list and image names.</li>
|
||
<li>Built-in layers go in the same image names as yours, bottom first, as in <code>devvm --layers docker,mailpit</code>, which makes the image <code>docker+mailpit</code>.</li>
|
||
<li>Put interactive shell setup in <code>~/.bashrc.d/&lt;name&gt;.sh</code>, which every VM&rsquo;s <code>~/.bashrc</code> reads, and PATH changes in <code>~/.profile</code>.</li>
|
||
<li>Download files with <code>devvm-fetch URL SHA256 OUT</code>, which <code>base</code> installs. It tries a download that was cut or stalled again from where it stopped, and it fails when the file&rsquo;s checksum doesn&rsquo;t match (<a href="https://next.devvm.dev/docs/internals/images/#building">building</a>).</li>
|
||
<li>devvm runs a line of its own in place of your script&rsquo;s <code>#!</code> line, which gives it <code>$devvm_arch</code>, the VM&rsquo;s architecture as <code>arm64</code> or <code>amd64</code>, <code>$devvm_libc</code>, which is <code>musl</code> on Alpine and <code>gnu</code> elsewhere, and <code>devvm_sha TOOL</code>, which prints the checksum you pinned for this VM, as the <a href="#example-mailpit">example</a> shows. Names that start with <code>devvm_</code> are devvm&rsquo;s, and one your script sets is your script&rsquo;s from then on. Bash&rsquo;s errors give your file&rsquo;s own line numbers, or one more without a <code>#!</code> line (<a href="https://next.devvm.dev/docs/internals/images/#the-scripts-prelude">the prelude</a>).</li>
|
||
<li><code>NAME.policy</code> lists the hosts that VMs with the layer can reach on the <a href="https://next.devvm.dev/docs/safety/network/#allowlists">allowlist tier</a>, one rule per line.</li>
|
||
<li>Editing the script rebuilds its image, and the ones built on it, the next time they&rsquo;re used (<a href="https://next.devvm.dev/docs/using/images/#rebuilding">rebuilding</a>).</li>
|
||
<li>A layer&rsquo;s script changes the VM&rsquo;s disk, so <code>devvm layer add mailpit</code> gives a VM you have the layer by making the VM again, keeping its home folder and settings (<a href="https://next.devvm.dev/docs/using/images/#adding-layers-to-a-vm">adding layers to a VM</a>), and <code>devvm layer rm mailpit</code> takes it out again in the same way (<a href="https://next.devvm.dev/docs/using/images/#taking-layers-out-of-a-vm">taking layers out of a VM</a>).</li>
|
||
</ul>
|
||
<p>To edit layers with an agent in a VM, keep them in a repo of their own and copy them in, because devvm refuses a VM for a folder inside <code>~/.config/devvm</code> (<a href="https://next.devvm.dev/docs/internals/security/#only-the-project-folder">details</a>).</p>
|
||
<h3 data-hextra-search-id="example-mailpit">Example: mailpit<span class="hx:absolute hx:-mt-20" id="example-mailpit"></span>
|
||
<a href="#example-mailpit" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>This layer installs <a href="https://mailpit.axllent.org/" target="_blank" rel="noopener">Mailpit</a>, which catches the emails your app sends while you develop it, and starts it with the VM. Point your app&rsquo;s SMTP settings at <code>localhost:1025</code>, and read the emails at <code>localhost:8025</code> in your browser, because devvm <a href="https://next.devvm.dev/docs/using/ports-size/#ports">forwards</a> both ports to your machine. Put these lines in <code>~/.config/devvm/layers/mailpit.sh</code>, below the starter&rsquo;s <code>set -euo pipefail</code>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">mailpit_version</span><span class="o">=</span>1.32.0
|
||
</span></span><span class="line"><span class="cl"><span class="nv">mailpit_sha256_amd64</span><span class="o">=</span>4b5993c978e8604c70d43927e2ad103b311bba3b1822fa0cf1d4ee4ec890a93c
|
||
</span></span><span class="line"><span class="cl"><span class="nv">mailpit_sha256_arm64</span><span class="o">=</span>e1e45d1dc72bd497fb262a1e4100178eee057c42c5fc36d143eb8621769e1137
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl">devvm-fetch <span class="s2">&#34;https://github.com/axllent/mailpit/releases/download/v</span><span class="nv">$mailpit_version</span><span class="s2">/mailpit-linux-</span><span class="nv">$devvm_arch</span><span class="s2">.tar.gz&#34;</span> <span class="se">\
|
||
</span></span></span><span class="line"><span class="cl"> <span class="s2">&#34;</span><span class="k">$(</span>devvm_sha mailpit<span class="k">)</span><span class="s2">&#34;</span> /tmp/mailpit.tar.gz
|
||
</span></span><span class="line"><span class="cl">sudo tar -xzf /tmp/mailpit.tar.gz -C /usr/local/bin mailpit
|
||
</span></span><span class="line"><span class="cl">rm /tmp/mailpit.tar.gz
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl"><span class="nb">printf</span> <span class="s1">&#39;%s\n&#39;</span> <span class="s1">&#39;[Unit]&#39;</span> <span class="s1">&#39;Description=Mailpit&#39;</span> <span class="s1">&#39;[Service]&#39;</span> <span class="s1">&#39;ExecStart=/usr/local/bin/mailpit&#39;</span> <span class="se">\
|
||
</span></span></span><span class="line"><span class="cl"> <span class="s1">&#39;DynamicUser=yes&#39;</span> <span class="s1">&#39;[Install]&#39;</span> <span class="s1">&#39;WantedBy=multi-user.target&#39;</span> <span class="p">|</span>
|
||
</span></span><span class="line"><span class="cl"> sudo tee /etc/systemd/system/mailpit.service &gt;/dev/null
|
||
</span></span><span class="line"><span class="cl">sudo systemctl <span class="nb">enable</span> --now mailpit</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>The version and each download&rsquo;s SHA-256 sit at the top, so <code>devvm-fetch</code> refuses a download that doesn&rsquo;t match. <code>$devvm_arch</code> names the VM&rsquo;s build in the address, and <code>devvm_sha mailpit</code> picks the matching pin, <code>mailpit_sha256_arm64</code> or <code>mailpit_sha256_amd64</code>, or names the pin the script lacks, so the download fails. On Alpine, it takes <code>mailpit_sha256_arm64_musl</code> instead when you pin one, for a tool with a separate musl build. To update Mailpit, change all three and rebuild the image. The downloads come from GitHub&rsquo;s releases, which <code>base</code>&rsquo;s allowlist has, so <code>mailpit.policy</code> can stay empty. On a base made <code>--from</code> an Alpine container image, start it with OpenRC (<code>rc-update</code>, <code>rc-service</code>) instead of systemd.</p>
|
||
<h2 data-hextra-search-id="base-image-features">Base image features<span class="hx:absolute hx:-mt-20" id="base-image-features"></span>
|
||
<a href="#base-image-features" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Features are optional extras that devvm builds into <a href="https://next.devvm.dev/docs/using/images/#base"><code>base</code></a> after base&rsquo;s own setup, so every VM has them.</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Feature</th>
|
||
<th>What it adds</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>omb</code></td>
|
||
<td><a href="https://ohmybash.github.io/" target="_blank" rel="noopener">oh-my-bash</a>: a themed prompt, completions and aliases, with auto-update off</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>fzf</code></td>
|
||
<td>fuzzy Ctrl-R history and Ctrl-T file search</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>cli-tools</code></td>
|
||
<td>bat, fd, eza, zoxide (<code>z</code>), btop, tree, tldr</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>The desktop that <a href="https://next.devvm.dev/docs/using/desktop/"><code>devvm desktop</code></a> opens isn&rsquo;t a feature but a <a href="https://next.devvm.dev/docs/using/images/#built-in-layers">built-in layer</a>, <code>desktop</code>, so only the VMs you choose it for get it.</p>
|
||
<h3 data-hextra-search-id="choosing-features">Choosing features<span class="hx:absolute hx:-mt-20" id="choosing-features"></span>
|
||
<a href="#choosing-features" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>On its first run, devvm asks which features <code>base</code> gets, after the size and coding agents that new VMs get and before it shows what the folder&rsquo;s new VM gets. devvm build and devvm rebuild ask too, until the features are chosen. The list starts with every feature chosen, and you choose in it as in <a href="https://next.devvm.dev/docs/using/images/#choosing-in-a-list">any of devvm&rsquo;s lists</a>. Without a terminal, devvm chooses every feature. devvm prints the choice and saves it, in the order the features run. When <code>features</code> in <a href="https://next.devvm.dev/docs/using/settings/#configtoml"><code>config.toml</code></a> chooses them, devvm doesn&rsquo;t ask.</p>
|
||
<p>To change the choice:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm setup <span class="c1"># asks again, starting from the current choice</span>
|
||
</span></span><span class="line"><span class="cl">devvm setup --features fzf,omb <span class="c1"># without asking</span>
|
||
</span></span><span class="line"><span class="cl">devvm setup --features none <span class="c1"># without asking, and base gets no features</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>In a terminal, <code>devvm setup</code> asks for the features among its other questions, which <a href="https://next.devvm.dev/docs/using/settings/#devvm-setup">devvm setup</a> lists in order. <code>--features</code> asks for none of the others. Without a terminal, <code>devvm setup</code> keeps the choice. devvm refuses a name that isn&rsquo;t a feature, and an empty <code>--features ''</code>, and then nothing changes. You can also choose them by hand with <code>features</code> in <code>config.toml</code>, such as <code>features = [&quot;fzf&quot;, &quot;omb&quot;]</code>, which wins over what <code>devvm setup</code> saved, and then <code>devvm setup --features</code> refuses to change them. <code>features = []</code> chooses none, and devvm skips a name without a script, with a warning.</p>
|
||
<p>A new choice makes <code>base</code> and the images built on it rebuild the next time they&rsquo;re used, and <code>devvm setup</code> says so. The old images are then stale, and <a href="https://next.devvm.dev/docs/using/images/#cleaning-up"><code>devvm gc</code></a> deletes them.</p>
|
||
<h3 data-hextra-search-id="extras-of-your-own">Extras of your own<span class="hx:absolute hx:-mt-20" id="extras-of-your-own"></span>
|
||
<a href="#extras-of-your-own" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Base&rsquo;s features are the ones in the table above, and devvm ships all of them. To give every new VM an extra of your own, such as your shell setup or a tool you always use, write it as a <a href="#your-own-layers">layer of your own</a> and choose it as one of the layers new VMs get:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm layer new dotfiles <span class="c1"># writes ~/.config/devvm/layers/dotfiles.sh</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nv">$EDITOR</span> ~/.config/devvm/layers/dotfiles.sh
|
||
</span></span><span class="line"><span class="cl">devvm setup --layers dotfiles <span class="c1"># every new VM gets it</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>A new VM&rsquo;s summary then shows <code>dotfiles</code>, and when you customize the VM, its list shows <code>dotfiles</code> under Layers, already chosen because devvm setup chose it, so you can leave it out of that VM (<a href="https://next.devvm.dev/docs/using/settings/#layers-for-new-vms">layers for new VMs</a>). A layer is an image built on top of base, so the images that have it are named with it, such as <code>dotfiles</code> or <code>docker+dotfiles</code>, and editing its script rebuilds only those images, never base.</p></description></item><item><title>Settings and files</title><link>https://next.devvm.dev/docs/using/settings/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/settings/</guid><description>
|
||
<p>devvm writes nothing into your project folders. It keeps the settings you edit in <code>~/.config/devvm</code> and everything it writes itself in <code>~/.local/share/devvm</code>, and it reads a few environment variables. <a href="#your-settings">Your settings</a> lists the files you edit, <a href="https://next.devvm.dev/docs/using/space/#devvms-data-folder">devvm&rsquo;s data folder</a> lists the ones devvm writes, and <a href="https://next.devvm.dev/docs/internals/overview/#state-files">Overview</a> explains how devvm keeps them.</p>
|
||
<h2 data-hextra-search-id="your-settings">Your settings<span class="hx:absolute hx:-mt-20" id="your-settings"></span>
|
||
<a href="#your-settings" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>~/.config/devvm</code> (<code>$XDG_CONFIG_HOME/devvm</code>) holds what you edit, and it&rsquo;s the only folder of devvm&rsquo;s that you should change by hand. devvm never rewrites a file of yours there. It reads <code>config.toml</code> and your own layers and CAs, it creates a new layer&rsquo;s files when you run <code>devvm layer new</code>, it changes single lines of <code>policy</code> when you add or remove a rule for every VM, and it writes <code>version</code> when the folder has none and when it changes its folders to a newer layout.</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>File</th>
|
||
<th>What it holds</th>
|
||
<th>Written by</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>config.toml</code></td>
|
||
<td>the defaults that new VMs get and the <a href="#retention">retention settings</a>, which win over what devvm&rsquo;s commands save, the <a href="https://next.devvm.dev/docs/safety/network/#behind-a-company-proxy">company proxy</a> and an <a href="#an-ubuntu-mirror">Ubuntu mirror</a> (<a href="#configtoml">config.toml</a>)</td>
|
||
<td>you</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>policy</code></td>
|
||
<td>your <a href="https://next.devvm.dev/docs/safety/network/#changing-rules">network rules</a> for every VM</td>
|
||
<td><code>devvm network allow -g</code>, <code>deny -g</code>, <code>rm -g</code>, or you</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>layers/</code></td>
|
||
<td>your own <a href="https://next.devvm.dev/docs/using/customizing/#your-own-layers">layers</a> and their allowlists</td>
|
||
<td><code>devvm layer new</code>, then you</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>agents/</code></td>
|
||
<td>your agents&rsquo; settings in <a href="https://next.devvm.dev/docs/using/coding-agents/#devvms-agent-store">devvm&rsquo;s agent store</a>, one folder for each agent</td>
|
||
<td><code>devvm agent import</code>, <code>devvm agent save</code>, or you</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>ca/</code></td>
|
||
<td>your <a href="#a-companys-ca">company&rsquo;s CA certificates</a>, which VMs and builds trust</td>
|
||
<td>you</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>version</code></td>
|
||
<td>the folder&rsquo;s <a href="https://next.devvm.dev/docs/using/troubleshooting/#a-newer-devvm-changed-devvms-folders">layout version</a>, which says how devvm keeps its files here</td>
|
||
<td>devvm, when it&rsquo;s missing or older</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>Edit the files in <code>~/.config/devvm</code>, and never edit the ones in <code>~/.local/share/devvm</code>. devvm writes those itself and rewrites them whole, so a change you make there can be lost, or can stop devvm from reading the file. To set a default by hand, put it in <code>config.toml</code> instead.</p>
|
||
<p>Upgrading devvm keeps this folder as it is. Back it up, such as in a dotfiles repo, to keep your settings and layers.</p>
|
||
<h2 data-hextra-search-id="configtoml">config.toml<span class="hx:absolute hx:-mt-20" id="configtoml"></span>
|
||
<a href="#configtoml" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>~/.config/devvm/config.toml</code> sets the defaults that new VMs get, the retention settings, the company proxy, an Ubuntu mirror, the release check, transparent mode, the API keys that VMs get as they are and the folders that <code>devvm agent import</code> follows links into, in a file you write by hand. devvm reads it and never writes it. Every key is optional, and devvm has no <code>config.toml</code> until you write one. This example sets every key:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="c"># The network tier new VMs get: open, internet, allowlist or none.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">network</span> <span class="p">=</span> <span class="s2">&#34;allowlist&#34;</span>
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl"><span class="c"># The ports new VMs forward: all, none, or ports and ranges.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">ports</span> <span class="p">=</span> <span class="s2">&#34;5173,8000-8010&#34;</span>
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl"><span class="c"># The features base gets, in the order they run, or [] for none.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">features</span> <span class="p">=</span> <span class="p">[</span><span class="s2">&#34;cli-tools&#34;</span><span class="p">,</span> <span class="s2">&#34;fzf&#34;</span><span class="p">,</span> <span class="s2">&#34;omb&#34;</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl"><span class="c"># The coding agents new VMs get, or [] for none.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">agents</span> <span class="p">=</span> <span class="p">[</span><span class="s2">&#34;claude&#34;</span><span class="p">,</span> <span class="s2">&#34;codex&#34;</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl"><span class="c"># The layers new VMs get, bottom first, or [] for none.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">layers</span> <span class="p">=</span> <span class="p">[</span><span class="s2">&#34;docker&#34;</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl"><span class="c"># A mirror of Ubuntu&#39;s archive that base&#39;s first build tries first.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">ubuntu-mirror</span> <span class="p">=</span> <span class="s2">&#34;http://mirror.example.com/ubuntu-ports&#34;</span>
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl"><span class="c"># Whether a launch checks once a day for a newer devvm release.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">release-check</span> <span class="p">=</span> <span class="kc">true</span>
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl"><span class="c"># Whether confined VMs send tools that ignore the proxy settings to their proxy.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">transparent-proxy</span> <span class="p">=</span> <span class="kc">true</span>
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl"><span class="c"># The folder in every VM that devvm paste puts images and files in.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">paste-dir</span> <span class="p">=</span> <span class="s2">&#34;/tmp/devvm-paste&#34;</span>
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl"><span class="c"># The folders devvm agent import follows links into without asking.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">follow-links</span> <span class="p">=</span> <span class="p">[</span><span class="s2">&#34;~/dotfiles&#34;</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl"><span class="c"># New VMs&#39; CPUs, and their memory and disk in GiB.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">[</span><span class="nx">size</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">cpus</span> <span class="p">=</span> <span class="mi">4</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">memory</span> <span class="p">=</span> <span class="mi">8</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">disk</span> <span class="p">=</span> <span class="mi">100</span>
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl"><span class="c"># What devvm deletes on its own, with the keys devvm retention takes.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">[</span><span class="nx">retention</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">logs</span><span class="p">.</span><span class="nx">runs</span> <span class="p">=</span> <span class="mi">20</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">history</span><span class="p">.</span><span class="nx">age</span> <span class="p">=</span> <span class="s2">&#34;90d&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">history</span><span class="p">.</span><span class="nx">count</span> <span class="p">=</span> <span class="mi">10</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">tools</span><span class="p">.</span><span class="nx">unused-age</span> <span class="p">=</span> <span class="s2">&#34;30d&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">orphans</span><span class="p">.</span><span class="nx">age</span> <span class="p">=</span> <span class="s2">&#34;30d&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">nix-cache</span><span class="p">.</span><span class="nx">size</span> <span class="p">=</span> <span class="s2">&#34;20G&#34;</span>
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl"><span class="c"># The company proxy, when the shell you run devvm in sets none.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">[</span><span class="nx">proxy</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">https</span> <span class="p">=</span> <span class="s2">&#34;http://[email protected]:8080&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">http</span> <span class="p">=</span> <span class="s2">&#34;http://[email protected]:8080&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">no-proxy</span> <span class="p">=</span> <span class="s2">&#34;localhost,.example.com&#34;</span>
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl"><span class="c"># Providers whose API keys an agent&#39;s VMs get as they are.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">[</span><span class="nx">pass-keys</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">opencode</span> <span class="p">=</span> <span class="p">[</span><span class="s2">&#34;ollama&#34;</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">pi</span> <span class="p">=</span> <span class="p">[</span><span class="s2">&#34;ollama&#34;</span><span class="p">]</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Each key takes what its command takes:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Key</th>
|
||
<th>What it takes</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>network</code></td>
|
||
<td>a tier, <code>open</code>, <code>internet</code>, <code>allowlist</code> or <code>none</code>, as <code>devvm network -g</code> sets it (<a href="https://next.devvm.dev/docs/safety/network/#choosing-a-tier">choosing a tier</a>), and never <code>learn</code>, because each VM <a href="https://next.devvm.dev/docs/safety/network/#learning-the-hosts-a-vm-needs">learns the hosts it needs</a> on its own</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>ports</code></td>
|
||
<td><code>all</code>, <code>none</code> or a list, as <code>devvm ports -g</code> takes it (<a href="https://next.devvm.dev/docs/using/ports-size/#size-and-ports">size and ports</a>)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>features</code></td>
|
||
<td>the <a href="https://next.devvm.dev/docs/using/customizing/#choosing-features">features</a> that base gets</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>agents</code></td>
|
||
<td>the <a href="#coding-agents-for-new-vms">coding agents</a> that new VMs get</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>layers</code></td>
|
||
<td>the <a href="#layers-for-new-vms">layers</a> that new VMs get, bottom first</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>cpus</code></td>
|
||
<td>a whole number, as <code>devvm size -g</code> takes it</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>memory</code>, <code>disk</code></td>
|
||
<td>a number of GiB, such as <code>8</code>, <code>8.5</code> or <code>&quot;8G&quot;</code>, as <code>devvm size -g</code> takes them</td>
|
||
</tr>
|
||
<tr>
|
||
<td>the <code>[retention]</code> keys</td>
|
||
<td>the <a href="#retention">retention settings</a>, with a duration such as <code>&quot;90d&quot;</code> or a size such as <code>&quot;20G&quot;</code> in quotes, and a count as a number</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>follow-links</code></td>
|
||
<td>the folders whose files <code>devvm agent import</code> copies through a link out of an agent&rsquo;s folder without asking, each an absolute path or one that starts with <code>~/</code> (<a href="https://next.devvm.dev/docs/using/coding-agents/#links-out-of-an-agents-folder">links out of an agent&rsquo;s folder</a>), which no command saves</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>The <code>[proxy]</code> table is the <a href="https://next.devvm.dev/docs/safety/network/#behind-a-company-proxy">company proxy</a> that every VM&rsquo;s proxy, builds and devvm&rsquo;s own downloads go through when the shell you run devvm in sets neither <code>HTTPS_PROXY</code> nor <code>HTTP_PROXY</code>, whatever the VM&rsquo;s tier. No VM gets the company proxy&rsquo;s settings itself. That shell&rsquo;s settings win over the whole table. <code>https</code> and <code>http</code> take what <code>HTTPS_PROXY</code> and <code>HTTP_PROXY</code> take, an <code>http://</code> URL or <code>host:port</code>, and <code>no-proxy</code> takes what <code>NO_PROXY</code> takes. A URL never holds a password, and devvm refuses one that does, so put only the user in it and save the password with <code>devvm secret set proxy</code>. No command saves the proxy, so it&rsquo;s only ever in <code>config.toml</code>.</p>
|
||
<p>The <code>[pass-keys]</code> table names, for an agent, the providers whose API keys its VMs get as they are, which devvm otherwise keeps on this machine because the VM&rsquo;s proxy can&rsquo;t put them in, such as a local model server&rsquo;s. Every VM with the agent gets a change at its next launch, and no command saves the table, so it&rsquo;s only ever in <code>config.toml</code>. This is what it takes and refuses:</p>
|
||
<ul>
|
||
<li>It takes <code>opencode</code> and <code>pi</code>, each with a list of the agent&rsquo;s provider IDs as its <code>auth.json</code> names them, in lower case, such as <code>[&quot;ollama&quot;]</code> (<a href="https://next.devvm.dev/docs/using/coding-agents/#codex-and-opencode-logins">opencode logins</a>, <a href="https://next.devvm.dev/docs/using/coding-agents/#pi-logins">pi logins</a>).</li>
|
||
<li>devvm refuses another agent, a name that isn&rsquo;t a provider&rsquo;s ID and a repeat (<code>config.toml</code> names the line).</li>
|
||
<li>A provider whose key the VM&rsquo;s proxy puts in (<a href="https://next.devvm.dev/docs/using/coding-agents/#api-keys-the-proxy-puts-in">API keys the proxy puts in</a>) never needs the table, because the proxy puts its key in without it. When the table lists one all the same, the VM gets that key&rsquo;s placeholder from its next launch on, not the key, and devvm notes at each launch that you can take the provider out. A VM that got such a key as it was before then may still hold copies of it, which keep working, so make a new key when you don&rsquo;t trust that VM (<a href="https://next.devvm.dev/docs/using/coding-agents/#api-keys-the-proxy-puts-in">API keys the proxy puts in</a>).</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="an-ubuntu-mirror">An Ubuntu mirror<span class="hx:absolute hx:-mt-20" id="an-ubuntu-mirror"></span>
|
||
<a href="#an-ubuntu-mirror" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">ubuntu-mirror</span> <span class="p">=</span> <span class="s2">&#34;http://mirror.example.com/ubuntu-ports&#34;</span> <span class="c"># in ~/.config/devvm/config.toml</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>ubuntu-mirror</code> is a mirror of Ubuntu&rsquo;s archive, such as one your company or university runs, which the first build of base gets its packages from before it tries Ubuntu&rsquo;s own. It must mirror the archive for this machine&rsquo;s architecture: <code>archive.ubuntu.com/ubuntu</code> on an Intel or AMD machine, or <code>ports.ubuntu.com/ubuntu-ports</code> on an Apple silicon Mac or another arm64 machine. Give it as an <code>http://</code> or <code>https://</code> address without a user, a query or spaces, and devvm refuses anything else (<code>config.toml</code> names the line). A package that the mirror doesn&rsquo;t have, or a mirror that doesn&rsquo;t answer, falls back to Ubuntu&rsquo;s archive for that file.</p>
|
||
<ul>
|
||
<li><strong>What it can&rsquo;t do:</strong> a mirror can&rsquo;t give base a package that Ubuntu didn&rsquo;t publish, because apt and devvm both check every list and package against Ubuntu&rsquo;s archive key. A mirror that&rsquo;s behind can still serve old lists, and devvm refuses lists more than a day older than the Ubuntu cloud image base starts from, names the mirror and keeps none of the build&rsquo;s packages (<a href="https://next.devvm.dev/docs/using/troubleshooting/#base-gets-old-package-lists">old package lists</a>). A mirror that fell behind after that image&rsquo;s date can still give base packages older than Ubuntu&rsquo;s, so set only a mirror you trust to keep up (<a href="https://next.devvm.dev/docs/internals/images/#bases-packages">base&rsquo;s packages</a>).</li>
|
||
<li><strong>What uses it:</strong> only the first build of each base, because a later build of the same base installs the packages devvm kept from that first build (<a href="https://next.devvm.dev/docs/using/images/#base">base</a>). VMs don&rsquo;t use it, and neither do layers or a <code>--from</code> base.</li>
|
||
<li><strong>Where it&rsquo;s set:</strong> no command saves it, so it&rsquo;s only ever in <code>config.toml</code>.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="the-paste-folder">The paste folder<span class="hx:absolute hx:-mt-20" id="the-paste-folder"></span>
|
||
<a href="#the-paste-folder" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>paste-dir</code> is the folder in every VM that <a href="https://next.devvm.dev/docs/using/coding-agents/#pasting-images">devvm paste</a> puts images, PDFs and copied files in, <code>/tmp/devvm-paste</code> unless you set it. Each launch makes the folder in the VM when it&rsquo;s missing, mode 700 and the VM&rsquo;s user&rsquo;s own. It leaves a folder that&rsquo;s there as it is, so a folder of your own, such as <code>/home/USER/pastes</code> where <code>USER</code> is your user in the VM, keeps its mode and its other files. A launch warns, and goes on, when:</p>
|
||
<ul>
|
||
<li>what&rsquo;s at the path is a symbolic link, isn&rsquo;t a folder or isn&rsquo;t the VM&rsquo;s user&rsquo;s, and devvm paste then refuses the folder;</li>
|
||
<li>it can&rsquo;t make the folder, as under a file.</li>
|
||
</ul>
|
||
<p>It&rsquo;s one fixed path for every VM so that you can allow it once in an agent&rsquo;s settings. Give it as an absolute path without a trailing slash, made of letters, digits and <code>.</code>, <code>_</code> and <code>-</code>, and devvm refuses anything else (<code>config.toml</code> names the line), because the path goes into a shell in the VM and onto your clipboard. A change applies to each VM at its next launch, which makes the new folder, and devvm paste uses the new folder at once. No command saves it, so it&rsquo;s only ever in <code>config.toml</code>.</p>
|
||
<h3 data-hextra-search-id="the-release-check">The release check<span class="hx:absolute hx:-mt-20" id="the-release-check"></span>
|
||
<a href="#the-release-check" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>When you run devvm in a terminal, it checks at most once a day for a newer devvm release, and when one is out it says so in one line before it opens the VM, naming the release, the version you have and devvm upgrade. devvm never installs anything on its own, so you upgrade with <a href="https://next.devvm.dev/docs/using/upgrading/#upgrading">devvm upgrade</a> when you choose to. <code>release-check = false</code> turns the check off, and so does setting <code>DEVVM_NO_RELEASE_CHECK=1</code> in the environment, as CI can. <code>release-check</code> must be <code>true</code> or <code>false</code>, and devvm refuses anything else (<code>config.toml</code> names the line). No command saves it, so it&rsquo;s only ever in <code>config.toml</code>.</p>
|
||
<p>The check never announces a prerelease, unless Homebrew&rsquo;s <code>devvm-rc</code> formula installed devvm, which follows prereleases and announces a newer prerelease or release, whichever is newest (<a href="https://next.devvm.dev/docs/using/upgrading/#trying-a-prerelease">trying a prerelease</a>). It never makes devvm wait, and <code>devvm doctor</code> shows what it found last. devvm says nothing without a terminal, with <code>--no-input</code>, for a devvm built from its source, or for a copy that neither the install script nor Homebrew installed, which devvm upgrade can&rsquo;t upgrade. <a href="https://next.devvm.dev/docs/internals/install/#the-release-check">The release check</a> explains what the check reads and when its line shows a new release.</p>
|
||
<h3 data-hextra-search-id="transparent-mode">Transparent mode<span class="hx:absolute hx:-mt-20" id="transparent-mode"></span>
|
||
<a href="#transparent-mode" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>On every tier but open, devvm sends a tool that ignores the proxy settings to the VM&rsquo;s proxy by the names it looks up, which is <a href="https://next.devvm.dev/docs/safety/network/#tools-that-ignore-the-proxy">transparent mode</a>. It&rsquo;s on unless you turn it off. <code>transparent-proxy = false</code> turns it off for every VM that has no setting of its own, and <code>devvm network transparent on</code> or <code>off</code> gives one VM its own, which comes first. A change applies at each VM&rsquo;s next launch. <code>transparent-proxy</code> must be <code>true</code> or <code>false</code>, and devvm refuses anything else (<code>config.toml</code> names the line). No command saves it, so it&rsquo;s only ever in <code>config.toml</code>.</p>
|
||
<h3 data-hextra-search-id="where-a-default-comes-from">Where a default comes from<span class="hx:absolute hx:-mt-20" id="where-a-default-comes-from"></span>
|
||
<a href="#where-a-default-comes-from" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>For each default, devvm uses the first of these that sets it:</p>
|
||
<ol>
|
||
<li>A flag for one VM, such as <code>--ports</code> or <code>--cpus</code>.</li>
|
||
<li><code>config.toml</code>.</li>
|
||
<li>What devvm&rsquo;s commands saved: <code>devvm setup</code>, <code>devvm size -g</code>, <code>devvm ports -g</code>, <code>devvm network -g</code> and <code>devvm retention</code> save in <code>~/.local/share/devvm/settings.json</code>.</li>
|
||
<li>devvm&rsquo;s own default.</li>
|
||
</ol>
|
||
<p>A command that would save a default that <code>config.toml</code> sets refuses, names the file and the key, and changes nothing, because the value in <code>config.toml</code> would still win. To change that default, edit it in <code>config.toml</code>, or delete it there to let devvm&rsquo;s commands set it again. In a terminal, <code>devvm setup</code> doesn&rsquo;t ask about what <code>config.toml</code> sets, and it says so.</p>
|
||
<p><code>devvm size -g</code>, <code>devvm ports -g</code>, <code>devvm network -g</code> and <code>devvm retention</code> show where each value came from, after a <code>#</code>. They show <code>config.toml</code>&rsquo;s path for a value from <code>config.toml</code>, <code>devvm: settings.json</code> for one that a command saved, and <code>devvm: default</code> for devvm&rsquo;s own:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ devvm ports -g
|
||
</span></span><span class="line"><span class="cl">5173,8000-8010 <span class="c1"># /Users/you/.config/devvm/config.toml</span>
|
||
</span></span><span class="line"><span class="cl">$ devvm network -g
|
||
</span></span><span class="line"><span class="cl">allowlist <span class="c1"># devvm: default</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>With <code>--json</code>, the same commands add <code>source</code>, or <code>sources</code> for each value of <code>devvm size -g</code> and <code>devvm retention</code>, which is <code>config.toml</code>, <code>settings.json</code> or <code>built-in</code>.</p>
|
||
<h3 data-hextra-search-id="when-devvm-cant-read-it">When devvm can&rsquo;t read it<span class="hx:absolute hx:-mt-20" id="when-devvm-cant-read-it"></span>
|
||
<a href="#when-devvm-cant-read-it" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>devvm reads all of <code>config.toml</code> each time it needs a default, and it checks every key and value. A key it doesn&rsquo;t know, such as a typo, a value that a key can&rsquo;t take, and a file that isn&rsquo;t TOML each stop the command, and devvm names the file and the line. Fix the line, and run the command again. <code>config.toml</code> has no key for the backend, because every new VM runs on <a href="https://next.devvm.dev/docs/backends/lima/">Lima</a>, so a <code>backend</code> key stops the command as an unknown key.</p>
|
||
<h2 data-hextra-search-id="devvm-setup">devvm setup<span class="hx:absolute hx:-mt-20" id="devvm-setup"></span>
|
||
<a href="#devvm-setup" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>devvm setup</code> chooses what new VMs get. In a terminal, it asks five questions, each starting from the current choice, and saves each answer in <code>~/.local/share/devvm/settings.json</code>, as the command for that setting saves it. It skips a question that <a href="#configtoml"><code>config.toml</code></a> answers, saying so, and it refuses a flag that would change what <code>config.toml</code> sets.</p>
|
||
<ol>
|
||
<li>The <a href="https://next.devvm.dev/docs/using/customizing/#choosing-features">features</a> that base gets.</li>
|
||
<li>The <a href="https://next.devvm.dev/docs/using/ports-size/#choosing-new-vms-size">CPUs and memory</a> that new VMs get, as <code>devvm size -g</code> saves them.</li>
|
||
<li>The <a href="https://next.devvm.dev/docs/safety/network/#network-tiers">network tier</a> that new VMs get, as <code>devvm network -g</code> saves it: <code>open</code>, <code>internet</code>, <code>allowlist</code>, which is the default, or <code>none</code>. Each new VM&rsquo;s summary shows that tier, and when you customize the VM in a terminal, devvm asks for its tier, with Enter keeping the one the summary showed (<a href="https://next.devvm.dev/docs/using/images/#what-a-new-vm-gets">what a new VM gets</a>). <code>--network TIER</code> chooses for one VM and wins over the saved choice.</li>
|
||
<li>The <a href="#coding-agents-for-new-vms">coding agents</a> that new VMs get.</li>
|
||
<li>The <a href="#layers-for-new-vms">layers</a> that new VMs get.</li>
|
||
</ol>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm setup <span class="c1"># asks all five questions</span>
|
||
</span></span><span class="line"><span class="cl">devvm setup --features fzf,omb <span class="c1"># base&#39;s features, without asking</span>
|
||
</span></span><span class="line"><span class="cl">devvm setup --features none <span class="c1"># base gets no features</span>
|
||
</span></span><span class="line"><span class="cl">devvm setup --agents claude,codex <span class="c1"># new VMs&#39; coding agents, without asking</span>
|
||
</span></span><span class="line"><span class="cl">devvm setup --layers docker <span class="c1"># new VMs&#39; layers, without asking</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm setup</code> has three flags of its own, and each one chooses without asking anything. <code>--features LIST</code> chooses base&rsquo;s features, as a comma-separated list or <code>none</code> for none, and devvm refuses an empty <code>--features ''</code>. <code>--agents LIST</code> chooses new VMs&rsquo; coding agents in the same way, and <code>--layers LIST</code> chooses new VMs&rsquo; layers. With any of the flags, what the flags leave out stays as it is. Without a terminal and without flags, <code>devvm setup</code> asks nothing and keeps base&rsquo;s features, saving every feature when none was chosen yet. To change new VMs&rsquo; size without asking, use <code>devvm size -g</code> (<a href="https://next.devvm.dev/docs/using/ports-size/#choosing-new-vms-size">choosing new VMs&rsquo; size</a>), and to change their network tier, use <code>devvm network -g</code> (<a href="https://next.devvm.dev/docs/safety/network/#choosing-a-tier">choosing a tier</a>).</p>
|
||
<h3 data-hextra-search-id="coding-agents-for-new-vms">Coding agents for new VMs<span class="hx:absolute hx:-mt-20" id="coding-agents-for-new-vms"></span>
|
||
<a href="#coding-agents-for-new-vms" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>The coding agents you choose in <code>devvm setup</code> are the ones a new VM gets unless you choose others for it. The summary devvm shows before it makes the VM names each of them as coming from devvm setup, and when you customize the VM, they&rsquo;re checked in the list (<a href="https://next.devvm.dev/docs/using/images/#what-a-new-vm-gets">what a new VM gets</a>). <code>--agents</code> chooses others for one VM. The choice is for new VMs only, so a VM that exists keeps its agents, and <code>devvm tools</code> changes them.</p>
|
||
<p>devvm asks for them on its first run in a terminal, together with the size and base&rsquo;s features, until you&rsquo;ve chosen them. Until then, and when you choose <code>none</code>, new VMs get no agents by default. <code>devvm setup --agents claude,codex</code> and <code>devvm setup --agents none</code> choose them without asking, and devvm refuses a name that isn&rsquo;t an agent&rsquo;s, suggesting the closest.</p>
|
||
<h3 data-hextra-search-id="layers-for-new-vms">Layers for new VMs<span class="hx:absolute hx:-mt-20" id="layers-for-new-vms"></span>
|
||
<a href="#layers-for-new-vms" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>The layers you choose in <code>devvm setup</code> are the ones every new VM gets unless you choose others for it. They can be devvm&rsquo;s <a href="https://next.devvm.dev/docs/using/images/#built-in-layers">built-in layers</a>, <code>desktop</code>, <code>docker</code> and <code>nix</code>, and <a href="https://next.devvm.dev/docs/using/customizing/#your-own-layers">your own</a>, which is how you give every new VM an extra of your own (<a href="https://next.devvm.dev/docs/using/customizing/#extras-of-your-own">extras of your own</a>). The summary devvm shows before it makes a new VM names each of them as coming from devvm setup. When you customize the VM in a terminal, they&rsquo;re already chosen under Layers in the list, and you can leave any of them out of that VM (<a href="https://next.devvm.dev/docs/using/images/#what-a-new-vm-gets">what a new VM gets</a>).</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm setup --layers docker,desktop <span class="c1"># every new VM gets docker, with desktop on top</span>
|
||
</span></span><span class="line"><span class="cl">devvm setup --layers none <span class="c1"># new VMs get no layers</span>
|
||
</span></span><span class="line"><span class="cl">devvm --layers nix <span class="c1"># this VM gets nix alone, not setup&#39;s layers</span>
|
||
</span></span><span class="line"><span class="cl">devvm --layers none <span class="c1"># this VM gets no layers</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm setup --layers</code> takes the layers bottom first, in the order the image&rsquo;s name joins them, so <code>--layers docker,desktop</code> gives new VMs the image <code>docker+desktop</code>. It refuses a name that isn&rsquo;t a layer&rsquo;s, suggesting the closest, and changes nothing. Until you choose some, new VMs get no layers by default, and devvm doesn&rsquo;t ask for them on its first run. In a terminal, <code>devvm setup</code> asks for them last, after the coding agents. To set them by hand, use the <code>layers</code> key in <a href="#configtoml"><code>config.toml</code></a>, which <code>devvm setup --layers</code> then refuses to change.</p>
|
||
<ul>
|
||
<li><code>--layers</code> on <code>devvm</code> is the exact list of one VM&rsquo;s layers, so it replaces setup&rsquo;s layers, and <code>--layers none</code> makes a VM without any. A <code>devcontainer.json</code>&rsquo;s layers go on top of setup&rsquo;s (<a href="https://next.devvm.dev/docs/using/devcontainer/"><code>devcontainer.json</code></a>).</li>
|
||
<li>The choice is for new VMs only. A VM that exists keeps the layers it was made with, and <code>devvm setup</code> says so when it saves the choice. To give that VM more layers, run <code>devvm layer add</code> in its folder (<a href="https://next.devvm.dev/docs/using/images/#adding-layers-to-a-vm">adding layers to a VM</a>), and to take some out, <code>devvm layer rm</code> (<a href="https://next.devvm.dev/docs/using/images/#taking-layers-out-of-a-vm">taking layers out of a VM</a>).</li>
|
||
</ul>
|
||
<p>When a layer of yours that you chose in <code>devvm setup</code> has no script in <code>~/.config/devvm/layers</code>, such as after you delete it, a new VM is made without it, and devvm warns, naming the layer. Run <code>devvm setup --layers</code> to choose the layers again. When the VM&rsquo;s backend can&rsquo;t run a layer you chose, such as <code>docker</code> on a backend without Docker&rsquo;s engine, devvm makes no VM and names the layer. Then choose other layers for that VM with <code>--layers</code>, or change new VMs&rsquo; layers with <code>devvm setup --layers</code>.</p>
|
||
<h2 data-hextra-search-id="retention">Retention<span class="hx:absolute hx:-mt-20" id="retention"></span>
|
||
<a href="#retention" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm keeps what it makes until you delete it, and the retention settings tell it to delete some of it on its own. Every setting is off until you set it, so first run <code>devvm space</code> to see what each one would free: its <code>RETAIN</code> column shows each setting that&rsquo;s on, beside the row it applies to, with what it would delete now (<a href="https://next.devvm.dev/docs/using/space/#devvm-space">devvm space</a>).</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm space <span class="c1"># see what each setting would free</span>
|
||
</span></span><span class="line"><span class="cl">devvm retention <span class="c1"># show every setting</span>
|
||
</span></span><span class="line"><span class="cl">devvm retention history.age<span class="o">=</span>90d tools.unused-age<span class="o">=</span>30d <span class="c1"># set some</span>
|
||
</span></span><span class="line"><span class="cl">devvm retention history.age<span class="o">=</span>off <span class="c1"># turn one off</span>
|
||
</span></span><span class="line"><span class="cl">devvm gc --retention <span class="c1"># gc as usual, then apply them now</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm retention</code> shows every setting and its value, and <code>off</code> for each one that isn&rsquo;t set. <code>devvm retention KEY=VALUE...</code> sets them, and <code>devvm retention KEY=off</code> turns one off, for example <code>devvm retention history.age=90d tools.unused-age=30d</code>. devvm refuses a key or value it doesn&rsquo;t know, and a key with no value such as <code>history.age=</code>, and then it writes nothing. devvm saves the settings in <code>~/.local/share/devvm/settings.json</code>. The <code>[retention]</code> table of <a href="#configtoml"><code>config.toml</code></a> sets them too, and a setting there wins over the saved one, so <code>devvm retention</code> refuses to change it. Each line that <code>devvm retention</code> shows ends with where its value came from, after a <code>#</code>. When devvm can&rsquo;t read a file that sets them, it names the file, and the line for <code>config.toml</code>, and applies none of them.</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Key</th>
|
||
<th>What devvm deletes</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>logs.runs</code></td>
|
||
<td>the <a href="https://next.devvm.dev/docs/using/troubleshooting/#a-command-fails">run logs</a> beyond the newest this many, which is 20 when it&rsquo;s off, and older ones past 256 MiB together whatever it is</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>history.age</code></td>
|
||
<td>the <a href="https://next.devvm.dev/docs/using/coding-agents/#history">exports of agents&rsquo; history</a> written this long ago or more, such as <code>90d</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>history.count</code></td>
|
||
<td>the exports of agents&rsquo; history beyond the newest this many</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>tools.unused-age</code></td>
|
||
<td>the current shared tools that no VM has had for this long, counted from when devvm first found that no VM has them. While a VM is being made or is getting new shared tools, retention deletes none of them in that run, because that VM may not list the tools it picked yet, and it still applies the other settings</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>orphans.age</code></td>
|
||
<td>what devvm keeps for VMs that their backend no longer has, once their state hasn&rsquo;t changed for this long, as <code>devvm gc --orphans</code> does</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>nix-cache.size</code></td>
|
||
<td>the <a href="https://next.devvm.dev/docs/using/toolchains/#nix-projects">shared Nix cache</a>&rsquo;s least recently used files, while it takes more than this, such as <code>20G</code>; it&rsquo;s 10 GiB when it&rsquo;s off</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Value</th>
|
||
<th>Written as</th>
|
||
<th>Examples</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>an age</td>
|
||
<td>a <a href="https://next.devvm.dev/docs/using/command-line/#flags-and-values">duration</a>, a whole number of minutes, hours, days or weeks</td>
|
||
<td><code>30m</code>, <code>12h</code>, <code>30d</code> or <code>2w</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>a size</td>
|
||
<td>a whole number of <code>K</code>, <code>M</code>, <code>G</code> or <code>T</code>, each 1024 of the one before, as <code>devvm space</code> shows them</td>
|
||
<td><code>500M</code> or <code>20G</code></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<ul>
|
||
<li><strong>When they apply:</strong> devvm applies the settings at the start of a command, at most once a day, except for <code>orphans.age</code>, which needs to ask each backend about its VMs, so only <code>devvm gc --retention</code> applies it. <code>devvm gc --retention</code> applies all of them at once. When two devvms start at once, only one of them applies the settings, and when it deletes something, devvm says what in one line.</li>
|
||
<li><strong>The Nix cache&rsquo;s size:</strong> the shared Nix cache also keeps to its size while VMs fill it, because a VM&rsquo;s proxy deletes the cache&rsquo;s least recently used files before a new file would take it past that size. A size you set applies to each VM from its next start.</li>
|
||
<li><strong>What it never deletes:</strong> retention never deletes a VM, an image, a shared tool that any VM&rsquo;s state lists, or anything in the backends&rsquo; own caches, which only <code>devvm gc --caches</code> frees. In <code>cache/</code>, the folder in <a href="https://next.devvm.dev/docs/using/space/#devvms-data-folder">devvm&rsquo;s data folder</a> that holds what devvm makes again when it needs it, retention deletes only the shared Nix cache&rsquo;s files.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="devvm-retention-json">devvm retention &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-retention-json"></span>
|
||
<a href="#devvm-retention-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm retention --json</code> prints the settings as one JSON object, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes. <code>settings</code> has every key with its value as you wrote it, and <code>off</code> for each one that isn&rsquo;t set. <code>sources</code> has every key with where its value came from: <code>config.toml</code>, <code>settings.json</code> for one that <code>devvm retention</code> saved, or <code>built-in</code> for one that&rsquo;s off. With <code>--json</code> the command only shows, so devvm refuses a <code>KEY=VALUE</code> with it.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;settings&#34;</span><span class="p">:</span> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;history.age&#34;</span><span class="p">:</span> <span class="s2">&#34;90d&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;history.count&#34;</span><span class="p">:</span> <span class="s2">&#34;off&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;logs.runs&#34;</span><span class="p">:</span> <span class="s2">&#34;off&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;nix-cache.size&#34;</span><span class="p">:</span> <span class="s2">&#34;off&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;orphans.age&#34;</span><span class="p">:</span> <span class="s2">&#34;off&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;tools.unused-age&#34;</span><span class="p">:</span> <span class="s2">&#34;30d&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;sources&#34;</span><span class="p">:</span> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;history.age&#34;</span><span class="p">:</span> <span class="s2">&#34;config.toml&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;history.count&#34;</span><span class="p">:</span> <span class="s2">&#34;built-in&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;logs.runs&#34;</span><span class="p">:</span> <span class="s2">&#34;built-in&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;nix-cache.size&#34;</span><span class="p">:</span> <span class="s2">&#34;built-in&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;orphans.age&#34;</span><span class="p">:</span> <span class="s2">&#34;built-in&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;tools.unused-age&#34;</span><span class="p">:</span> <span class="s2">&#34;settings.json&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="a-companys-ca">A company&rsquo;s CA<span class="hx:absolute hx:-mt-20" id="a-companys-ca"></span>
|
||
<a href="#a-companys-ca" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Some company networks inspect TLS through a proxy, such as Zscaler or Netskope, that shows its own certificates, signed by the company&rsquo;s certificate authority (CA). This machine trusts that CA, but VMs and the VMs that devvm builds images in don&rsquo;t, so their TLS connections fail. To make them trust it, put the CA&rsquo;s certificate in <code>~/.config/devvm/ca</code>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">mkdir -p ~/.config/devvm/ca
|
||
</span></span><span class="line"><span class="cl">cp company-root.pem ~/.config/devvm/ca/</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>devvm reads every <code>*.pem</code> and <code>*.crt</code> file in that folder each time you open a VM, each time it builds an image and each time it resolves the shared tools&rsquo; versions, and it leaves other files alone. A file can hold one certificate or several, in PEM, the text form that starts with <code>-----BEGIN CERTIFICATE-----</code>. devvm accepts only CA certificates, and it sends only the certificates it read out of a file, never the rest of the file. It refuses the whole folder, naming the file, in these cases:</p>
|
||
<ul>
|
||
<li><strong>Anything else in a file,</strong> such as a private key, a certificate devvm can&rsquo;t read or a certificate that isn&rsquo;t a CA&rsquo;s.</li>
|
||
<li><strong>A link:</strong> a <code>*.pem</code> or <code>*.crt</code> file that is a link, or a folder that is one, because a link into a project folder would let that project&rsquo;s VM replace the CA that every VM, build and proxy trusts. devvm doesn&rsquo;t follow links there, so copy each certificate into the folder rather than linking to it.</li>
|
||
<li><strong>A file it can&rsquo;t read,</strong> or a folder it can&rsquo;t read.</li>
|
||
</ul>
|
||
<p>These trust the CAs:</p>
|
||
<ul>
|
||
<li><strong>Every project VM,</strong> in its system&rsquo;s store, from its next launch.</li>
|
||
<li><strong>Every build VM,</strong> for an image or for shared tools. devvm takes them out of a build VM before the image is finished, so images never keep them, and adding or removing a CA rebuilds nothing. A layer script of yours that copies the system&rsquo;s CA bundle somewhere else does keep that copy (<a href="https://next.devvm.dev/docs/internals/images/#a-companys-ca-in-builds">a company&rsquo;s CA in builds</a>).</li>
|
||
<li><strong>The VM&rsquo;s proxy,</strong> on every <a href="https://next.devvm.dev/docs/safety/network/">network tier</a>, for the connections it makes itself, the refresh of a coding agent&rsquo;s login included, which the proxy makes on this machine when the login is due, so a company proxy that inspects TLS doesn&rsquo;t make the refresh fail.</li>
|
||
<li><strong>Ubuntu&rsquo;s cloud image,</strong> which devvm looks up and downloads on this machine to build base. The lookup and the download trust these CAs as well as this machine&rsquo;s own store, and when this machine doesn&rsquo;t trust the server&rsquo;s certificate, devvm says so and names this folder.</li>
|
||
<li><strong>devvm&rsquo;s own mise,</strong> which devvm downloads once to resolve the shared tools&rsquo; versions on this machine. That download trusts these CAs as well as this machine&rsquo;s own store, and on Linux so does that mise. On macOS, mise trusts them for most of its connections, but the part of it that checks where each tool&rsquo;s release was built trusts only the CAs that macOS trusts, which Keychain Access shows. So on macOS, a company&rsquo;s CA that mise needs has to be there too, where a Mac that your company manages usually has it already. When mise doesn&rsquo;t trust a server&rsquo;s certificate, devvm says so and names this folder.</li>
|
||
</ul>
|
||
<p>devvm&rsquo;s other connections from this machine, such as checking an image&rsquo;s registry, trust this machine&rsquo;s own store, as your other programs here do. When you take a certificate out of the folder, VMs stop trusting it at their next launch, and stores that copy the system&rsquo;s CAs, such as Java&rsquo;s <code>cacerts</code>, drop it too.</p>
|
||
<p>Most tools read the system&rsquo;s store, among them apt, apk, curl, git and Python&rsquo;s <code>ssl</code> module. For those that don&rsquo;t, every VM&rsquo;s environment points them at it:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Variable</th>
|
||
<th>Value</th>
|
||
<th>For</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>NODE_EXTRA_CA_CERTS</code></td>
|
||
<td><code>/etc/ssl/devvm.pem</code>, which holds only devvm&rsquo;s CAs and is empty when there are none</td>
|
||
<td>Node, npm and Bun</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>SSL_CERT_FILE</code></td>
|
||
<td><code>/etc/ssl/certs/ca-certificates.crt</code>, the system&rsquo;s bundle</td>
|
||
<td>Go programs, and Rust programs that read the system&rsquo;s roots</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>REQUESTS_CA_BUNDLE</code>, <code>PIP_CERT</code></td>
|
||
<td>the system&rsquo;s bundle</td>
|
||
<td>Python&rsquo;s <code>requests</code> and pip, which use their own CA list otherwise</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>UV_SYSTEM_CERTS</code></td>
|
||
<td><code>1</code></td>
|
||
<td>uv</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>A CA in the folder can read every TLS connection a VM makes, as it can this machine&rsquo;s, so put only CAs there that you trust as much as this machine does. <a href="https://next.devvm.dev/docs/internals/network/#a-companys-ca">How it works › Network tiers</a> explains how the CAs reach VMs, and <a href="https://next.devvm.dev/docs/internals/images/#a-companys-ca-in-builds">Images and caching</a> how builds use them.</p>
|
||
<h2 data-hextra-search-id="devvms-state">devvm&rsquo;s state<span class="hx:absolute hx:-mt-20" id="devvms-state"></span>
|
||
<a href="#devvms-state" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>~/.local/share/devvm</code> (<code>$XDG_DATA_HOME/devvm</code>) holds what devvm makes and keeps for you, and devvm writes everything in it, so don&rsquo;t edit it by hand. It holds the defaults that <code>devvm setup</code>, <code>devvm size -g</code>, <code>devvm ports -g</code>, <code>devvm network -g</code> and <code>devvm retention</code> save in <code>settings.json</code>, below <a href="#configtoml"><code>config.toml</code></a>&rsquo;s, and a folder for each VM in <code>vms/</code>, with the VM&rsquo;s state, its own allowlist and its network logs. It also holds the images and the shared tools, the <a href="https://next.devvm.dev/docs/using/troubleshooting/#a-command-fails">run logs</a>, the agents&rsquo; history that <code>devvm history export</code> and <code>devvm rm</code> save, the <a href="https://next.devvm.dev/docs/using/ssh/#ssh-access-by-name">ssh config</a> for your VMs, and devvm&rsquo;s own Lima home (<code>lima/</code>), where the Lima backend&rsquo;s VMs and images live. <a href="https://next.devvm.dev/docs/using/space/#devvms-data-folder">devvm&rsquo;s data folder</a> lists each file and folder in it, with how each one is cleaned up.</p>
|
||
<ul>
|
||
<li>On Linux hosts this folder also holds your <a href="https://next.devvm.dev/docs/safety/network/#saving-and-binding-secrets">secrets</a>, in files under <code>secrets/</code> that only you can read, so keep that in mind when you back it up. On macOS they&rsquo;re in the Keychain.</li>
|
||
<li>devvm&rsquo;s Lima home is its own, whatever <code>LIMA_HOME</code> says, so Lima settings meant for other VMs never reach devvm&rsquo;s. Set <code>DEVVM_LIMA_HOME</code> to move it, for example to a sandbox or to a shorter path. When devvms with data folders of their own share one Lima home, don&rsquo;t build shared tools or run <code>devvm gc</code> in two of them at once, because each can delete a build VM that another is still using (<a href="https://next.devvm.dev/docs/internals/images/#building-tools">building tools</a>).</li>
|
||
<li>Only you can read devvm&rsquo;s files, in either folder, because each time devvm runs, it makes both folders yours alone (<a href="https://next.devvm.dev/docs/using/space/#devvms-data-folder">devvm&rsquo;s data folder</a>). When devvm can&rsquo;t read one of its files, it names the file and the line (<a href="https://next.devvm.dev/docs/using/troubleshooting/#a-file-devvm-cant-read">a file devvm can&rsquo;t read</a>).</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="project-folders-devvm-refuses">Project folders devvm refuses<span class="hx:absolute hx:-mt-20" id="project-folders-devvm-refuses"></span>
|
||
<a href="#project-folders-devvm-refuses" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A VM mounts its project folder read-write, so devvm refuses to make a VM for a folder that would give the VM more than the project:</p>
|
||
<ul>
|
||
<li><strong>Your home folder and devvm&rsquo;s folders,</strong> and any folder that holds one: your home folder, <code>~/.config/devvm</code>, <code>~/.local/share/devvm</code> or devvm&rsquo;s Lima home.</li>
|
||
<li><strong>A folder inside one of devvm&rsquo;s own folders,</strong> because a VM there could rewrite the scripts that every image build runs, or the files that devvm runs on this machine.</li>
|
||
<li><strong>Another name for one of these folders.</strong> devvm compares the folders themselves, not only their names, so on a Mac, where a name&rsquo;s case doesn&rsquo;t count, <code>~/.Config/devvm</code> is refused as <code>~/.config/devvm</code> is.</li>
|
||
</ul>
|
||
<p>When devvm refuses a folder, make the VM in a project folder inside it, or keep the project somewhere else. A <a href="https://next.devvm.dev/docs/using/clone/"><code>--clone</code></a> VM mounts nothing from the folder, so devvm doesn&rsquo;t refuse its folder.</p>
|
||
<div class="devvm-callout devvm-callout-warning">
|
||
<p class="devvm-callout-title"><svg class="devvm-icon" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="currentColor" shape-rendering="crispEdges"><path d="M5 1h1v1H5ZM4 2h1v1H4ZM6 2h1v1H6ZM4 3h1v1H4ZM6 3h1v1H6ZM3 4h1v1H3ZM7 4h1v1H7ZM3 5h1v1H3ZM5 5h1v1H5ZM7 5h1v1H7ZM2 6h1v1H2ZM5 6h1v1H5ZM8 6h1v1H8ZM2 7h1v1H2ZM5 7h1v1H5ZM8 7h1v1H8ZM1 8h1v1H1ZM9 8h1v1H9ZM1 9h1v1H1ZM5 9h1v1H5ZM9 9h1v1H9ZM0 10h1v1H0ZM10 10h1v1H10ZM0 11h11v1H0Z"/></svg> Warning</p><p>If you mean to give the VM the whole folder, pass <code>--unsafe-folder</code> when you make the VM, and devvm warns you that the VM gets read-write access to it (<a href="https://next.devvm.dev/docs/internals/security/#only-the-project-folder">only the project folder</a>).</p></div><p>A folder inside a coding agent&rsquo;s folder on this machine, such as a skill you work on in <code>~/.claude/skills</code>, or one that holds an agent&rsquo;s folder, such as <code>~/.pi</code>, isn&rsquo;t refused, but devvm warns at each launch, because code in the VM can change that agent&rsquo;s settings on this machine. Keep such a project somewhere else unless you trust what runs in its VM.</p>
|
||
<h2 data-hextra-search-id="colors">Colors<span class="hx:absolute hx:-mt-20" id="colors"></span>
|
||
<a href="#colors" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>In a terminal, devvm colors the labels and links around its messages, while the messages&rsquo; own text stays in your terminal&rsquo;s usual color. The tables that devvm ls, devvm images, devvm space and devvm doctor print are colored too, and their columns line up the same with colors or without:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>What</th>
|
||
<th>Color</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>the values a message fills in, such as a VM&rsquo;s name, a path, a port or a count, so they stand out from the words around them</td>
|
||
<td>bold</td>
|
||
</tr>
|
||
<tr>
|
||
<td>an error&rsquo;s <code>devvm:</code> label</td>
|
||
<td>red</td>
|
||
</tr>
|
||
<tr>
|
||
<td>a warning&rsquo;s <code>devvm:</code> label</td>
|
||
<td>yellow</td>
|
||
</tr>
|
||
<tr>
|
||
<td>a doc link</td>
|
||
<td>blue and underlined</td>
|
||
</tr>
|
||
<tr>
|
||
<td>the <code>==&gt;</code> before what devvm did</td>
|
||
<td>bold</td>
|
||
</tr>
|
||
<tr>
|
||
<td>the end of the run log that devvm prints when a step fails, the log&rsquo;s latest line on the status line, and each line that <code>-v</code> shows</td>
|
||
<td>dim</td>
|
||
</tr>
|
||
<tr>
|
||
<td>the mark a slow step leaves when it&rsquo;s done</td>
|
||
<td>green</td>
|
||
</tr>
|
||
<tr>
|
||
<td>each table&rsquo;s header row and the totals row</td>
|
||
<td>bold</td>
|
||
</tr>
|
||
<tr>
|
||
<td>a state that&rsquo;s good, such as current, Running or native</td>
|
||
<td>green</td>
|
||
</tr>
|
||
<tr>
|
||
<td>a state that needs your attention, such as stale, unused, Stopped or emulated</td>
|
||
<td>yellow</td>
|
||
</tr>
|
||
<tr>
|
||
<td>a state that says something is wrong, such as an unenforced tier or an unreviewed emulation</td>
|
||
<td>red</td>
|
||
</tr>
|
||
<tr>
|
||
<td>digests, image keys and a feature a backend doesn&rsquo;t have, which devvm doctor lists as none</td>
|
||
<td>dim</td>
|
||
</tr>
|
||
<tr>
|
||
<td>names, paths, sizes and counts in a table</td>
|
||
<td>your terminal&rsquo;s usual color</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>devvm uses only your terminal&rsquo;s 16 base colors, so your theme picks shades that read well on its background, light or dark. It never sets a background color.</p>
|
||
<p>devvm decides for standard output and standard error apart, and colors one only when it&rsquo;s a terminal, so output you pipe or redirect to a file stays plain, tables included. What a command prints with <code>--json</code> is plain even in a terminal, and the run log is never colored. These environment variables change when devvm colors, and the first one that applies decides:</p>
|
||
<ul>
|
||
<li><code>NO_COLOR</code>, set to anything but an empty value, turns colors off.</li>
|
||
<li><code>FORCE_COLOR</code> or <code>CLICOLOR_FORCE</code>, set to anything but <code>0</code>, turns them on even when the output isn&rsquo;t a terminal.</li>
|
||
<li><code>TERM=dumb</code> turns them off.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="environment">Environment<span class="hx:absolute hx:-mt-20" id="environment"></span>
|
||
<a href="#environment" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><table>
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>NO_COLOR</code>, <code>FORCE_COLOR</code>, <code>CLICOLOR_FORCE</code></td>
|
||
<td>turn devvm&rsquo;s colors off, or on when the output isn&rsquo;t a terminal (<a href="#colors">details</a>)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>DEVVM_LIMA_HOME</code></td>
|
||
<td>move devvm&rsquo;s own Lima home (<a href="https://next.devvm.dev/docs/internals/lima/#a-lima-home-of-its-own">details</a>)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>DEVVM_FROM</code></td>
|
||
<td>the container image that the base of new VMs and builds starts from when there&rsquo;s no <code>--from</code> (<a href="https://next.devvm.dev/docs/using/from/">details</a>)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>DEVVM_NO_TOOL_CHECK=1</code></td>
|
||
<td>don&rsquo;t check for newer shared tools once a day (<a href="https://next.devvm.dev/docs/using/images/#shared-tools">details</a>)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>DEVVM_NO_RELEASE_CHECK=1</code></td>
|
||
<td>don&rsquo;t check for a newer devvm release once a day (<a href="#the-release-check">details</a>)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>DEVVM_SECRET_SERVICE</code></td>
|
||
<td>the Keychain service devvm saves and reads secrets in, instead of <code>devvm</code> (<a href="https://next.devvm.dev/docs/safety/network/#saving-and-binding-secrets">details</a>)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>CLAUDE_CODE_OAUTH_TOKEN</code></td>
|
||
<td>the Claude Code token that VMs get, over the saved Claude Code login, whichever it is (<a href="https://next.devvm.dev/docs/using/coding-agents/#claude-code-login">details</a>)</td>
|
||
</tr>
|
||
</tbody>
|
||
</table></description></item><item><title>Working on a clone</title><link>https://next.devvm.dev/docs/using/clone/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/clone/</guid><description>
|
||
<p><code>devvm --clone</code> gives the VM its own clone of the repo instead of mounting your folder, so nothing in the VM can touch your working tree or <code>.git</code>. Use it when you don&rsquo;t trust what runs in the VM, such as an agent working unattended, and on Linux hosts that can&rsquo;t lock <code>.git</code>, such as Ubuntu 23.10 and newer, where devvm only names what changed after the fact (<a href="https://next.devvm.dev/docs/safety/git-protection/#when-linux-cant-lock">when Linux can&rsquo;t lock</a>). On Linux hosts it&rsquo;s also the way to use SQLite in WAL mode, or a program that maps its files for writing, such as LMDB or the mold linker, in the repo, because those fail in the 9p share that VMs there mount the folder with, while the clone is on the VM&rsquo;s own disk, which is also far faster (<a href="https://next.devvm.dev/docs/backends/lima/#programs-that-map-files-for-writing">programs that map files</a>). <a href="https://next.devvm.dev/docs/safety/attack-vectors/#files-the-vm-writes">Files the VM writes</a> lists what <code>--clone</code> keeps away from this machine.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm --clone <span class="c1"># create the VM, copy your repo into it and open a shell in its clone</span>
|
||
</span></span><span class="line"><span class="cl">devvm clone fetch <span class="c1"># later, on this machine, fetch the VM&#39;s work as devvm/&lt;branch&gt;</span>
|
||
</span></span><span class="line"><span class="cl">git log -p main..devvm/main</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<div class="devvm-diagram" style="contain-intrinsic-block-size: auto 437px; --devvm-diagram-width: 393px"><svg xmlns="http://www.w3.org/2000/svg" class="pele pele-sequence" viewBox="0 0 393 437" width="393" height="437" style="--_bg:var(--pele-bg,#fff);--_fg:var(--pele-fg,#1f1f1f);--_m:var(--pele-muted,#6e6e6e);--_l:var(--pele-line,#1f1f1f);--_s:var(--pele-surface,#f3f3f3);--_a:var(--pele-surface-alt,#e6e6e6);--_b:var(--pele-border,#8a8a8a);--_c:var(--pele-accent,#5b7bd5);color:var(--_fg);--_r:var(--pele-radius,4px);--_fm:var(--pele-font-mono,&quot;Departure Mono&quot;, monospace);font:14px sans-serif;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;font-family:var(--pele-font,&quot;Departure Mono&quot;, monospace)" fill="var(--_fg)" role="graphics-document document" aria-roledescription="sequence" aria-labelledby="d6df95569119c229f--title" aria-describedby="d6df95569119c229f--desc"><title id="d6df95569119c229f--title">A clone's life</title><desc id="d6df95569119c229f--desc">devvm --clone copies your repo into the VM, where you or an agent commit. devvm clone fetch brings the VM's commits into your repo as a devvm/ branch, for you to review and merge. devvm rm looks for commits not fetched and fetches them into a saved/devvm/ branch, then deletes the VM and removes its remote.</desc><g transform="translate(64.09,8)"><g class="pele-lifelines" fill="none" stroke="var(--_b)"><path class="pele-lifeline" data-id="R" d="M0,41V421"/><path class="pele-lifeline" data-id="V" d="M238.91,41V421"/></g><g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round"><g class="pele-edge pele-message" data-id="i0"><path d="M0,95H231.91"/><path class="pele-marker" d="M238.91,95L230.91,98.36L230.91,91.64Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge pele-message" data-id="i2"><path d="M238.91,197H7"/><path class="pele-marker" d="M0,197L8,193.64L8,200.36Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge pele-message" data-id="i4"><path d="M0,299H231.91"/><path class="pele-marker" d="M238.91,299L230.91,302.36L230.91,295.64Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge pele-message" data-id="i5"><path d="M238.91,347H7"/><path class="pele-marker" d="M0,347L8,343.64L8,350.36Z" fill="var(--_l)" stroke="none"/></g></g><g class="pele-edge-labels" font-size="14"><g class="pele-edge-label" data-id="i0"><text text-anchor="middle" xml:space="preserve"><tspan x="119.45" y="71.2">devvm --clone copies</tspan><tspan x="119.45" y="87.2">your repo</tspan></text>
|
||
</g><g class="pele-edge-label" data-id="i2"><text text-anchor="middle" xml:space="preserve"><tspan x="119.45" y="173.2">devvm clone fetch gives</tspan><tspan x="119.45" y="189.2">devvm/&lt;branch&gt;</tspan></text>
|
||
</g><g class="pele-edge-label" data-id="i4"><text text-anchor="middle" xml:space="preserve"><tspan x="119.45" y="275.2">devvm rm looks for</tspan><tspan x="119.45" y="291.2">commits not fetched</tspan></text>
|
||
</g><g class="pele-edge-label" data-id="i5"><text text-anchor="middle" xml:space="preserve"><tspan x="119.45" y="323.2">fetched into</tspan><tspan x="119.45" y="339.2">saved/devvm/&lt;branch&gt;</tspan></text>
|
||
</g></g><g class="pele-notes" font-size="14" fill="var(--_a)" stroke="var(--_b)"><g class="pele-note" data-id="i1"><rect x="157.64" y="105" width="162.55" height="44" style="rx:var(--_r)"/><text class="pele-label" stroke="none" fill="var(--_fg)" text-anchor="middle" xml:space="preserve"><tspan x="238.91" y="123.2">you or an agent</tspan><tspan x="238.91" y="139.2">commit in the VM</tspan></text>
|
||
</g><g class="pele-note" data-id="i3"><rect x="-54.55" y="207" width="109.09" height="44" style="rx:var(--_r)"/><text class="pele-label" stroke="none" fill="var(--_fg)" text-anchor="middle" xml:space="preserve"><tspan x="0" y="225.2">review,</tspan><tspan x="0" y="241.2">then merge</tspan></text>
|
||
</g><g class="pele-note" data-id="i6"><rect x="-16" y="357" width="270.91" height="44" style="rx:var(--_r)"/><text class="pele-label" stroke="none" fill="var(--_fg)" text-anchor="middle" xml:space="preserve"><tspan x="119.45" y="375.2">the VM is deleted,</tspan><tspan x="119.45" y="391.2">and its remote removed</tspan></text>
|
||
</g></g><g class="pele-nodes"><g class="pele-node pele-actor pele-actor-participant" data-id="R"><rect x="-56.09" y="0" width="112.18" height="41" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="0" y="25.4" text-anchor="middle">Your repo</text>
|
||
</g><g class="pele-node pele-actor pele-actor-participant" data-id="V"><rect x="160.55" y="0" width="156.73" height="41" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="238.91" y="25.4" text-anchor="middle">The VM's clone</text>
|
||
</g></g></g></svg></div><p>When the folder holds several repos, such as a <code>frontend</code> and a <code>backend</code> beside each other, <code>devvm --clone</code> gives the VM a clone of each repo you choose, at the same paths as on this machine (<a href="#folders-of-repos">folders of repos</a>).</p>
|
||
<h2 data-hextra-search-id="requirements">Requirements<span class="hx:absolute hx:-mt-20" id="requirements"></span>
|
||
<a href="#requirements" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><ul>
|
||
<li>The folder is the top folder of a git repo that has at least one commit, or it&rsquo;s a folder of repos (<a href="#folders-of-repos">folders of repos</a>).</li>
|
||
<li>The repo is the folder&rsquo;s own, or the folder is a worktree that <code>git worktree add</code> made. devvm refuses a <code>.git</code> that points into another repo, because the copy would take that repo&rsquo;s branches into the VM. That includes a <code>.git</code> file that isn&rsquo;t a worktree&rsquo;s, such as a submodule&rsquo;s, which <code>devvm --clone</code> in its parent repo&rsquo;s folder copies (<a href="#submodules">submodules</a>), a worktree whose link back to this folder doesn&rsquo;t match, a <code>commondir</code> that leads to another repo, and objects or refs that are symlinks, or that sit in a folder that is one. devvm also refuses a repo that borrows objects from another repo through <code>objects/info/alternates</code>. To use such a repo, run <code>git repack -a -d</code> in it, then delete that file.</li>
|
||
<li>The repo has no <code>info/grafts</code> file, which gives some commits other parents than their own, because devvm copies each commit with its own parents. <code>git replace --convert-graft-file</code> turns the file into replace refs, which git supports in its place. devvm copies each commit&rsquo;s real parents even then, so the history the grafts cut off has to be in the repo on this machine.</li>
|
||
<li>git is installed on this machine. The VM&rsquo;s images already have it. A repo that names its objects with SHA-256 also needs git 2.29 or newer in the VM, which devvm&rsquo;s images have. An image you made with <code>--from</code> might not, and then devvm stops before it copies anything and names the VM&rsquo;s git version.</li>
|
||
<li>No other VM mounts the folder, such as the VM of a folder it&rsquo;s in. Code in that VM could swap the repo under the git commands devvm runs here as it copies your branches, so devvm refuses <code>--clone</code> and <code>devvm clone on</code> there and names that VM. Delete that VM, or move the repo out of its folder.</li>
|
||
<li>You choose <code>--clone</code> when the VM is created, and once a VM is a <code>--clone</code> VM you don&rsquo;t need to pass <code>--clone</code> again. devvm refuses <code>--clone</code> for an existing VM that mounts its folder, and <code>devvm clone on</code> switches that VM instead (<a href="#switching-a-vm-that-exists">switching a VM that exists</a>).</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="whats-copied">What&rsquo;s copied<span class="hx:absolute hx:-mt-20" id="whats-copied"></span>
|
||
<a href="#whats-copied" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>From this machine, the VM mounts only the shared tools and its <a href="https://next.devvm.dev/docs/using/coding-agents/#mounts">agents&rsquo; config folders</a>. Once the VM is running, devvm creates a repo in it at the same path as your folder and copies your repo into it, so <code>git status</code>, <code>git log</code> and <code>git stash list</code> in the VM&rsquo;s clone show what they show here. What goes into the VM:</p>
|
||
<ul>
|
||
<li><strong>Every local branch,</strong> your <code>saved/devvm/*</code> branches included, which hold a deleted VM&rsquo;s work.</li>
|
||
<li><strong>Every tag,</strong> an annotated one staying annotated, and your notes and replace refs. Refs are the repo&rsquo;s data, so what a tool keeps in them goes too, such as an agent tool that stores its transcripts in git notes or branches.</li>
|
||
<li><strong>The remote-tracking branches of your remotes,</strong> such as <code>origin/main</code>, with <code>origin/HEAD</code> still pointing at its branch. That includes the branches of another private repo that you fetched as a remote.</li>
|
||
<li><strong>What you have checked out,</strong> your current branch or, when HEAD is detached, the same commit, detached, and your shell opens there.</li>
|
||
<li><strong>Your uncommitted changes.</strong> What you&rsquo;ve staged is staged in the VM, and what you haven&rsquo;t is changed in its working tree, deleted files and files added with <code>git add -N</code> included. Each working copy goes as it is, but only a regular file or a symbolic link, where git tracks one of those.</li>
|
||
<li><strong>A rebase, a merge, a cherry-pick, a revert or a bisect</strong> that you&rsquo;re in the middle of (<a href="#an-operation-in-progress">an operation in progress</a>), and your repo&rsquo;s <code>info/exclude</code>, <code>info/sparse-checkout</code> and <code>info/attributes</code>.</li>
|
||
<li><strong>Your stash,</strong> each entry with its message and the commits it was made on, at most your 1,000 newest, and devvm names the rest. An entry made with <code>git stash -u</code> holds untracked files, so those files reach the VM inside it.</li>
|
||
<li><strong>Your repo&rsquo;s own settings,</strong> such as its remotes, its hooks as they are and your <code>user.name</code> (<a href="#the-settings">the settings</a>), each <a href="#submodules">submodule</a> you&rsquo;ve initialised, and the content of your <a href="#git-lfs">Git LFS</a> files.</li>
|
||
</ul>
|
||
<p>What stays on this machine:</p>
|
||
<ul>
|
||
<li><strong>Untracked and ignored files,</strong> such as <code>.env</code> and <code>node_modules</code>.</li>
|
||
<li><strong>Anything that isn&rsquo;t a tracked file of its kind any more.</strong> A tracked file that you turned into a folder is missing in the VM, nothing in that folder goes, and devvm names it. A file whose folder is a symbolic link here goes as deleted, as git sees it, never as the file the link leads to.</li>
|
||
<li><strong>An embedded repo&rsquo;s contents,</strong> and an uninitialised submodule&rsquo;s. Its folder is empty in the VM, without its <code>.git</code>, its own changes or its untracked files.</li>
|
||
<li><strong>The change you haven&rsquo;t committed to a filtered file,</strong> one that goes through a git filter, such as git-crypt&rsquo;s or Git LFS&rsquo;s. The file goes as git stores it, because devvm&rsquo;s git runs no filter, though <code>git-lfs</code> in the VM then checks a Git LFS file out with its content (<a href="#git-lfs">Git LFS</a>), and devvm names it as one that may differ, because without the filter devvm can&rsquo;t tell whether it changed. Such a file that you deleted is deleted in the VM too.</li>
|
||
<li><strong>Your edits to a file marked with <code>git update-index --skip-worktree</code>,</strong> which git hides and which are often local settings or secrets. The file goes as git&rsquo;s index has it, and devvm names it. A file marked <code>--assume-unchanged</code> also goes as the index has it, and a sparse checkout&rsquo;s files outside it stay out of the VM, as they&rsquo;re out of your working tree.</li>
|
||
<li><strong>A stash entry made with <code>git stash --all</code>,</strong> which may hold ignored files, such as <code>.env</code>. devvm can&rsquo;t tell such an entry from a <code>-u</code> one for sure, so it keeps back any entry that may be one, such as one whose untracked files your <code>.gitignore</code> ignores, now or when you made it, and it names each one.</li>
|
||
<li><strong>Another devvm VM&rsquo;s work,</strong> the remote-tracking branches of its remote, such as an older <code>--clone</code> VM&rsquo;s <code>devvm/*</code>.</li>
|
||
<li><strong>Refs outside those namespaces,</strong> such as <code>refs/original/</code>, where <code>git filter-branch</code> keeps what it rewrote. So does <code>ORIG_HEAD</code>, with any commit that only it still reaches, such as one a reset took back, except during <code>git am</code>, whose <code>--abort</code> needs it.</li>
|
||
<li><strong>Your global git config,</strong> and every setting of your repo that <a href="#the-settings">the settings</a> doesn&rsquo;t list, such as <code>credential.helper</code>.</li>
|
||
</ul>
|
||
<p>devvm copies all this without <code>git push</code>, over the same channel that carries every other command devvm runs in the VM, so the copy goes to that VM alone, and no setting in your repo&rsquo;s config, such as a <code>url.*.insteadOf</code> that rewrites the VM&rsquo;s URL, can send it anywhere else. It also takes a shallow clone, which gets its shallow history in the VM, and a repo that names its objects with SHA-256, which gets a SHA-256 repo there (<a href="https://next.devvm.dev/docs/internals/git-protection/#the-copy-into-a-clone-vm">how the copy works</a>, <a href="https://next.devvm.dev/docs/internals/git-protection/#the-working-tree-in-the-copy">the working tree</a>, <a href="https://next.devvm.dev/docs/internals/git-protection/#the-state-in-the-copy">the state</a>). A partial clone, which <code>git clone --filter</code> makes, gets the objects it has, and the VM&rsquo;s git fetches the rest from its remote when a command needs one, where the VM&rsquo;s network policy and credentials let it (<a href="#a-partial-clone">a partial clone</a>).</p>
|
||
<h3 data-hextra-search-id="a-git-worktree">A git worktree<span class="hx:absolute hx:-mt-20" id="a-git-worktree"></span>
|
||
<a href="#a-git-worktree" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>When the folder is a git worktree, devvm copies what&rsquo;s published and the worktree&rsquo;s own work: its branch, that branch&rsquo;s upstream, if it has one, the repo&rsquo;s default branch, the remote-tracking branches and the tags. It leaves the repo&rsquo;s other local branches on this machine, because they&rsquo;re other worktrees&rsquo; work, and it says so. The default branch is the branch <code>origin/HEAD</code> points to, else <code>main</code>, else <code>master</code>, whichever the repo has, so you can rebase onto it or diff against it in the VM. The worktree&rsquo;s VM gets no stash, because the stash is the whole repo&rsquo;s, not the worktree&rsquo;s, and none of the submodules (<a href="#submodules">submodules</a>).</p>
|
||
<h3 data-hextra-search-id="an-operation-in-progress">An operation in progress<span class="hx:absolute hx:-mt-20" id="an-operation-in-progress"></span>
|
||
<a href="#an-operation-in-progress" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>When you&rsquo;re in the middle of a rebase, a merge, a cherry-pick, a revert or a bisect, the VM&rsquo;s clone is in the middle of it too, so you or an agent can go on with it there. Resolve a conflict, then go on as you would here:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">git rebase --continue <span class="c1"># in the VM&#39;s clone, for a rebase</span>
|
||
</span></span><span class="line"><span class="cl">git commit <span class="c1"># for a merge</span>
|
||
</span></span><span class="line"><span class="cl">git cherry-pick --continue <span class="c1"># for a cherry-pick</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>A rebase started with <code>--autostash</code> brings its autostashed changes back in the VM. When the rest of a rebase or a cherry-pick names a commit that the VM won&rsquo;t have, devvm names it, as that step will fail there (<a href="https://next.devvm.dev/docs/internals/git-protection/#the-state-in-the-copy">the state in the copy</a>).</p>
|
||
<h3 data-hextra-search-id="the-settings">The settings<span class="hx:absolute hx:-mt-20" id="the-settings"></span>
|
||
<a href="#the-settings" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Your repo&rsquo;s own settings go too, from its <code>.git/config</code> and, when git keeps settings for each worktree, as <code>git sparse-checkout</code> does, from the worktree&rsquo;s <code>config.worktree</code>, never from your global config or a file they include (<a href="https://next.devvm.dev/docs/internals/git-protection/#the-settings-in-the-copy">the settings in the copy</a>):</p>
|
||
<ul>
|
||
<li>Its remotes, so <code>git fetch origin</code> and <code>git pull</code> work in the VM wherever its network policy reaches the remote and it has the credentials the remote needs:
|
||
<ul>
|
||
<li>Each URL goes as git resolves it, after any <code>url.*.insteadOf</code>, without the user name, password, query or fragment of an <code>http</code> or <code>https</code> URL, any of which can hold a token, and without the password of an <code>ssh</code> URL, whose user name goes.</li>
|
||
<li>A <code>file://</code> URL or a path goes as it is, though it names a folder on this machine that the VM can&rsquo;t reach.</li>
|
||
<li>When git pushes somewhere else, because of a push URL or a <code>url.*.pushInsteadOf</code>, the push URLs go too, cleaned the same way.</li>
|
||
<li>A remote whose URL is of any other kind, such as <code>git://</code> or <code>ext::</code>, or a scp-like URL that may hold a token, stays on this machine, and devvm names it. A push URL of those kinds, or one that reaches a devvm VM, stays too, and when none of a remote&rsquo;s push URLs goes, <code>git push</code> in the VM pushes to the remote&rsquo;s URL, and devvm says so.</li>
|
||
</ul>
|
||
</li>
|
||
<li>The upstream of each branch the copy sends, the submodules&rsquo; URLs, cleaned as a remote&rsquo;s, and their <code>active</code>, <code>branch</code> and <code>update</code> settings, but an <code>update</code> that runs a command.</li>
|
||
<li><code>core.sparseCheckout</code>, <code>core.sparseCheckoutCone</code> and <code>index.sparse</code>, so a sparse checkout is one in the VM too.</li>
|
||
<li><code>core.hooksPath</code> when it&rsquo;s a folder inside the repo, such as husky&rsquo;s, as the setting alone. The hooks in that folder are files of your working tree, so the tracked ones reach the VM with the checkout, and the untracked ones, such as husky&rsquo;s <code>_</code> folder, stay here, as every untracked file does, until a tool in the VM makes them, such as <code>npm install</code>.</li>
|
||
<li>The repo&rsquo;s own <code>user.name</code> and <code>user.email</code>, so a commit in the VM has your name on it.</li>
|
||
<li>Its hooks, as they are, the secrets in them included, so a hook that calls a tool only this machine has fails in the VM, as it would on a new machine. Only the files named as git&rsquo;s hooks go, each a regular file of at most 1 MiB and 16 MiB in all, from the repo&rsquo;s hooks folder, and only when git here runs them, which it doesn&rsquo;t once a <code>core.hooksPath</code> is set, in the repo or in your global config. A hook that&rsquo;s a link, a folder or bigger stays and is named, and so do the hooks of a <code>core.hooksPath</code> outside the repo. devvm also names a hooks folder that&rsquo;s missing, a link or unreadable.</li>
|
||
</ul>
|
||
<p>Every other setting stays on this machine, such as <code>credential.helper</code>, <code>http.extraHeader</code>, <code>core.sshCommand</code>, aliases and filters. Your remotes&rsquo; URLs are real, though, so when the VM may use your GitHub token, which its proxy puts into requests to <code>github.com</code> (<a href="https://next.devvm.dev/docs/safety/network/#secrets">secrets</a>), and its network policy reaches GitHub, code in the VM can push to <code>origin</code> there. To keep a VM from pushing to GitHub or changing anything through its API:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm network deny github.com --path <span class="s1">&#39;/*/*/git-receive-pack&#39;</span> <span class="c1"># no git push over HTTPS</span>
|
||
</span></span><span class="line"><span class="cl">devvm network deny api.github.com --method POST,PUT,PATCH,DELETE <span class="c1"># no changes through GitHub&#39;s API</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="submodules">Submodules<span class="hx:absolute hx:-mt-20" id="submodules"></span>
|
||
<a href="#submodules" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Each submodule you&rsquo;ve initialised here, nested ones too, gets a clone of its own in the VM, at its path, copied as the repo is, at the commit you have checked out in it, so <code>git submodule status</code> in the VM shows what it shows here:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">git submodule status --recursive <span class="c1"># in the VM&#39;s clone, as on this machine</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Its repo here gets a <code>devvm</code> remote for the VM, chosen as the repo&rsquo;s is, so <code>devvm clone fetch</code> fetches each submodule&rsquo;s branches into it, and <code>devvm rm</code> checks each one for work you haven&rsquo;t fetched (<a href="https://next.devvm.dev/docs/internals/git-protection/#submodules-in-the-copy">how the copy works</a>). The rest:</p>
|
||
<ul>
|
||
<li><strong>One you remove or deinitialise here later:</strong> devvm remembers each submodule it copied, so <code>devvm rm</code> names it as one it can&rsquo;t check, and asks before the VM goes.</li>
|
||
<li><strong>One you haven&rsquo;t initialised,</strong> with <code>git submodule update --init</code>, stays an empty folder in the VM, as it is here, and so does one you initialise after the copy, or in a VM made before devvm copied submodules.</li>
|
||
<li><strong>One that devvm can&rsquo;t copy,</strong> such as one whose <code>.git</code> doesn&rsquo;t lead to its own git folder inside the repo&rsquo;s, stays on this machine, with its own submodules, and devvm names it, while the rest of the copy goes on.</li>
|
||
<li><strong>A git worktree&rsquo;s VM</strong> gets none of its submodules, which devvm names.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="git-lfs">Git LFS<span class="hx:absolute hx:-mt-20" id="git-lfs"></span>
|
||
<a href="#git-lfs" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Every VM has <code>git-lfs</code>, and the copy sets up its filter in each clone it makes, so a repo that uses Git LFS works in its clone as it does here. A VM that mounts its folder gets no filter, so its LFS files are the pointers git stores. <code>devvm clone fetch</code> brings back the LFS objects of the VM&rsquo;s work too:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">git lfs ls-files <span class="c1"># in the VM&#39;s clone: the files, with their content</span>
|
||
</span></span><span class="line"><span class="cl">devvm clone fetch <span class="c1"># on this machine: the VM&#39;s branches and their LFS objects</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<ul>
|
||
<li><strong>Into the VM,</strong> the copy sends the LFS objects that the files you have checked out point to, when your repo has them, and <code>git-lfs</code> in the VM checks those files out with their content. One that isn&rsquo;t what its pointer names stays on this machine, and devvm names it, and when your repo keeps its objects outside <code>.git</code>, with <code>lfs.storage</code>, none go and devvm says so. A file whose object your repo hasn&rsquo;t fetched stays a pointer in the VM, as <code>git lfs pull</code> would fetch it, where the VM&rsquo;s network policy and credentials let it.</li>
|
||
<li><strong>Back from the VM,</strong> when <code>devvm clone fetch</code>, <code>devvm rm</code> or <code>devvm clone off</code> brings the VM&rsquo;s work back, devvm also brings the LFS objects that the work&rsquo;s pointers name and your repo lacks, each checked against its pointer before it goes into your repo, without <code>git-lfs</code> running on this machine. A plain <code>git fetch devvm</code> brings none, but <code>devvm clone fetch</code> later brings those of the commits it fetched too, even once you&rsquo;ve merged them. When the objects come to more than 2 GiB, devvm asks first, and without a terminal it refuses. One that the VM&rsquo;s clone lacks, or that isn&rsquo;t what its pointer names, stays out, and devvm names it. Before the VM goes, <code>devvm rm</code> and <code>devvm clone off</code> name the LFS objects that only the VM&rsquo;s clone has and ask, and an object they couldn&rsquo;t bring back keeps the VM (<a href="https://next.devvm.dev/docs/internals/git-protection/#git-lfs-in-the-copy">how it works</a>).</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="a-partial-clone">A partial clone<span class="hx:absolute hx:-mt-20" id="a-partial-clone"></span>
|
||
<a href="#a-partial-clone" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>When the VM&rsquo;s network policy blocks the remote a partial clone fetches its missing objects from, devvm names the remote&rsquo;s host, and on the allowlist tier you let the VM reach it:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm network allow github.com</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<ul>
|
||
<li><strong>A remote reached over ssh:</strong> devvm names the host with its port, such as <code>github.com:22</code>, which you allow as it&rsquo;s named.</li>
|
||
<li><strong>The none tier:</strong> move the VM to the allowlist tier with <code>devvm network allowlist</code> first.</li>
|
||
<li><strong>The internet tier:</strong> devvm names a host that one of your deny rules blocks, or that&rsquo;s a private address, which that tier never reaches.</li>
|
||
<li><strong>What the VM can&rsquo;t reach or doesn&rsquo;t get:</strong> devvm also names a remote that&rsquo;s on this machine, a <code>file://</code> URL or a path, a remote that stays here because its URL is of a kind devvm doesn&rsquo;t copy, and a branch or tag that points to an object the clone never fetched, which the VM&rsquo;s clone doesn&rsquo;t get.</li>
|
||
</ul>
|
||
<p>Fetching the VM&rsquo;s work back needs every object that work names, and git in the VM never fetches a missing object just to send it, so when the work names one the clone lacks, such as a file restored from an old commit, <code>devvm clone fetch</code> fails and says so. In the VM&rsquo;s clone, run a command that reads the work&rsquo;s objects, which fetches the missing ones from the remote, then fetch again from this machine:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">git show agent/search <span class="c1"># in the VM&#39;s clone, for each commit of the work</span>
|
||
</span></span><span class="line"><span class="cl">devvm clone fetch <span class="c1"># then on this machine</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="a-copy-that-didnt-finish">A copy that didn&rsquo;t finish<span class="hx:absolute hx:-mt-20" id="a-copy-that-didnt-finish"></span>
|
||
<a href="#a-copy-that-didnt-finish" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>If the copy fails, for example because the VM can&rsquo;t be reached or its disk is full, devvm copies again in full the next time you run it in the folder:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm <span class="c1"># in the folder, to copy again</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>The VM&rsquo;s repo counts as copied only once the whole copy is done, so a copy that stopped part way never leaves a clone that devvm thinks is complete. <code>devvm rm</code> and <code>devvm clone off</code> check a clone whose copy didn&rsquo;t finish as they check any other, so its commits and changes are never lost without a question (<a href="#deleting-the-vm">deleting the VM</a>). A copy that runs again keeps what the VM did meanwhile, and devvm names what it kept:</p>
|
||
<ul>
|
||
<li><strong>A branch that has commits from the VM</strong> stays as it is instead of moving to this machine&rsquo;s.</li>
|
||
<li><strong>HEAD stays where the VM put it</strong> when the VM checked out something else, such as a branch of its own, or moved its detached HEAD. That includes the case where you switched this repo between a branch and a detached HEAD since the copy that didn&rsquo;t finish. Your uncommitted changes, and a rebase or other operation in progress, would then apply to something else, so they stay on this machine.</li>
|
||
<li><strong>A file in the clone&rsquo;s folder that the VM wrote</strong> stays as it is, even where you have a change of your own. devvm names it when it&rsquo;s at a path you changed or deleted, or when it differs from what you&rsquo;ve staged, and <code>git status</code> in the VM shows it as changed.</li>
|
||
</ul>
|
||
<p>Running devvm in the folder again is also how a VM that an older devvm made, whose copy failed, gets its clone. An older devvm made every VM&rsquo;s repo with SHA-1 object names. When such a VM&rsquo;s copy failed and your repo uses SHA-256, its empty repo can&rsquo;t take your commits, so devvm asks before it deletes that empty repo&rsquo;s <code>.git</code> and makes it again. Only the repo is made again, never the VM. Without a terminal devvm leaves it and says what to run, which is devvm in a terminal, or devvm rm, then <code>devvm --clone</code>.</p>
|
||
<h2 data-hextra-search-id="the-remote">The remote<span class="hx:absolute hx:-mt-20" id="the-remote"></span>
|
||
<a href="#the-remote" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm adds a git remote for the VM to your repo. It&rsquo;s named <code>devvm</code>, or <code>devvm-&lt;folder&gt;</code> if <code>devvm</code> is already taken, or the VM&rsquo;s full name if both are. The remote&rsquo;s URL is the VM&rsquo;s full name followed by the clone&rsquo;s path, so git connects through devvm&rsquo;s ssh config, and fetching needs two things:</p>
|
||
<ul>
|
||
<li>Your <code>~/.ssh/config</code> needs devvm&rsquo;s <code>Include</code> line (<a href="https://next.devvm.dev/docs/using/ssh/#ssh-access-by-name">SSH access by name</a>). devvm offers to add it when it creates the clone, and again when you run <code>devvm host</code> or <code>devvm code</code>. Until the line is there, or when devvm had no terminal to ask in, fetch with <code>GIT_SSH_COMMAND='ssh -F ~/.local/share/devvm/ssh_config' git fetch devvm</code>.</li>
|
||
<li>The VM must be running. A stopped VM has no SSH entry, so <code>git fetch</code> fails because it can&rsquo;t resolve the name. Run <code>devvm</code> or <code>devvm host</code> in the folder first.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="fetching-the-vms-work">Fetching the VM&rsquo;s work<span class="hx:absolute hx:-mt-20" id="fetching-the-vms-work"></span>
|
||
<a href="#fetching-the-vms-work" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>git fetch devvm</code> in the repo fetches the VM&rsquo;s branches as <code>devvm/&lt;branch&gt;</code>, as for any remote. <code>devvm clone fetch</code> does the same for every repo the VM has a clone of, which is one repo here, or each repo of a <a href="#folders-of-repos">folder of repos</a>, and then lists the branches that are new or have moved since the last fetch, each with the repos it&rsquo;s in:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-console" data-lang="console"><span class="line"><span class="cl"><span class="gp">$</span> devvm clone fetch
|
||
</span></span><span class="line"><span class="cl"><span class="go">agent/search: backend, frontend
|
||
</span></span></span><span class="line"><span class="cl"><span class="go">main: backend
|
||
</span></span></span><span class="line"><span class="cl"><span class="go">==&gt; Review each branch in its repo before you merge it, such as with git log -p main..devvm/main.
|
||
</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm clone fetch</code> starts the VM if it&rsquo;s stopped. It connects to the VM itself, as the copy does, so it needs neither devvm&rsquo;s <code>Include</code> line in <code>~/.ssh/config</code> nor the VM&rsquo;s name in your ssh config. What it fetches:</p>
|
||
<ul>
|
||
<li><strong>Every branch of each clone</strong> into its repo&rsquo;s remote, as <code>devvm/&lt;branch&gt;</code>, and it never changes your own branches or tags.</li>
|
||
<li><strong>A detached HEAD&rsquo;s commits.</strong> When a clone&rsquo;s HEAD is detached at commits that no branch of the clone has and this repo hasn&rsquo;t fetched, such as an agent&rsquo;s work done without a branch, which <code>git fetch devvm</code> doesn&rsquo;t fetch, <code>devvm clone fetch</code> fetches them into a new local branch, <code>saved/devvm/HEAD</code>, and names it.</li>
|
||
<li><strong>Each stash entry the VM made,</strong> the same way, into <code>saved/devvm/stash-N</code>, after the entry&rsquo;s place in the VM&rsquo;s <code>git stash list</code>, but not the entries devvm copied in from this machine. An entry&rsquo;s untracked files go to a branch of their own, <code>saved/devvm/stash-N-untracked</code>, which devvm names, along with any of them that git ignores here, so <code>git stash apply saved/devvm/stash-N</code> never writes them. Look at them with <code>git show saved/devvm/stash-N-untracked</code> before you use them.</li>
|
||
<li><strong>The work&rsquo;s <a href="#git-lfs">Git LFS</a> objects,</strong> which <code>git fetch devvm</code> never brings.</li>
|
||
</ul>
|
||
<p>It never writes over a branch, so when <code>saved/devvm/</code> is taken, even by an earlier fetch&rsquo;s, it uses <code>saved/devvm-2/</code> and on, and it fetches nothing it has saved before. When a repo&rsquo;s remote is gone, <code>devvm clone fetch</code> adds it again. When you&rsquo;ve pointed the remote at another URL, or the folder on this machine isn&rsquo;t that repo any more, for example because its <code>.git</code> is gone, devvm leaves that repo alone and says so.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">git log -p main..devvm/main <span class="c1"># review each branch before you merge it</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Fetching runs nothing from the VM on this machine. git only receives objects, checking each one, and updates the <code>devvm/*</code> branches, or creates new <code>saved/devvm/*</code> branches, for a detached HEAD&rsquo;s commits, the VM&rsquo;s stash entries, or when <code>devvm rm</code> does the fetch. The commits themselves are untrusted, though, so treat them as you would a contributor&rsquo;s branch and review them before you merge them, check them out or run anything they change.</p>
|
||
<h2 data-hextra-search-id="subfolders">Subfolders<span class="hx:absolute hx:-mt-20" id="subfolders"></span>
|
||
<a href="#subfolders" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When you run devvm in a subfolder of the repo&rsquo;s folder, devvm uses the <code>--clone</code> VM as it uses any parent folder&rsquo;s VM (<a href="https://next.devvm.dev/docs/using/vms/#a-subfolder">a subfolder</a>). The clone is at the repo folder&rsquo;s path, so the subfolder&rsquo;s path in the VM is the same subfolder in the clone. When the clone has that subfolder, the shell opens there, and <code>devvm host</code> and <code>devvm code</code> give it as the folder to open. When the clone lacks it, for example because the subfolder is untracked or ignored and so never copied, they use the clone&rsquo;s top folder instead.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="nb">cd</span> src/api <span class="c1"># a subfolder of the repo</span>
|
||
</span></span><span class="line"><span class="cl">devvm <span class="c1"># the repo&#39;s --clone VM, its shell in src/api in the clone</span>
|
||
</span></span><span class="line"><span class="cl">devvm --clone <span class="c1"># a VM of the subfolder&#39;s own, when it&#39;s a repo&#39;s top folder</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm --clone</code> in a subfolder never uses a parent folder&rsquo;s VM. It makes a new <code>--clone</code> VM for the subfolder, as <code>devvm --here</code> does, and doesn&rsquo;t take <code>--parent</code>, so the subfolder must be the top folder of a repo of its own.</p>
|
||
<h2 data-hextra-search-id="several-agents-in-one-vm">Several agents in one VM<span class="hx:absolute hx:-mt-20" id="several-agents-in-one-vm"></span>
|
||
<a href="#several-agents-in-one-vm" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Several agents can work in one <code>--clone</code> VM, each on a branch of its own in a git worktree of its own, so each agent edits its own copy of the files. Put the worktrees inside the clone, such as in <code>.worktrees/NAME</code>, because the clone&rsquo;s parent folders in the VM belong to root, and so <code>git worktree add ../NAME</code> fails there. In the VM, in the clone:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="nb">echo</span> .worktrees/ &gt;&gt; .git/info/exclude <span class="c1"># once, so git status in the clone leaves the worktrees out</span>
|
||
</span></span><span class="line"><span class="cl">git worktree add -b agent/api .worktrees/api <span class="c1"># a worktree on a new branch, agent/api</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> .worktrees/api <span class="c1"># then start the agent here</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>What the agents in one VM share:</p>
|
||
<ul>
|
||
<li><strong>One repo.</strong> Every worktree shares the clone&rsquo;s repo, so the agents&rsquo; branches are all in it. One <code>git fetch devvm</code> on this machine brings every agent&rsquo;s branch back, such as <code>devvm/agent/api</code>, and you review each one as you would any of the VM&rsquo;s work (<a href="#fetching-the-vms-work">fetching the VM&rsquo;s work</a>). Before <code>devvm rm</code> deletes the VM, it also checks each worktree inside the clone for uncommitted changes (<a href="#deleting-the-vm">deleting the VM</a>).</li>
|
||
<li><strong>Not their dependencies.</strong> Install each worktree&rsquo;s dependencies in that worktree, and never share one <code>node_modules</code> folder between worktrees, because each branch can need different packages, and two agents installing at once can break it. pnpm and bun keep one package store in the VM and hard-link packages from it into each worktree&rsquo;s <code>node_modules</code> when both are on the same disk, so another worktree costs little download or disk.</li>
|
||
<li><strong>The VM&rsquo;s ports,</strong> so two servers on the same port collide. Give each worktree&rsquo;s server a port of its own, such as with <code>PORT=3001</code>. A VM that forwards every port, as new VMs do by default, forwards each of them to this machine&rsquo;s <code>localhost</code> (<a href="https://next.devvm.dev/docs/using/ports-size/#ports">ports</a>).</li>
|
||
<li><strong>The rest of the VM,</strong> its network tier and rules, its secrets, and its CPUs, memory and disk, and each agent can read and change every other agent&rsquo;s worktree.</li>
|
||
</ul>
|
||
<p>When the agents need different network tiers or rules, secrets or sizes, or when one agent mustn&rsquo;t reach another&rsquo;s work, give each agent a folder of its own on this machine, such as a separate clone of the repo, and run <code>devvm --clone</code> in each, so each gets a VM of its own.</p>
|
||
<h2 data-hextra-search-id="folders-of-repos">Folders of repos<span class="hx:absolute hx:-mt-20" id="folders-of-repos"></span>
|
||
<a href="#folders-of-repos" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A project is often several repos in one folder, such as a <code>frontend</code> that uses <code>file:../shared</code> in its <code>package.json</code>, or a .NET solution whose projects point at <code>../Lib/Lib.csproj</code>. <code>devvm --clone</code> in that folder gives one VM a clone of each repo you choose, each at the same path as on this machine, so the paths between them work in the VM as they do here. The folder can be a repo itself or not, and when it is one, you ask for this with <code>--repos</code>, because without it <code>devvm --clone</code> there gives the VM a clone of the folder&rsquo;s own repo alone, as for any repo, whatever repos are below it.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">my-repos/
|
||
</span></span><span class="line"><span class="cl">├── docker-compose.yml
|
||
</span></span><span class="line"><span class="cl">├── frontend/ (a repo)
|
||
</span></span><span class="line"><span class="cl">├── backend/ (a repo)
|
||
</span></span><span class="line"><span class="cl">└── shared/ (a repo)</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="nb">cd</span> my-repos
|
||
</span></span><span class="line"><span class="cl">devvm --clone <span class="c1"># choose the repos, then create the VM and open a shell in my-repos</span>
|
||
</span></span><span class="line"><span class="cl">devvm --clone --repos frontend,shared <span class="c1"># or choose them on the command line, as a script must</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>devvm looks for repos up to four folders below this one, as <a href="https://next.devvm.dev/docs/safety/git-protection/#nested-repos"><code>.git</code> protection</a> does, and skips the folders of packages and build tools, such as <code>node_modules</code> and <code>vendor</code>. In a terminal, it lists the repos it found in a picker, each ticked, and you untick those the VM doesn&rsquo;t need. A repo that <code>--clone</code> can&rsquo;t copy is listed under its own heading with the reason, such as a repo without commits or one whose <code>.git</code> points into another repo, and it can&rsquo;t be ticked. devvm lists at most 100 repos, and it names how many more it found. A linked worktree of a repo in the folder, such as one in <code>.worktrees/NAME</code>, isn&rsquo;t a repo of its own, so devvm doesn&rsquo;t list it, and its repo&rsquo;s clone gets every branch of that repo, the worktree&rsquo;s own included. A repo can&rsquo;t be ticked when:</p>
|
||
<ul>
|
||
<li><strong><code>--clone</code> can&rsquo;t copy it,</strong> such as a repo without commits or one whose <code>.git</code> points into another repo. It&rsquo;s listed under its own heading with the reason.</li>
|
||
<li><strong>Its folder&rsquo;s name has a character a terminal can&rsquo;t show,</strong> such as a line break or a bidi control.</li>
|
||
<li><strong>Another VM mounts it,</strong> because that VM is a subfolder&rsquo;s that holds the repo, or the repo&rsquo;s own, or, for a linked worktree, the VM of the repo it belongs to. Code in that VM could swap the repo for another while devvm&rsquo;s git works in it, so devvm names that VM, and <code>devvm clone add</code> refuses the repo too. Delete that VM, or move the repo out of its folder, to give this VM a clone of it.</li>
|
||
</ul>
|
||
<p>Without a terminal, or with <code>--no-input</code>, give <code>--repos</code>, or devvm refuses without creating anything:</p>
|
||
<ul>
|
||
<li><code>--repos all</code> takes every repo <code>--clone</code> can copy.</li>
|
||
<li><code>--repos none</code> takes none of them.</li>
|
||
<li>A list, such as <code>--repos frontend,backend</code>, takes those repos, by their folders relative to this one, with <code>.</code> for this folder&rsquo;s own repo.</li>
|
||
</ul>
|
||
<p>devvm names each repo you chose that it can&rsquo;t copy, and leaves it out, and it records your choice in the VM&rsquo;s state, never in the folder. When devvm finds no repo below this folder that it can copy, <code>devvm --clone</code> gives the VM a clone of this folder&rsquo;s own repo, as for a folder that holds no other, and the folder must then be one (<a href="#requirements">requirements</a>). A folder of repos inside another repo&rsquo;s working tree is refused, because devvm would copy that repo&rsquo;s files. To clone repos in it, run <code>devvm --clone --repos LIST</code> in that repo&rsquo;s top folder, and choose them there. Each repo&rsquo;s clone:</p>
|
||
<ul>
|
||
<li><strong>Gets the same refs as a single repo&rsquo;s</strong> (<a href="#whats-copied">what&rsquo;s copied</a>), every branch, tag and remote-tracking branch, checked out as the repo is here. When a repo&rsquo;s HEAD is detached, its clone is detached at the same commit, and devvm says so. A repo that is a linked worktree of a repo outside the folder gets what <a href="#a-git-worktree">a worktree&rsquo;s clone</a> gets.</li>
|
||
<li><strong>Gets a remote of its own for the VM,</strong> named as for one repo&rsquo;s clone (<a href="#the-remote">the remote</a>): <code>devvm</code>, or <code>devvm-&lt;folder&gt;</code> when that repo already has a <code>devvm</code> remote, for example from a VM of its own. One repo&rsquo;s remote names never change the others&rsquo;. When a repo has all three names taken, devvm leaves that repo out and names it.</li>
|
||
<li><strong>Leaves the other repos&rsquo; clones out of its <code>git status</code>,</strong> when it&rsquo;s the folder&rsquo;s own repo&rsquo;s, and what your repo&rsquo;s <code>.git/info/exclude</code> leaves out too, such as <code>.worktrees/</code>, so the other clones aren&rsquo;t changes <code>devvm rm</code> asks about.</li>
|
||
<li><strong>Is left out and named</strong> when its repo no longer passes the checks as the copy is made, for example because its last commit went, and the others are copied. When the copy fails, devvm copies what&rsquo;s left the next time you run it in the folder.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="the-folders-own-files">The folder&rsquo;s own files<span class="hx:absolute hx:-mt-20" id="the-folders-own-files"></span>
|
||
<a href="#the-folders-own-files" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>A folder of repos often has files of its own at its top, outside every repo, such as a <code>docker-compose.yml</code>, a <code>Makefile</code> or an <code>.envrc</code>. When the folder isn&rsquo;t a repo itself, devvm copies these into the VM once, when it creates the clone, at the same paths. It never copies them again, and nothing comes back from the VM, so a later change on either side stays there. To change one in the VM, edit it there, and to bring a change back, copy it out yourself, for example with <code>scp</code> and the VM&rsquo;s name, which <code>devvm host</code> shows:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm host <span class="c1"># start the VM and show its name</span>
|
||
</span></span><span class="line"><span class="cl">scp devvm-my-repos-&lt;hash&gt;:/path/to/my-repos/docker-compose.yml . <span class="c1"># copy the VM&#39;s version back</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>devvm copies the files and folders outside every repo, whether the VM has a clone of that repo or not. It keeps each file&rsquo;s permissions but its set-user-id and set-group-id bits, and a link that leads to a path in the folder, as a link. It reads only beneath the folder, one folder at a time, and never through a link. It leaves out:</p>
|
||
<ul>
|
||
<li>a <code>.git</code>, a folder shaped like one, such as a bare repo&rsquo;s, and the folders of packages and build tools, such as <code>node_modules</code>, <code>vendor</code> and <code>.venv</code></li>
|
||
<li>a link that leads out of the folder, a file with another hard link, sockets and other special files, and anything on another disk</li>
|
||
<li>a file over 10 MiB, and the files past 64 MiB or 5,000 entries in all</li>
|
||
</ul>
|
||
<p>devvm says how many of the files it left out. When the folder is a repo itself, its files are its repo&rsquo;s, so devvm copies none of them this way. A secret in one of these files, such as an <code>.env</code> at the folder&rsquo;s top, reaches the VM as any other file does, so move it out of the folder before <code>devvm --clone</code> when the VM mustn&rsquo;t have it. devvm refuses the folders it refuses to mount, such as your home folder (<a href="https://next.devvm.dev/docs/using/settings/#project-folders-devvm-refuses">folders devvm refuses</a>), because it would copy their files.</p>
|
||
<h3 data-hextra-search-id="opening-a-repos-folder">Opening a repo&rsquo;s folder<span class="hx:absolute hx:-mt-20" id="opening-a-repos-folder"></span>
|
||
<a href="#opening-a-repos-folder" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>In a folder of one of the VM&rsquo;s repos, such as <code>my-repos/frontend</code>, <code>devvm</code> opens the folder&rsquo;s VM at that repo&rsquo;s path, as it opens any parent folder&rsquo;s VM in a <a href="https://next.devvm.dev/docs/using/vms/#a-subfolder">subfolder</a>. A repo of its own in a subfolder usually gets a VM of its own, but the folder&rsquo;s VM has this repo&rsquo;s clone at the same path and mounts nothing of this machine, so the VM can&rsquo;t reach the repo&rsquo;s folder here. <code>devvm --here</code> in the repo&rsquo;s folder still creates or opens that repo&rsquo;s own VM. In a repo the VM has no clone of, <code>devvm</code> doesn&rsquo;t use the folder&rsquo;s VM.</p>
|
||
<h3 data-hextra-search-id="adding-a-repo">Adding a repo<span class="hx:absolute hx:-mt-20" id="adding-a-repo"></span>
|
||
<a href="#adding-a-repo" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm clone add PATH</code> copies one more repo into the VM, such as a repo you cloned into the folder after the VM was made, or one that you left out. PATH is the repo&rsquo;s folder, relative to the folder you run it in, and it must be inside the VM&rsquo;s folder. devvm checks the repo as it checks each repo it copies, starts the VM if it&rsquo;s stopped, copies the repo&rsquo;s current and default branches to the same path in the VM and adds its remote. When the copy fails, for example because the VM can&rsquo;t be reached, devvm keeps the repo in the VM&rsquo;s list, so <code>devvm rm</code> still checks what reached the VM, and running <code>devvm clone add PATH</code> again copies it again.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">git clone [email protected]:me/docs.git
|
||
</span></span><span class="line"><span class="cl">devvm clone add docs</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>A repo made in the VM stays in the VM, because the VM can&rsquo;t add a repo to this machine. To bring it out, clone it from the VM with <code>git clone devvm-my-repos-&lt;hash&gt;:/path/to/my-repos/new</code>, using the VM&rsquo;s full name from <code>devvm ls</code>.</p>
|
||
<h3 data-hextra-search-id="agents-across-repos">Agents across repos<span class="hx:absolute hx:-mt-20" id="agents-across-repos"></span>
|
||
<a href="#agents-across-repos" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>An agent that works on one change across repos uses one branch name in each repo, such as <code>agent/search</code> in <code>frontend</code> and in <code>backend</code>, so <code>devvm clone fetch</code> lists that change as one line with both repos. For several agents at once, give each its own folder with a worktree of each repo, inside the VM&rsquo;s folder:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="k">for</span> r in frontend backend<span class="p">;</span> <span class="k">do</span> git -C <span class="s2">&#34;</span><span class="nv">$r</span><span class="s2">&#34;</span> worktree add -b agent/search <span class="s2">&#34;../.worktrees/search/</span><span class="nv">$r</span><span class="s2">&#34;</span><span class="p">;</span> <span class="k">done</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> .worktrees/search <span class="c1"># the change&#39;s own copy of the folder&#39;s repos, then start the agent here</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>devvm copies the folder&rsquo;s own files only into the folder itself, so copy those the agent needs into the change&rsquo;s folder too. <code>devvm rm</code> checks each worktree inside the VM&rsquo;s folder for uncommitted changes, whichever repo it belongs to (<a href="#deleting-the-vm">deleting the VM</a>).</p>
|
||
<h2 data-hextra-search-id="deleting-the-vm">Deleting the VM<span class="hx:absolute hx:-mt-20" id="deleting-the-vm"></span>
|
||
<a href="#deleting-the-vm" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm clone fetch <span class="c1"># fetch the VM&#39;s work first, so the check finds it fetched</span>
|
||
</span></span><span class="line"><span class="cl">devvm rm <span class="c1"># check for unfetched work and uncommitted changes, then ask</span>
|
||
</span></span><span class="line"><span class="cl">devvm rm --no-clone-check <span class="c1"># skip both checks, so the VM&#39;s work goes with it</span>
|
||
</span></span><span class="line"><span class="cl">git branch -D saved/devvm/main <span class="c1"># delete a saved branch once you&#39;ve reviewed it</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Before <code>devvm rm</code> deletes a <code>--clone</code> VM, it checks the clone for work you&rsquo;d lose. It starts a stopped VM for the check as a launch does, so the VM&rsquo;s confinement is checked first:</p>
|
||
<ol>
|
||
<li><strong>Work this repo hasn&rsquo;t fetched.</strong> devvm names it and offers to fetch it into new local branches:
|
||
<ul>
|
||
<li><strong>Branches with commits this repo hasn&rsquo;t fetched</strong> go into <code>saved/devvm/&lt;branch&gt;</code>. devvm skips a branch whose name git on this machine refuses and names it, and that branch goes with the VM. To keep such a branch, rename it in the VM with <code>git branch -m</code> before you run <code>devvm rm</code>.</li>
|
||
<li><strong>A detached HEAD&rsquo;s commits,</strong> when the clone&rsquo;s HEAD is detached at commits that no branch of the clone has and this repo hasn&rsquo;t fetched, such as an agent&rsquo;s work done without a branch, are named as <code>HEAD</code> and go into <code>saved/devvm/HEAD</code>.</li>
|
||
<li><strong>A stash entry the VM made,</strong> which this repo hasn&rsquo;t fetched, is named as <code>stash-N</code>, after its place in the VM&rsquo;s <code>git stash list</code>, and goes into <code>saved/devvm/stash-N</code>, from which <code>git stash apply saved/devvm/stash-0</code> applies it here, its untracked files apart, as <code>devvm clone fetch</code> saves them (<a href="#fetching-the-vms-work">fetching the VM&rsquo;s work</a>). When devvm can&rsquo;t fetch an entry, it keeps the VM. The stash entries devvm copied in from this machine don&rsquo;t count.</li>
|
||
</ul>
|
||
</li>
|
||
<li><strong>Uncommitted changes</strong> in the clone or a worktree inside its folder. devvm lists the first 20 of them in all, with each worktree&rsquo;s changes under its path, and asks before deleting them along with the VM:
|
||
<ul>
|
||
<li><strong>The changes devvm copied in</strong> from this machine don&rsquo;t count while the VM leaves them as they came, because they&rsquo;re your work, not the VM&rsquo;s, even if you&rsquo;ve changed or undone them here since. Once the VM changes one of those files, its permissions or what&rsquo;s staged for it, devvm lists it as the VM&rsquo;s work.</li>
|
||
<li><strong>A worktree whose HEAD is detached</strong> at commits that nothing else in the clone has, no branch, tag or remote-tracking branch, counts the same way: devvm names it and asks, because those commits go with the VM. To keep them, run <code>git switch -c NAME</code> in that worktree, then fetch the branch.</li>
|
||
<li><strong>Worktrees it skips:</strong> one whose folder is gone or that git would prune, and those outside the clone&rsquo;s folder. When the clone has more than 100 worktrees inside its folder, devvm checks the first 100 and asks before deleting the VM, even if none of them has changes. Worktrees outside the folder don&rsquo;t count towards the 100. The worktrees that opencode makes in the VM&rsquo;s home folder are checked apart, as for any VM with opencode, and devvm asks about them in the same question (<a href="https://next.devvm.dev/docs/using/coding-agents/#opencodes-worktrees">opencode&rsquo;s worktrees</a>).</li>
|
||
</ul>
|
||
</li>
|
||
</ol>
|
||
<p>If either check finds something and there&rsquo;s no terminal to ask in, or you give <code>--no-input</code>, devvm refuses and keeps the VM. These questions are asked only in a terminal, because only you can judge the work, so <code>--force</code> never answers them (<a href="https://next.devvm.dev/docs/using/command-line/#questions-devvm-asks">questions devvm asks</a>). Without a terminal, when the clone has work this repo hasn&rsquo;t fetched, devvm&rsquo;s refusal names <code>devvm clone fetch</code>: run it first, and the check finds every branch, a detached HEAD&rsquo;s commits and the VM&rsquo;s stash entries fetched, in every repo of a folder of repos too. Two cases check more:</p>
|
||
<ul>
|
||
<li><strong>A <a href="#folders-of-repos">folder of repos</a>.</strong> devvm checks every repo the VM has a clone of, reading them all from the VM at once, and names the repo of each branch and each change it lists. It asks once whether to fetch the unfetched branches of every repo, each into that repo&rsquo;s <code>saved/&lt;remote&gt;/&lt;branch&gt;</code> branches, and once before the uncommitted changes go, with the first 20 changes in all the repos shown. A repo whose copy didn&rsquo;t finish is checked too when its clone is in the VM. Beyond that:
|
||
<ul>
|
||
<li>When a repo&rsquo;s clone isn&rsquo;t at its path in the VM, for example because something in the VM moved it, devvm says so and asks before deleting the VM, as for uncommitted changes.</li>
|
||
<li>When a repo on this machine isn&rsquo;t the repo the VM has a clone of any more, for example because its <code>.git</code> is gone, devvm refuses and keeps the VM, because git there would read another repo, so put the repo back, or give <code>--no-clone-check</code>.</li>
|
||
<li>devvm doesn&rsquo;t check the VM&rsquo;s copy of the folder&rsquo;s own files, nor anything else outside the repos, so copy out what you need of those first.</li>
|
||
</ul>
|
||
</li>
|
||
<li><strong>A repo that another VM mounts,</strong> such as the VM of a folder the repo is in. Code in that VM could swap the repo under devvm&rsquo;s git, so devvm runs no git in it on this machine. It still checks the clone in the VM, and every other repo of a folder of repos, but it can&rsquo;t fetch the clone&rsquo;s work into the repo, so it names that VM and asks before deleting, as for uncommitted changes, and without a terminal it refuses and keeps the VM. Fetch the work by hand first if you need it, then give <code>--no-clone-check</code>.</li>
|
||
</ul>
|
||
<p>Once the checks pass, devvm deletes the VM. If the remote still points at the VM, devvm then removes it with <code>git remote remove</code>, in each repo of a folder of repos too, which also deletes its <code>devvm/*</code> branches and their upstream settings. Before it does, devvm keeps every <code>devvm/*</code> branch that has commits no other branch has as a new local branch, named after the remote as <code>saved/&lt;remote&gt;/&lt;branch&gt;</code>, whoever fetched it. devvm never overwrites a branch, so when one is in the way, it uses <code>saved/&lt;remote&gt;-2</code>, then <code>-3</code> and so on, and if it finds no free name, <code>devvm rm</code> refuses and keeps the VM (<a href="https://next.devvm.dev/docs/internals/overview/#saved-branches">saved branches</a>). devvm names each branch it creates, and they&rsquo;re yours to review, merge or delete.</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Flag</th>
|
||
<th>What it skips</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>--force</code></td>
|
||
<td>only the question whether to delete the VM at all, so both checks still run</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--no-export</code></td>
|
||
<td>the export of the agents&rsquo; history, and it leaves both checks as they are</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--no-clone-check</code></td>
|
||
<td>both checks, so the VM goes with the commits this repo hasn&rsquo;t fetched and the uncommitted changes, and devvm warns you of that first</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>Use <code>--no-clone-check</code> when a check can&rsquo;t read the clone, such as when git in the VM is broken or the VM doesn&rsquo;t answer within 2 minutes, and devvm refuses and keeps the VM. Use it too when the VM doesn&rsquo;t start for the check, such as when its tier isn&rsquo;t enforced, because devvm then says what kept it from starting and keeps the VM. devvm still asks whether to delete the VM unless you also give <code>--force</code>, and it still keeps the <code>devvm/*</code> branches you fetched as <code>saved/devvm/</code> branches.</p>
|
||
<h2 data-hextra-search-id="switching-a-vm-that-exists">Switching a VM that exists<span class="hx:absolute hx:-mt-20" id="switching-a-vm-that-exists"></span>
|
||
<a href="#switching-a-vm-that-exists" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>devvm clone</code> shows whether this folder&rsquo;s VM has its own clone of the repo, which is <code>on</code>, or mounts the folder, which is <code>off</code>. <code>devvm clone on</code> and <code>devvm clone off</code> switch the VM by making it again from the image it has, as <a href="https://next.devvm.dev/docs/using/images/#adding-layers-to-a-vm"><code>devvm layer add</code></a> does, and then open a shell in it:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm clone <span class="c1"># show on or off</span>
|
||
</span></span><span class="line"><span class="cl">devvm clone on <span class="c1"># make the VM again with its own clone of the repo, after asking</span>
|
||
</span></span><span class="line"><span class="cl">devvm clone off <span class="c1"># fetch the clone&#39;s work, then make the VM again with this folder mounted</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>The VM keeps its home folder and its settings, as <a href="https://next.devvm.dev/docs/using/images/#what-a-vm-made-again-keeps">a VM made again</a> does, and everything else on its disk is lost. So in a terminal devvm asks first, with no as the default, and without one it refuses unless you give <code>--force</code>. <code>--no-export</code> skips the export of the agents&rsquo; history, and <code>--clean-home</code> gives the VM the image&rsquo;s home folder instead of its own, as for <code>devvm layer add</code>. When the VM is in the mode you ask for already, devvm says so and changes nothing.</p>
|
||
<p><code>devvm clone on</code>:</p>
|
||
<ul>
|
||
<li><strong>Needs a folder that <code>--clone</code> takes</strong> (<a href="#requirements">requirements</a>), and devvm refuses before it changes anything when the folder isn&rsquo;t one. In a <a href="#folders-of-repos">folder of repos</a>, devvm asks which repos the new VM gets in the picker before it asks to make the VM again, and <code>devvm clone on --repos LIST</code> answers that without a terminal.</li>
|
||
<li><strong>Loses only the VM&rsquo;s disk,</strong> because your work is in the folder. The new VM mounts nothing of the folder, and as it starts, devvm copies your branches into its clone and adds <a href="#the-remote">the remote</a>, as for a new <code>--clone</code> VM (<a href="#whats-copied">what&rsquo;s copied</a>).</li>
|
||
<li><strong>Takes the <a href="https://next.devvm.dev/docs/safety/git-protection/"><code>.git</code> locks</a> off the folder</strong> once the new VM is ready and the old one is deleted, because no VM mounts it any more. First it names what the old VM changed that the locks can&rsquo;t stop, as a launch does (<a href="https://next.devvm.dev/docs/safety/git-protection/#when-devvm-reports-git">when devvm reports .git</a>).</li>
|
||
</ul>
|
||
<p><code>devvm clone off</code>:</p>
|
||
<ul>
|
||
<li><strong>Checks the clone first,</strong> as <code>devvm rm</code> does (<a href="#deleting-the-vm">deleting the VM</a>), every repo of a folder of repos included, because the clone is on the VM&rsquo;s disk and goes with it. It offers to fetch the branches this repo hasn&rsquo;t fetched into <code>saved/devvm/&lt;branch&gt;</code> branches, and it asks before the clone&rsquo;s uncommitted changes go. Only a terminal can answer these questions, and <code>--force</code> never does, so without a terminal, or with <code>--no-input</code>, devvm refuses and keeps the VM as it is. <code>devvm clone off --no-clone-check</code> skips the check after a warning, and the clone&rsquo;s unfetched commits and uncommitted changes are lost.</li>
|
||
<li><strong>Mounts the folder again</strong> with <code>.git</code> protection as a new VM gets it, which is <code>on</code> on macOS and <code>off</code> on Linux hosts.</li>
|
||
<li><strong>Removes the remote</strong> before the new VM first starts, and before devvm locks <code>.git</code>, and keeps each <code>devvm/*</code> branch that has commits no other branch has as a <code>saved/devvm/</code> branch, as <code>devvm rm</code> does. If the switch is then undone, devvm adds the remote back.</li>
|
||
</ul>
|
||
<p>When a step fails, or you press Ctrl+C, before the new VM has its home folder, devvm puts the old VM back as it was, in its old mode, as it does for <a href="https://next.devvm.dev/docs/using/images/#adding-layers-to-a-vm">any remake</a>.</p>
|
||
<p>A <code>--clone</code> VM keeps its clone on its own disk, so <code>devvm layer add</code>, <code>devvm layer rm</code> and <code>devvm update</code> refuse it. To change its layers or bring it up to date, switch it off first:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm clone off <span class="c1"># fetch the clone&#39;s work, then mount the folder</span>
|
||
</span></span><span class="line"><span class="cl">devvm update <span class="c1"># or devvm layer add or devvm layer rm</span>
|
||
</span></span><span class="line"><span class="cl">devvm clone on <span class="c1"># its own clone again</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="devvm-clone-json">devvm clone &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-clone-json"></span>
|
||
<a href="#devvm-clone-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm clone --json</code> prints one JSON object with <code>clone</code>, which is <code>on</code> or <code>off</code>, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes. With <code>--json</code> the command only shows, so devvm refuses <code>on</code> or <code>off</code> with it, and the flags that go with them.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;clone&#34;</span><span class="p">:</span> <span class="s2">&#34;on&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="devvm-clone-fetch-json">devvm clone fetch &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-clone-fetch-json"></span>
|
||
<a href="#devvm-clone-fetch-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm clone fetch --json</code> fetches as <code>devvm clone fetch</code> does, then prints one JSON object instead of the list. <code>repos</code> has each repo with new or moved branches, or with its detached HEAD&rsquo;s commits or stash entries saved, by its folder relative to this one (<code>.</code> for this folder&rsquo;s own repo), with its remote, those <code>branches</code>, and <code>saved</code>, the local branches the detached HEAD&rsquo;s commits and the stash entries went into, when there are any. <code>branches</code> has the same branches by name, each with its <code>repos</code>, sorted by name. Both are empty when nothing is new.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;repos&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;path&#34;</span><span class="p">:</span> <span class="s2">&#34;backend&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;remote&#34;</span><span class="p">:</span> <span class="s2">&#34;devvm&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;branches&#34;</span><span class="p">:</span> <span class="p">[</span><span class="s2">&#34;agent/search&#34;</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;path&#34;</span><span class="p">:</span> <span class="s2">&#34;frontend&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;remote&#34;</span><span class="p">:</span> <span class="s2">&#34;devvm&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;branches&#34;</span><span class="p">:</span> <span class="p">[</span><span class="s2">&#34;agent/search&#34;</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;branches&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;agent/search&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;repos&#34;</span><span class="p">:</span> <span class="p">[</span><span class="s2">&#34;backend&#34;</span><span class="p">,</span> <span class="s2">&#34;frontend&#34;</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div></description></item><item><title>devcontainer.json</title><link>https://next.devvm.dev/docs/using/devcontainer/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/devcontainer/</guid><description>
|
||
<p>devvm supports the <a href="https://containers.dev/" target="_blank" rel="noopener">Dev Container specification</a>, so a project&rsquo;s <code>devcontainer.json</code> sets up its VM. When you run devvm in a folder with a <code>.devcontainer/devcontainer.json</code>, or else a <code>.devcontainer.json</code> at the folder&rsquo;s root, the new VM gets that file&rsquo;s settings by default, as far as devvm supports them. To make the VM without reading the file, run <code>devvm --no-devcontainer</code>.</p>
|
||
<p>The settings devvm supports are the container image to start from, the features devvm has layers for, the ports, the environment and the commands. devvm says in one line which file it read.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-jsonc" data-lang="jsonc"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;image&#34;</span><span class="p">:</span> <span class="s2">&#34;mcr.microsoft.com/devcontainers/javascript-node:22&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;features&#34;</span><span class="p">:</span> <span class="p">{</span> <span class="nt">&#34;ghcr.io/devcontainers/features/docker-in-docker:2&#34;</span><span class="p">:</span> <span class="p">{}</span> <span class="p">},</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;forwardPorts&#34;</span><span class="p">:</span> <span class="p">[</span><span class="mi">3000</span><span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;remoteEnv&#34;</span><span class="p">:</span> <span class="p">{</span> <span class="nt">&#34;PATH&#34;</span><span class="p">:</span> <span class="s2">&#34;${containerEnv:PATH}:${containerWorkspaceFolder}/bin&#34;</span> <span class="p">},</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;postCreateCommand&#34;</span><span class="p">:</span> <span class="s2">&#34;npm ci&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;postStartCommand&#34;</span><span class="p">:</span> <span class="s2">&#34;npm run db:start&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="when-its-read">When it&rsquo;s read<span class="hx:absolute hx:-mt-20" id="when-its-read"></span>
|
||
<a href="#when-its-read" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><ul>
|
||
<li><strong>When the folder&rsquo;s VM is made, and again by <code>devvm update</code>.</strong> Comments and trailing commas are allowed. devvm reads the file only within the folder, so it doesn&rsquo;t follow a link out of the folder, and it reads only a regular file of up to 1 MiB. devvm never writes anything to the project folder.</li>
|
||
<li><strong>What you give on the command line wins.</strong> <code>--from</code> wins over <code>image</code>, which wins over <code>$DEVVM_FROM</code>, and <code>--ports</code> wins over <code>forwardPorts</code>, and devvm says so in one line for each. The new VM gets the toolchains and layers that the features map to, which its summary shows, and when you customize the VM, they&rsquo;re already chosen in its list, each row naming the file, so you can leave them out there. <code>--tools</code> and <code>--layers</code> replace them, as they replace any part&rsquo;s default (<a href="https://next.devvm.dev/docs/using/images/#what-a-new-vm-gets">what a new VM gets</a>).</li>
|
||
<li><strong>An existing VM changes only when devvm makes it again.</strong> Its state records the file&rsquo;s SHA-256. When the file differs from it on a launch, or is gone, or has appeared since, devvm warns once and names <code>devvm update</code>. devvm doesn&rsquo;t check a VM made with <code>--no-devcontainer</code>, and <code>devvm update</code> doesn&rsquo;t read the file for it.</li>
|
||
</ul>
|
||
<p>A new VM takes each of these from the first place that sets it.</p>
|
||
<div class="devvm-diagram" style="contain-intrinsic-block-size: auto 454px; --devvm-diagram-width: 552px"><svg xmlns="http://www.w3.org/2000/svg" class="pele pele-flowchart" viewBox="0 0 552 454" width="552" height="454" style="--_bg:var(--pele-bg,#fff);--_fg:var(--pele-fg,#1f1f1f);--_m:var(--pele-muted,#6e6e6e);--_l:var(--pele-line,#1f1f1f);--_s:var(--pele-surface,#f3f3f3);--_a:var(--pele-surface-alt,#e6e6e6);--_b:var(--pele-border,#8a8a8a);--_c:var(--pele-accent,#5b7bd5);color:var(--_fg);--_r:var(--pele-radius,4px);--_fm:var(--pele-font-mono,&quot;Departure Mono&quot;, monospace);font:14px sans-serif;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;font-family:var(--pele-font,&quot;Departure Mono&quot;, monospace)" fill="var(--_fg)" role="graphics-document document" aria-roledescription="flowchart" aria-labelledby="df5f80836d0303045--title" aria-describedby="df5f80836d0303045--desc"><title id="df5f80836d0303045--title">Where a new VM's ports and base come from</title><desc id="df5f80836d0303045--desc">A new VM's ports are --ports, or else your ports with the file's forwardPorts added. Its base starts from --from, or else the file's image, or else $DEVVM_FROM, or else Ubuntu's cloud image.</desc><g class="pele-clusters"><g class="pele-cluster" data-id="base"><rect x="289.36" y="8" width="254.18" height="438" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-cluster-label" fill="var(--_m)" x="392.45" y="31.4" text-anchor="middle">Its base starts from</text>
|
||
</g><g class="pele-cluster" data-id="ports"><rect x="8" y="112.5" width="236.36" height="229" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-cluster-label" fill="var(--_m)" x="62.09" y="135.9" text-anchor="middle">Its ports</text>
|
||
</g></g><g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round"><g class="pele-edge" data-id="L_flag_fwd_0"><path d="M126.18,194.5L126.18,254.5"/><path class="pele-marker" d="M126.18,261.5L122.82,253.5L129.54,253.5Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_from_image_0"><path d="M416.45,90L416.45,150"/><path class="pele-marker" d="M416.45,157L413.09,149L419.81,149Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_image_env_0"><path d="M416.45,202L416.45,262"/><path class="pele-marker" d="M416.45,269L413.09,261L419.81,261Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_env_ubuntu_0"><path d="M416.45,314L416.45,374"/><path class="pele-marker" d="M416.45,381L413.09,373L419.81,373Z" fill="var(--_l)" stroke="none"/></g></g><g class="pele-edge-labels" font-size="14"><g class="pele-edge-label" data-id="L_flag_fwd_0"><rect x="91" y="219" width="70.36" height="18" rx="3" fill="var(--_bg)"/><text x="126.18" y="232.2" text-anchor="middle">or else</text>
|
||
</g><g class="pele-edge-label" data-id="L_from_image_0"><rect x="381.27" y="114.5" width="70.36" height="18" rx="3" fill="var(--_bg)"/><text x="416.45" y="127.7" text-anchor="middle">or else</text>
|
||
</g><g class="pele-edge-label" data-id="L_image_env_0"><rect x="381.27" y="226.5" width="70.36" height="18" rx="3" fill="var(--_bg)"/><text x="416.45" y="239.7" text-anchor="middle">or else</text>
|
||
</g><g class="pele-edge-label" data-id="L_env_ubuntu_0"><rect x="381.27" y="338.5" width="70.36" height="18" rx="3" fill="var(--_bg)"/><text x="416.45" y="351.7" text-anchor="middle">or else</text>
|
||
</g></g><g class="pele-nodes"><g class="pele-node pele-shape-rect" data-id="flag" transform="translate(126.18,172)"><rect x="-49.18" y="-22.5" width="98.36" height="45" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="0" y="4.9" text-anchor="middle">--ports</text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="fwd" transform="translate(126.18,291.5)"><rect x="-98.18" y="-30" width="196.36" height="60" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.1">your ports, with</tspan><tspan x="0" y="13.9">forwardPorts added</tspan></text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="from" transform="translate(416.45,67.5)"><rect x="-44.73" y="-22.5" width="89.45" height="45" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="0" y="4.9" text-anchor="middle">--from</text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="image" transform="translate(416.45,179.5)"><rect x="-89.27" y="-22.5" width="178.55" height="45" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="0" y="4.9" text-anchor="middle">the file's image</text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="env" transform="translate(416.45,291.5)"><rect x="-67" y="-22.5" width="134" height="45" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="0" y="4.9" text-anchor="middle">$DEVVM_FROM</text>
|
||
</g><g class="pele-node pele-shape-rect" data-id="ubuntu" transform="translate(416.45,403.5)"><rect x="-107.09" y="-22.5" width="214.18" height="45" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="0" y="4.9" text-anchor="middle">Ubuntu's cloud image</text>
|
||
</g></g></svg></div><p>When devvm refuses something in the file, it stops with one line that names the file, before it makes anything. For invalid JSON, it names the line and column.</p>
|
||
<h2 data-hextra-search-id="updating-a-vm-from-the-file">Updating a VM from the file<span class="hx:absolute hx:-mt-20" id="updating-a-vm-from-the-file"></span>
|
||
<a href="#updating-a-vm-from-the-file" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When you change the file, run <code>devvm update</code>. devvm reads the file as it is now, and before it changes anything, it refuses what it would refuse for a new VM. Then it asks to make the VM again from the file, keeping its home folder, the project folder and its settings, as for an <a href="https://next.devvm.dev/docs/using/images/#outdated-vms">outdated VM</a>, and everything else on the VM&rsquo;s disk is lost. <code>devvm update --force</code> doesn&rsquo;t ask, and without a terminal devvm refuses unless you give <code>--force</code>.</p>
|
||
<p>devvm replaces only what the file gave the VM, and it keeps what you chose:</p>
|
||
<ul>
|
||
<li><strong>Toolchains and layers.</strong> The ones the file&rsquo;s features gave the VM go when the file no longer has those features, and the ones the file&rsquo;s new features map to are added. The ones you chose yourself stay, whether you gave them with <code>--tools</code> or <code>--layers</code>, <code>devvm setup</code> chose them, or the folder&rsquo;s other files call for them. One you left out in the list, or took out later, stays out.</li>
|
||
<li><strong>The container image.</strong> The VM&rsquo;s base starts from the file&rsquo;s new <code>image</code>, pinned as for a new VM. When the file no longer has one, the base starts from <code>$DEVVM_FROM</code>, or else from Ubuntu&rsquo;s cloud image. A VM made with <code>--from</code> keeps its base, and devvm says that it ignores <code>image</code>.</li>
|
||
<li><strong>The ports.</strong> The ports the file added go when the file no longer lists them, and the ones it lists anew are added, as <code>devvm ports add</code> adds them. The ports you added with <code>devvm ports add</code> stay, and one of the file&rsquo;s that you took out with <code>devvm ports rm</code> stays out. A VM made with <code>--ports</code> gets the ports the file lists anew, but not the ones <code>--ports</code> won over.</li>
|
||
<li><strong>The environment and the commands.</strong> They&rsquo;re the file&rsquo;s new ones, and the commands that run once run again on the new disk.</li>
|
||
</ul>
|
||
<p>When the file is gone, devvm makes the VM again without it, so what the file gave goes, and so do its environment and commands. When a file appears for a VM made without one, devvm makes the VM again as the file says, as it would a new VM.</p>
|
||
<h2 data-hextra-search-id="properties">Properties<span class="hx:absolute hx:-mt-20" id="properties"></span>
|
||
<a href="#properties" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><table>
|
||
<thead>
|
||
<tr>
|
||
<th>Property</th>
|
||
<th>What devvm does</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>image</code></td>
|
||
<td>The VM&rsquo;s base starts from it, as with <a href="https://next.devvm.dev/docs/using/from/"><code>--from</code></a>. devvm uses only an image that its registry gives anyone who asks anonymously, pinned to that digest. It never uses an image only Docker has, one only your registry login reaches, or one on this machine or its network, which is <code>localhost</code> or a registry whose address is loopback, private or link-local, by name or as it resolves.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>features</code></td>
|
||
<td><code>ghcr.io/devcontainers/features/docker-in-docker</code> is devvm&rsquo;s <a href="https://next.devvm.dev/docs/using/images/#built-in-layers">docker layer</a>. A feature under <code>ghcr.io/devcontainers/features/</code> named after one of devvm&rsquo;s <a href="https://next.devvm.dev/docs/using/toolchains/">toolchains</a>, such as <code>ghcr.io/devcontainers/features/node</code>, is that shared toolchain. devvm ignores their options and says so in one line. It refuses <code>docker-outside-of-docker</code>, which is this machine&rsquo;s Docker, and every other feature. devvm never fetches or runs a feature&rsquo;s script.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>forwardPorts</code></td>
|
||
<td>devvm forwards numbers, <code>localhost:N</code> and <code>127.0.0.1:N</code> to this machine&rsquo;s <code>localhost</code> alone, adding them to your ports as <code>devvm ports add</code> does (<a href="https://next.devvm.dev/docs/using/ports-size/#ports">ports</a>). With every port forwarded, which is the default, they&rsquo;re among them already. <code>devvm ports rm</code> takes one out, as for any port. It ignores other hosts&rsquo; ports and says so in one line.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>containerEnv</code>, <code>remoteEnv</code></td>
|
||
<td>The VM&rsquo;s environment, which login shells and the commands below get. <code>remoteEnv</code> wins over <code>containerEnv</code>, and devvm&rsquo;s own variables, such as <code>LANG</code> and secrets, win over both. A <code>remoteEnv</code> of <code>null</code> sets nothing.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>onCreateCommand</code>, <code>updateContentCommand</code>, <code>postCreateCommand</code></td>
|
||
<td>They run once, in that order, once the VM is made and set up (<a href="#commands">commands</a>).</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>postStartCommand</code></td>
|
||
<td>It runs at each start, on the first launch after the VM started.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>initializeCommand</code></td>
|
||
<td>It never runs, because it would run on this machine, and devvm says so in one line.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>build</code>, <code>dockerFile</code>, <code>dockerfile</code>, <code>dockerComposeFile</code></td>
|
||
<td>Refused, because devvm starts a VM only from an image.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>postAttachCommand</code>, <code>privileged</code>, <code>capAdd</code>, <code>securityOpt</code>, <code>mounts</code>, <code>runArgs</code>, <code>workspaceMount</code>, <code>workspaceFolder</code>, <code>remoteUser</code>, <code>containerUser</code>, <code>updateRemoteUserUID</code>, <code>init</code>, <code>shutdownAction</code>, <code>overrideCommand</code>, <code>hostRequirements</code>, <code>appPort</code>, <code>portsAttributes</code>, <code>otherPortsAttributes</code>, <code>userEnvProbe</code>, <code>waitFor</code>, <code>overrideFeatureInstallOrder</code>, <code>context</code>, <code>service</code>, <code>runServices</code></td>
|
||
<td>Ignored, and named in one line.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>name</code>, <code>customizations</code>, <code>$schema</code></td>
|
||
<td>Ignored.</td>
|
||
</tr>
|
||
<tr>
|
||
<td>anything else</td>
|
||
<td>Ignored, and named in one line.</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<h2 data-hextra-search-id="commands">Commands<span class="hx:absolute hx:-mt-20" id="commands"></span>
|
||
<a href="#commands" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A command is a string, which devvm runs with <code>sh -c</code>, an array, which it runs as it is, or an object of named commands, which it runs one by one, sorted by name. The commands run in the VM, as its user, in the project folder, in a login shell, and never on this machine. Their output goes to the <a href="https://next.devvm.dev/docs/using/troubleshooting/#a-command-fails">run log</a>.</p>
|
||
<p>When a command fails, devvm names it in one line, and the commands after it that would run once, or at that start, don&rsquo;t run. devvm keeps the VM and opens it, because the command is the project&rsquo;s and not devvm&rsquo;s. The commands reach only what the VM&rsquo;s <a href="https://next.devvm.dev/docs/safety/network/#network-tiers">network tier</a> allows, like anything else in the VM.</p>
|
||
<h2 data-hextra-search-id="variables">Variables<span class="hx:absolute hx:-mt-20" id="variables"></span>
|
||
<a href="#variables" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><table>
|
||
<thead>
|
||
<tr>
|
||
<th>Variable</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>${containerWorkspaceFolder}</code>, <code>${containerWorkspaceFolderBasename}</code></td>
|
||
<td>the project folder, at the same path in the VM, and its name</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>${containerEnv:NAME}</code></td>
|
||
<td>in a string command and in <code>containerEnv</code> and <code>remoteEnv</code>, the VM&rsquo;s own <code>NAME</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>${localEnv:NAME}</code>, <code>${env:NAME}</code></td>
|
||
<td>refused, because devvm never puts this machine&rsquo;s environment in a VM</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>${localWorkspaceFolder}</code>, <code>${localWorkspaceFolderBasename}</code>, <code>${devcontainerId}</code>, <code>${containerEnv:NAME}</code> elsewhere</td>
|
||
<td>refused</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>devvm leaves any other <code>${…}</code> as it is, for the VM&rsquo;s shell, such as <code>${HOME}</code> in a command.</p>
|
||
<h2 data-hextra-search-id="security">Security<span class="hx:absolute hx:-mt-20" id="security"></span>
|
||
<a href="#security" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>The file belongs to the project, so a VM can rewrite it for the folder&rsquo;s next VM, or for itself when you run <code>devvm update</code>, and devvm never lets it run anything on this machine, reach this machine&rsquo;s files or environment, add a mount or weaken confinement. An <code>image</code> from it can still be any public container image, whose own code runs as root while devvm builds the VM&rsquo;s base, as with <code>--from</code> (<a href="https://next.devvm.dev/docs/internals/security/#a-projects-devcontainerjson">security model</a>).</p>
|
||
<p>Its <code>forwardPorts</code> open ports on this machine, even when you&rsquo;ve narrowed your ports with <code>devvm ports -g</code> or <code>devvm ports</code>. devvm forwards them only to this machine&rsquo;s <code>localhost</code>, never to its other addresses, and never takes a port that a program on this machine already has, just as for <code>devvm ports add</code>. Anything on this machine that connects to such a port reaches what the VM serves there, including a web page in your browser, so for a repo you don&rsquo;t trust, check its file first, or run <code>devvm --ports none</code> or <code>devvm --no-devcontainer</code> (<a href="https://next.devvm.dev/docs/safety/attack-vectors/#network">ports the VM listens on</a>).</p></description></item><item><title>Links between VMs</title><link>https://next.devvm.dev/docs/using/links/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/links/</guid><description>
|
||
<p>A link lets a program in one of your VMs reach a TCP service in another by name, as in <code>postgres://db:5432/app</code> or <code>fetch(&quot;http://api:3000&quot;)</code>. The VM with the service is the target, and you publish its port in its folder. The VM that reaches it is the client, and you add the link in the client&rsquo;s folder. Links work on every backend, whatever the two VMs&rsquo; network tiers, as long as the target&rsquo;s tier is the client&rsquo;s or a stricter one. devvm carries each connection over ssh through this machine, so neither VM&rsquo;s network changes, and <a href="https://next.devvm.dev/docs/internals/ports/#links-between-vms">How it works › Links between VMs</a> explains how.</p>
|
||
<p>For a database in <code>~/code/db</code> and an app in <code>~/code/app</code>, both with VMs:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="nb">cd</span> ~/code/db <span class="o">&amp;&amp;</span> devvm link publish <span class="m">5432</span> <span class="c1"># offer the database&#39;s port to links</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> ~/code/app <span class="o">&amp;&amp;</span> devvm link add db <span class="m">5432</span> <span class="c1"># programs in app&#39;s VM reach it as db:5432</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Programs in the app&rsquo;s VM then reach the database as <code>db:5432</code> and as <code>db.devvm.internal:5432</code>. A link joins the two VMs&rsquo; trust, so add one only between VMs you&rsquo;d trust with each other&rsquo;s reach (<a href="#a-link-joins-the-two-vms-trust">below</a>). To link several VMs to each other at once, put them in a <a href="#groups">group</a>.</p>
|
||
<h2 data-hextra-search-id="publishing-a-port">Publishing a port<span class="hx:absolute hx:-mt-20" id="publishing-a-port"></span>
|
||
<a href="#publishing-a-port" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Links reach only the ports a VM publishes, so you publish a port in the target&rsquo;s folder before any VM can link to it:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm link publish <span class="c1"># what this folder&#39;s VM publishes: none, or a list</span>
|
||
</span></span><span class="line"><span class="cl">devvm link publish <span class="m">5432</span> <span class="c1"># offer port 5432 to links</span>
|
||
</span></span><span class="line"><span class="cl">devvm link publish 8000-8010 <span class="c1"># offer a range</span>
|
||
</span></span><span class="line"><span class="cl">devvm link unpublish <span class="m">5432</span> <span class="c1"># stop offering it</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<ul>
|
||
<li><code>devvm link publish</code> takes ports and ranges as <code>devvm ports</code> does, such as <code>5432,8000-8010</code>, but not <code>all</code> or <code>none</code>. A port you publish is offered to links from any of your VMs, and each link is still made in its client&rsquo;s folder with <code>devvm link add</code>.</li>
|
||
<li><code>devvm link unpublish</code> takes ports as <code>devvm link publish</code> lists them, and it refuses a port that isn&rsquo;t published. The server in the VM keeps running. When other VMs link to a port you take out, devvm names them, and their next connections to that port are refused, while connections that are open stay until they close. To remove those links, run <code>devvm link rm</code> in their folders.</li>
|
||
<li>A change applies at once, whether the VM is running or stopped.</li>
|
||
<li>Publishing forwards nothing to this machine, and it doesn&rsquo;t change <a href="https://next.devvm.dev/docs/using/ports-size/#ports">the ports the VM forwards</a>.</li>
|
||
</ul>
|
||
<p>A link connects to the target&rsquo;s own <code>127.0.0.1</code>, so the server in the target has to listen there or on all its addresses. A server that listens on <code>::1</code> alone isn&rsquo;t reached.</p>
|
||
<h2 data-hextra-search-id="adding-a-link">Adding a link<span class="hx:absolute hx:-mt-20" id="adding-a-link"></span>
|
||
<a href="#adding-a-link" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>In the client&rsquo;s folder, <code>devvm link add TARGET PORT</code> links its VM to PORT of the VM that TARGET names, once that VM publishes the port:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm link add db <span class="m">5432</span> <span class="c1"># reach port 5432 of the VM for the folder db as db:5432</span>
|
||
</span></span><span class="line"><span class="cl">devvm link add db <span class="m">5432</span> --as pg <span class="c1"># reach it as pg:5432 instead</span>
|
||
</span></span><span class="line"><span class="cl">devvm link add ../api <span class="m">8080</span> <span class="c1"># name the target by its folder&#39;s path</span>
|
||
</span></span><span class="line"><span class="cl">devvm link add devvm-api-71a99b1076d92c <span class="m">8080</span> <span class="c1"># or by its VM&#39;s name</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>TARGET takes one of four forms:</p>
|
||
<ul>
|
||
<li><strong>A folder&rsquo;s name,</strong> as VM names have it, such as <code>db</code> for <code>devvm-db-71a99b1076d92c</code>. devvm matches it against the folder that each VM was made for, so a VM whose backend needed a shorter name still matches its whole folder name. When more than one VM has a folder of that name, devvm refuses and lists each VM with its folder, so you can give the VM&rsquo;s name or the folder&rsquo;s path instead.</li>
|
||
<li><strong>A folder&rsquo;s path,</strong> which starts with <code>.</code> or holds a <code>/</code>, such as <code>../api</code> or <code>/Users/you/code/api</code>.</li>
|
||
<li><strong>A VM&rsquo;s name,</strong> as <code>devvm ls</code> lists it.</li>
|
||
<li><strong>A VM&rsquo;s ssh alias,</strong> such as <code>devvm-db</code>, as you&rsquo;d give it to ssh (<a href="https://next.devvm.dev/docs/using/ssh/#ssh-access-by-name">SSH access by name</a>).</li>
|
||
</ul>
|
||
<p>devvm refuses a target that has no VM, the client&rsquo;s own VM, and a port that the target doesn&rsquo;t publish. It also refuses a link that <a href="#links-and-network-tiers">the two VMs&rsquo; tiers</a> don&rsquo;t allow. When devvm makes the link, it says what the client reaches it as, and that the link joins the two VMs&rsquo; trust.</p>
|
||
<h3 data-hextra-search-id="names">Names<span class="hx:absolute hx:-mt-20" id="names"></span>
|
||
<a href="#names" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Programs in the client reach a link at <code>NAME:PORT</code> and <code>NAME.devvm.internal:PORT</code>. NAME is the target&rsquo;s folder name, as VM names have it, unless you give <code>--as NAME</code>. <code>.internal</code> is reserved for private networks, so <code>NAME.devvm.internal</code> never names a host on the internet, and it&rsquo;s the name to use when the short one could clash with a name your network resolves.</p>
|
||
<ul>
|
||
<li>A client has one name for each VM it links to. The first link to a target sets the name, and later links to that target take it too, so after <code>devvm link add db 5432 --as pg</code>, <code>devvm link add db 8000</code> reaches <code>pg:8000</code>. To change the name, remove that target&rsquo;s links and add them again.</li>
|
||
<li>A name is one DNS label, made of lowercase letters, digits and dashes, which starts and ends with a letter or a digit and isn&rsquo;t all digits. devvm refuses <code>localhost</code>, the client&rsquo;s own hostname and a name that another of the client&rsquo;s links has. When the target&rsquo;s folder name isn&rsquo;t a valid name, or it&rsquo;s taken, give another with <code>--as NAME</code>.</li>
|
||
<li>A link is reached only by its names, never at the client&rsquo;s <code>localhost</code>, so <code>localhost:5432</code> in the client stays the client&rsquo;s own.</li>
|
||
<li>A link&rsquo;s name hides the same name from anywhere else in the client, such as a host <code>db</code> under your network&rsquo;s search domain.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="ports">Ports<span class="hx:absolute hx:-mt-20" id="ports"></span>
|
||
<a href="#ports" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>The client reaches the target&rsquo;s port on the same port number, so <code>devvm link add web 80</code> gives <code>web:80</code>, and ports below 1024 work like any other. Two targets can publish the same port, because the client reaches each one by its own name.</p>
|
||
<p>Links carry TCP over IPv4 alone. Each name resolves to an IPv4 address, so a program that connects only over IPv6 doesn&rsquo;t reach it, and UDP isn&rsquo;t carried.</p>
|
||
<h3 data-hextra-search-id="which-vm-a-link-reaches">Which VM a link reaches<span class="hx:absolute hx:-mt-20" id="which-vm-a-link-reaches"></span>
|
||
<a href="#which-vm-a-link-reaches" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>A link stays with the VM it was made for, because devvm records the target VM&rsquo;s identity with the link. A VM made again in the target&rsquo;s folder after <code>devvm rm</code>, or another VM with the same folder name that appears later, isn&rsquo;t the linked target. <code>devvm layer add</code>, <code>devvm layer rm</code> and <code>devvm update</code> keep the target&rsquo;s identity as they make the VM again, so its links still reach it (<a href="https://next.devvm.dev/docs/using/images/#adding-layers-to-a-vm">adding layers to a VM</a>).</p>
|
||
<h3 data-hextra-search-id="a-link-joins-the-two-vms-trust">A link joins the two VMs&rsquo; trust<span class="hx:absolute hx:-mt-20" id="a-link-joins-the-two-vms-trust"></span>
|
||
<a href="#a-link-joins-the-two-vms-trust" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Code in the client can often run code in the target through the target&rsquo;s own service, such as Postgres&rsquo;s <code>COPY … TO PROGRAM</code>. It then has whatever the target has: its network, the secrets it may use and its project folder. devvm doesn&rsquo;t stop that, because it&rsquo;s what the service itself allows. So add a link only between VMs you&rsquo;d trust with each other&rsquo;s reach, and publish only the ports that you mean other VMs to use. <a href="https://next.devvm.dev/docs/safety/network/#links-between-vms">Network tiers</a> explains what this means for each tier.</p>
|
||
<h2 data-hextra-search-id="links-and-network-tiers">Links and network tiers<span class="hx:absolute hx:-mt-20" id="links-and-network-tiers"></span>
|
||
<a href="#links-and-network-tiers" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A client links only to a target on its own <a href="https://next.devvm.dev/docs/safety/network/#network-tiers">network tier</a> or a stricter one, because a link to a target on a lower tier would let the client reach more through the target. So an allowlist client links to allowlist and none targets, but not to internet or open ones, and an open client may link to any target. When devvm can&rsquo;t read a client&rsquo;s or a target&rsquo;s tier, because that part of its state was changed by hand, it refuses the link rather than take it as open (<a href="https://next.devvm.dev/docs/using/troubleshooting/#a-file-devvm-cant-read">a file devvm can&rsquo;t read</a>).</p>
|
||
<p>devvm checks this rule when you add a link, at each launch of the client and on every connection (<a href="https://next.devvm.dev/docs/internals/ports/#each-connection">each connection</a>):</p>
|
||
<ul>
|
||
<li>For a client on a confined tier, on every connection the target&rsquo;s tier must also be in force as the target runs. If you move the target from open to a confined tier while it&rsquo;s running, <code>devvm ls</code> shows it as <code>unenforced</code> until the target starts again behind its proxy, and devvm refuses the client&rsquo;s connections to it until then, so start the target again with <code>devvm restart</code> in its folder.</li>
|
||
<li>devvm also warns you of such a target when you add a link to it, when you publish a port in its folder that the client links to, and each time the client starts. The warning names the target and refuses nothing, and devvm doesn&rsquo;t warn of a stopped target, because its tier applies when it next starts.</li>
|
||
</ul>
|
||
<p>While such a link exists, devvm refuses to give the target a tier lower than a client&rsquo;s, such as <code>devvm network open</code> in its folder, and names the clients that link to it, and it refuses to give the client a tier higher than a target&rsquo;s, such as <code>devvm network allowlist</code> for a client that links to an open VM. Remove those links with <code>devvm link rm</code> first, or give the target the client&rsquo;s tier:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm link rm db <span class="m">5432</span> <span class="c1"># in the client&#39;s folder: remove the link to db&#39;s port 5432</span>
|
||
</span></span><span class="line"><span class="cl">devvm network allowlist <span class="c1"># or, in the target&#39;s folder, give the target an allowlist client&#39;s tier</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Every VM has its proxy, so a program that uses the VM&rsquo;s proxy settings, such as curl, sends its requests for a link to the VM&rsquo;s proxy, and the proxy carries a request for one of the link&rsquo;s names and its port, such as <code>db:5432</code> or <code>db.devvm.internal:5432</code>, to the link. Other programs reach the link by its name directly. The proxy passes a link&rsquo;s connection on as it is, so it doesn&rsquo;t look into it and puts none of your secrets into it.</p>
|
||
<p>The network rules don&rsquo;t apply to links. The allowlist doesn&rsquo;t allow or block a link&rsquo;s connections, and <code>devvm network deny db</code> doesn&rsquo;t stop the link <code>db</code>. The rule above and the published ports decide which connections a link carries, and <code>devvm network log</code> shows them (<a href="#the-link-log">the link log</a>). To stop a link, remove it with <code>devvm link rm</code>, or unpublish its port in the target&rsquo;s folder.</p>
|
||
<h2 data-hextra-search-id="listing-links">Listing links<span class="hx:absolute hx:-mt-20" id="listing-links"></span>
|
||
<a href="#listing-links" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>devvm link</code> lists this folder&rsquo;s VM&rsquo;s links, with one row for each port:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">NAME PORT TARGET FOLDER STATUS APPLIES
|
||
</span></span><span class="line"><span class="cl">db 5432 devvm-db-71a99b1076d92c /Users/you/code/db Running yes
|
||
</span></span><span class="line"><span class="cl">db 8000 devvm-db-71a99b1076d92c /Users/you/code/db Running unpublished</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>STATUS</code> is the target&rsquo;s status as its backend reports it, such as <code>Running</code> or <code>Stopped</code>, and it&rsquo;s empty when devvm can&rsquo;t tell. <code>APPLIES</code> is <code>yes</code> for a link that works while the target runs, or else it says why the link doesn&rsquo;t apply:</p>
|
||
<ul>
|
||
<li><code>gone</code>: the target VM no longer exists.</li>
|
||
<li><code>replaced</code>: the target&rsquo;s folder has another VM, made again since the link was.</li>
|
||
<li><code>unpublished</code>: the target doesn&rsquo;t publish the port.</li>
|
||
<li><code>policy</code>: the target is on a lower network tier than the client.</li>
|
||
<li><code>ungrouped</code>: a <a href="#groups">group</a> made the link, and the two VMs aren&rsquo;t in that group together any more. You can remove such a link with <code>devvm link rm</code>.</li>
|
||
</ul>
|
||
<p><code>devvm ls</code> shows how many links each VM has, in its <code>LINKS</code> column.</p>
|
||
<h3 data-hextra-search-id="devvm-link-json">devvm link &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-link-json"></span>
|
||
<a href="#devvm-link-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm link --json</code> prints the same list as one JSON object, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes. Each of the <code>links</code> has its <code>name</code>, its <code>port</code>, the <code>target</code> VM, the target&rsquo;s folder as <code>target_folder</code> and its status as <code>target_status</code>, both <code>&quot;&quot;</code> when devvm doesn&rsquo;t know them, <code>applies</code>, which is <code>true</code> or <code>false</code>, and <code>reason</code>, which is why the link doesn&rsquo;t apply, as <code>APPLIES</code> shows it, or <code>&quot;&quot;</code> when it does.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;links&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;db&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;port&#34;</span><span class="p">:</span> <span class="mi">5432</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;target&#34;</span><span class="p">:</span> <span class="s2">&#34;devvm-db-71a99b1076d92c&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;target_folder&#34;</span><span class="p">:</span> <span class="s2">&#34;/Users/you/code/db&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;target_status&#34;</span><span class="p">:</span> <span class="s2">&#34;Running&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;applies&#34;</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;reason&#34;</span><span class="p">:</span> <span class="s2">&#34;&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="devvm-link-publish-json">devvm link publish &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-link-publish-json"></span>
|
||
<a href="#devvm-link-publish-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm link publish --json</code> prints what the VM publishes as one JSON object, and it only shows, so devvm refuses a list of ports with it. <code>ports</code> is <code>none</code> or a list of ports and ranges, written as <code>devvm link publish</code> takes it.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;ports&#34;</span><span class="p">:</span> <span class="s2">&#34;5432,8000-8010&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="removing-a-link">Removing a link<span class="hx:absolute hx:-mt-20" id="removing-a-link"></span>
|
||
<a href="#removing-a-link" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>devvm link rm TARGET PORT</code> removes one of this folder&rsquo;s VM&rsquo;s links, where TARGET is the link&rsquo;s name or anything that <code>devvm link add</code> takes:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm link rm db <span class="m">5432</span> <span class="c1"># stop reaching db:5432</span>
|
||
</span></span><span class="line"><span class="cl">devvm link rm pg <span class="m">5432</span> <span class="c1"># by the name given with --as</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>On a running client, the link&rsquo;s next connection is refused, and the connections that are open through it end within a few seconds, so a program in the client that keeps one open, such as a database client, sees it closed.</p>
|
||
<h2 data-hextra-search-id="when-links-change">When links change<span class="hx:absolute hx:-mt-20" id="when-links-change"></span>
|
||
<a href="#when-links-change" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A change of links reaches a running client at once and a stopped one when it next starts, and devvm says which. On a running client, the names resolve at once, because devvm rewrites the client&rsquo;s <code>/etc/hosts</code>, and a link&rsquo;s port answers within a few seconds. The VM&rsquo;s proxy reaches a new link as soon as its port answers, so the programs that use the VM&rsquo;s proxy settings also reach it, including those that were already running. Nothing in the VM restarts, and the VM&rsquo;s environment doesn&rsquo;t change, whatever its tier.</p>
|
||
<h2 data-hextra-search-id="when-a-target-stops-or-goes">When a target stops or goes<span class="hx:absolute hx:-mt-20" id="when-a-target-stops-or-goes"></span>
|
||
<a href="#when-a-target-stops-or-goes" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm never starts a VM for a link. A connection to a stopped target fails, and each launch of the client warns about each stopped target, until you start it with <code>devvm</code> in its folder. The client&rsquo;s links then work again without any change to the client. When the target stops, the connections that were open through it end. A link also needs both VMs&rsquo; backends to carry links, which every backend of devvm&rsquo;s does, and when one can&rsquo;t, each launch of the client says so.</p>
|
||
<ul>
|
||
<li><code>devvm rm</code> of a target removes every link to it from your other VMs and names the clients that lost one. A VM that you make again in that folder isn&rsquo;t linked, so publish its ports and add the links again.</li>
|
||
<li><code>devvm rm</code> of a client removes its links, and <code>devvm stop</code> of a client ends its links&rsquo; connections.</li>
|
||
</ul>
|
||
<p>A link can&rsquo;t listen when a program in the client already holds its port in a way that covers the link&rsquo;s address, such as a server of the client&rsquo;s own on all its addresses with the same port. That link alone doesn&rsquo;t work, devvm says so, and the client&rsquo;s other links work. Stop that program, then run <code>devvm restart</code>.</p>
|
||
<h2 data-hextra-search-id="groups">Groups<span class="hx:absolute hx:-mt-20" id="groups"></span>
|
||
<a href="#groups" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A group is a set of your VMs that reach each other&rsquo;s published ports by name, without a <code>devvm link add</code> for each pair. You join each VM in its own folder, and devvm makes the links between them, so every VM in the group gets a link to each port that every other VM in it publishes. A VM is in one group at a time.</p>
|
||
<p>For a database in <code>~/code/db</code>, an API in <code>~/code/api</code> and an app in <code>~/code/app</code>, each with a VM:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="nb">cd</span> ~/code/db <span class="o">&amp;&amp;</span> devvm link publish <span class="m">5432</span> <span class="o">&amp;&amp;</span> devvm group join web
|
||
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> ~/code/api <span class="o">&amp;&amp;</span> devvm link publish <span class="m">8080</span> <span class="o">&amp;&amp;</span> devvm group join web
|
||
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> ~/code/app <span class="o">&amp;&amp;</span> devvm group join web</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Programs in the app&rsquo;s VM then reach <code>db:5432</code> and <code>api:8080</code>, programs in the API&rsquo;s VM reach <code>db:5432</code>, and programs in the database&rsquo;s VM reach <code>api:8080</code>. The links a group makes are links like any other, so what this page says about names, ports, network tiers, the link log and stopped targets holds for them too, and <code>devvm link</code> lists them.</p>
|
||
<h3 data-hextra-search-id="joining-a-group">Joining a group<span class="hx:absolute hx:-mt-20" id="joining-a-group"></span>
|
||
<a href="#joining-a-group" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm group join NAME</code> puts this folder&rsquo;s VM in the group NAME. The first VM to join makes the group, and devvm says so. A group&rsquo;s name is made of lowercase letters, digits and dashes, starts and ends with a letter or a digit, and isn&rsquo;t all digits.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm group join web <span class="c1"># join the group web</span>
|
||
</span></span><span class="line"><span class="cl">devvm group join web --as api2 <span class="c1"># join it as api2 instead of this folder&#39;s name</span>
|
||
</span></span><span class="line"><span class="cl">devvm group <span class="c1"># the group, its VMs and the ports each one publishes</span>
|
||
</span></span><span class="line"><span class="cl">devvm group leave <span class="c1"># leave it</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>When the VM joins, devvm makes the group&rsquo;s links in it and in each of the group&rsquo;s other VMs, and it names the links that each VM gains. The links reach a running VM at once and a stopped one when it next starts, as <a href="#when-links-change">When links change</a> describes. devvm refuses a VM that&rsquo;s in another group already, so run <code>devvm group leave</code> first, and it refuses a VM whose backend can&rsquo;t carry links. A VM made again in a folder isn&rsquo;t in the group that the folder&rsquo;s old VM was in.</p>
|
||
<p><code>devvm group</code> shows the group this folder&rsquo;s VM is in, with one row for each of its VMs:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">NAME VM FOLDER PUBLISHED
|
||
</span></span><span class="line"><span class="cl">api devvm-api-0f3c2a91b7d4e6 /Users/you/code/api 8080
|
||
</span></span><span class="line"><span class="cl">app devvm-app-5e1d7c08a2b9f4 /Users/you/code/app none
|
||
</span></span><span class="line"><span class="cl">db devvm-db-71a99b1076d92c /Users/you/code/db 5432</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>NAME</code> is what the group&rsquo;s other VMs reach that VM by, and <code>PUBLISHED</code> is the ports it publishes, or <code>none</code>. When this folder&rsquo;s VM isn&rsquo;t in a group, devvm says so.</p>
|
||
<h3 data-hextra-search-id="ports-in-a-group">Ports in a group<span class="hx:absolute hx:-mt-20" id="ports-in-a-group"></span>
|
||
<a href="#ports-in-a-group" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>The group&rsquo;s links reach every port that a VM in it publishes, so you publish and unpublish ports in each VM&rsquo;s folder, as <a href="#publishing-a-port">Publishing a port</a> describes. A port that you publish reaches the links of every other VM in the group, and a port that you take out goes from them, at once on a running VM and at its next start on a stopped one. devvm names the links that each VM gains or loses. A range that you publish gives a link for each port in it.</p>
|
||
<h3 data-hextra-search-id="names-in-a-group">Names in a group<span class="hx:absolute hx:-mt-20" id="names-in-a-group"></span>
|
||
<a href="#names-in-a-group" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>The group&rsquo;s other VMs reach a VM by its folder name, as VM names have it, unless it joined with <code>--as NAME</code>. The name follows the rules for <a href="#names">link names</a>, and devvm refuses <code>localhost</code>.</p>
|
||
<ul>
|
||
<li>Two VMs in a group can&rsquo;t have the same name, so when another VM in the group has the name this VM would join as, devvm refuses the join until you give this VM another with <code>--as NAME</code>. devvm also refuses a name that&rsquo;s another VM&rsquo;s folder name, because that&rsquo;s the other VM&rsquo;s own hostname. To change a VM&rsquo;s name in its group, leave the group, then join it again with <code>--as NAME</code>.</li>
|
||
<li>A VM&rsquo;s folder name is its own hostname, so devvm refuses to put a VM in a group where another VM&rsquo;s name is this VM&rsquo;s folder name, whatever <code>--as NAME</code> you give, because the name would reach the joining VM itself. For two folders with the same name, such as <code>~/work/api</code> and <code>~/old/api</code>, have the VM that&rsquo;s in the group leave it and join again with another name, such as <code>devvm group join web --as api1</code>, then join the other with <code>--as api2</code>. A VM whose folder has a name of its own needs neither.</li>
|
||
<li>The links that you make with <code>devvm link add</code> take precedence over the group&rsquo;s. When you link to a VM in the group yourself, the group&rsquo;s links to that VM take the name your link gives it, and a port that you linked gets no link from the group. When one of your links has the name of another VM in the group, the group&rsquo;s links to that VM go, and devvm warns you of it, until you remove your link with <code>devvm link rm</code>.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="a-group-joins-the-trust-of-all-its-vms">A group joins the trust of all its VMs<span class="hx:absolute hx:-mt-20" id="a-group-joins-the-trust-of-all-its-vms"></span>
|
||
<a href="#a-group-joins-the-trust-of-all-its-vms" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>A group joins the trust of every VM in it, as <a href="#a-link-joins-the-two-vms-trust">a link joins the two VMs&rsquo; trust</a>, because code in any of them can often run code in the others through the ports they publish. A VM that joins later gets the same reach into every VM in the group, and they get the same reach into it, so devvm says so on every join. Put VMs in a group only when you&rsquo;d trust each of them with the others&rsquo; reach.</p>
|
||
<h3 data-hextra-search-id="groups-and-network-tiers">Groups and network tiers<span class="hx:absolute hx:-mt-20" id="groups-and-network-tiers"></span>
|
||
<a href="#groups-and-network-tiers" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>A group&rsquo;s VMs are all on one tier. devvm refuses to put a VM in a group whose VMs are on another tier, and it names both tiers. It checks joins one at a time, so when two VMs join a group at once, the second is checked against the first, and a devvm that waits for another says so. While a VM is in a group, devvm refuses to change its tier with <code>devvm network</code>, so run <code>devvm group leave</code> first.</p>
|
||
<p>Because every VM in a group is on one tier, the group&rsquo;s links keep <a href="#links-and-network-tiers">the rule</a> that a client links only to a target on its tier or a stricter one. Each of their connections is still refused while the target&rsquo;s tier isn&rsquo;t in force as it runs, and devvm warns you of such a target when the group makes a link to it.</p>
|
||
<h3 data-hextra-search-id="leaving-a-group">Leaving a group<span class="hx:absolute hx:-mt-20" id="leaving-a-group"></span>
|
||
<a href="#leaving-a-group" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm group leave</code> takes this folder&rsquo;s VM out of its group. It removes the links that the group made, in this VM and in the group&rsquo;s other VMs, and names the links that each VM loses. The links that you made with <code>devvm link add</code> stay. <code>devvm link rm</code> doesn&rsquo;t remove a link that the group made, so leave the group, or unpublish the port in its target&rsquo;s folder.</p>
|
||
<p><code>devvm rm</code> of a VM takes it out of its group, and when the group&rsquo;s last VM leaves, the group is gone.</p>
|
||
<h3 data-hextra-search-id="devvm-group-json">devvm group &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-group-json"></span>
|
||
<a href="#devvm-group-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm group --json</code> prints the group as one JSON object, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes. <code>group</code> is the group&rsquo;s name, or <code>&quot;&quot;</code> when the VM is in none, and <code>members</code> is <code>[]</code> then. Each of the <code>members</code> has its <code>name</code> in the group, its <code>vm</code>, its <code>folder</code>, and the ports it publishes as <code>published</code>, written as <code>devvm link publish</code> lists them, or <code>none</code>.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;group&#34;</span><span class="p">:</span> <span class="s2">&#34;web&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;members&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;db&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;vm&#34;</span><span class="p">:</span> <span class="s2">&#34;devvm-db-71a99b1076d92c&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;folder&#34;</span><span class="p">:</span> <span class="s2">&#34;/Users/you/code/db&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;published&#34;</span><span class="p">:</span> <span class="s2">&#34;5432&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="containers-in-the-vm">Containers in the VM<span class="hx:absolute hx:-mt-20" id="containers-in-the-vm"></span>
|
||
<a href="#containers-in-the-vm" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A container that the <a href="https://next.devvm.dev/docs/using/images/#built-in-layers">docker layer</a> runs in the client has a network of its own, so it neither resolves a link&rsquo;s names nor reaches its address. Run it with <code>--network host</code>, as in <code>docker run --network host IMAGE</code>, so it shares the VM&rsquo;s network and reaches the links as the VM does.</p>
|
||
<h2 data-hextra-search-id="the-link-log">The link log<span class="hx:absolute hx:-mt-20" id="the-link-log"></span>
|
||
<a href="#the-link-log" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>devvm network log</code> in the client&rsquo;s folder shows its links&rsquo; connections, whatever its tier. A line has the time, <code>link</code> for a connection devvm carried or <code>REFUSED</code> for one it refused, the link&rsquo;s name and port, and the target VM, with why devvm refused it:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">2026-11-01T10:00:00Z link db:5432 to devvm-db-71a99b1076d92c
|
||
</span></span><span class="line"><span class="cl">2026-11-01T10:05:00Z REFUSED db:5432 to devvm-db-71a99b1076d92c: it isn&#39;t running</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>When the client is on a confined tier and the target&rsquo;s isn&rsquo;t in force yet, the line says <code>unenforced</code>, as <a href="#links-and-network-tiers">Links and network tiers</a> describes.</p>
|
||
<p>A client has at most 256 of its links&rsquo; connections carried at once, and devvm refuses and logs the next one. <a href="https://next.devvm.dev/docs/safety/network/#devvm-network-log---json">devvm network log &ndash;json</a> describes the events in JSON.</p></description></item><item><title>A VM's desktop</title><link>https://next.devvm.dev/docs/using/desktop/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/desktop/</guid><description>
|
||
<p>A VM has no screen of its own, but with the <code>desktop</code> layer it gets an Xfce desktop, which <code>devvm desktop</code> opens in a window on this machine. This page covers adding the desktop, opening it, its password and the clipboard, and what it costs. <a href="https://next.devvm.dev/docs/internals/desktop/">The desktop</a> explains how devvm keeps it to this machine.</p>
|
||
<h2 data-hextra-search-id="adding-the-desktop">Adding the desktop<span class="hx:absolute hx:-mt-20" id="adding-the-desktop"></span>
|
||
<a href="#adding-the-desktop" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>The desktop is one of devvm&rsquo;s <a href="https://next.devvm.dev/docs/using/images/#built-in-layers">built-in layers</a>, so only the VMs you choose it for get it, and <code>base</code> and the other VMs stay without it. To add it to a new VM, check <code>desktop</code> under Layers in the list devvm shows when you customize a new VM, or name it with <code>--layers</code>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm --layers desktop <span class="c1"># a VM of base with the desktop</span>
|
||
</span></span><span class="line"><span class="cl">devvm --layers docker,desktop <span class="c1"># the desktop on top of the docker layer</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>devvm builds the <code>desktop</code> image the first time a VM needs it, and VMs that choose it share that image. <code>--layers</code> is the exact list of the VM&rsquo;s layers, so name every layer you want the VM to have.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm setup --layers desktop <span class="c1"># every new VM gets the desktop</span>
|
||
</span></span><span class="line"><span class="cl">devvm setup --layers docker,desktop <span class="c1"># the desktop on top of docker, for every new VM</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>To give every new VM the desktop, choose it with <code>devvm setup --layers desktop</code>, or add it to the layers you already chose, such as <code>devvm setup --layers docker,desktop</code>. New VMs then get it unless you leave it out when you customize them or give <code>--layers</code> without it (<a href="https://next.devvm.dev/docs/using/settings/#layers-for-new-vms">layers for new VMs</a>). VMs that exist keep the layers they were made with.</p>
|
||
<p>A VM made without the desktop has none, and <code>devvm desktop</code> says so. To give it one, run <code>devvm layer add desktop</code>, which makes the VM again from an image with the desktop on top of its own layers, such as <code>docker+desktop</code>. The VM keeps its home folder, the project folder and its settings, and loses the rest of its disk, such as the packages you installed, so devvm asks first (<a href="https://next.devvm.dev/docs/using/images/#adding-layers-to-a-vm">adding layers to a VM</a>). <code>devvm layer rm desktop</code> takes the desktop out again in the same way (<a href="https://next.devvm.dev/docs/using/images/#taking-layers-out-of-a-vm">taking layers out of a VM</a>).</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm layer add desktop <span class="c1"># make this folder&#39;s VM again with the desktop, after asking</span>
|
||
</span></span><span class="line"><span class="cl">devvm layer rm desktop <span class="c1"># make it again without the desktop</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>The desktop works on base, and on a base made <code>--from</code> a Debian, Ubuntu or Alpine container image.</p>
|
||
<h2 data-hextra-search-id="opening-it">Opening it<span class="hx:absolute hx:-mt-20" id="opening-it"></span>
|
||
<a href="#opening-it" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm desktop <span class="c1"># serves this folder&#39;s VM&#39;s desktop and opens it in Screen Sharing</span>
|
||
</span></span><span class="line"><span class="cl">devvm desktop --no-open <span class="c1"># only shows its address and password</span>
|
||
</span></span><span class="line"><span class="cl">devvm desktop --clipboard <span class="c1"># shares the clipboard both ways, for this run</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm desktop</code> gets the VM ready as <code>devvm host</code> does, and starts it if it&rsquo;s stopped. Then it starts the VM&rsquo;s desktop, unless it&rsquo;s running already, and shows its address and password:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">devvm-website-0123456789abcd&#39;s desktop is at
|
||
</span></span><span class="line"><span class="cl">vnc://127.0.0.1:41234
|
||
</span></span><span class="line"><span class="cl">Password: k3mxq7tw
|
||
</span></span><span class="line"><span class="cl">It stays there until you press Ctrl+C.</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>On macOS, devvm opens the address in Screen Sharing, which comes with macOS and asks for the password. Screen Sharing can keep the password in your keychain, and the address stays the same each time. On Linux, open the address in a VNC viewer of your own, such as TigerVNC&rsquo;s <code>vncviewer</code> or Remmina.</p>
|
||
<p>The desktop stays at that address until you press Ctrl+C, or until the VM stops, and then <code>devvm desktop</code> ends. The desktop goes on running in the VM, so the windows you left open are there the next time you run <code>devvm desktop</code>. It&rsquo;s 1600 by 1000 pixels.</p>
|
||
<p>The desktop is only ever on this machine, and only while <code>devvm desktop</code> runs:</p>
|
||
<ul>
|
||
<li>devvm serves it on this machine&rsquo;s <code>127.0.0.1</code> alone, so nothing else on your network reaches it. Each VM keeps its port, which no other VM and no program on this machine has. When a program has taken it, devvm chooses another one and keeps that.</li>
|
||
<li>In the VM, the desktop listens on no port at all, so a VM that <a href="https://next.devvm.dev/docs/using/ports-size/#ports">forwards every port</a> never forwards it.</li>
|
||
<li>On a confined <a href="https://next.devvm.dev/docs/safety/network/#network-tiers">network tier</a>, the VM still reaches only its proxy while you use its desktop.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="browsers">Browsers<span class="hx:absolute hx:-mt-20" id="browsers"></span>
|
||
<a href="#browsers" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>The desktop has no browser of its own, so install the one you want in the VM, such as Google Chrome, Chromium or Firefox. Browsers reach the web through the VM&rsquo;s proxy without asking you for a password, and so do the desktop&rsquo;s other programs. Browsers ask for a proxy&rsquo;s password rather than read it from the VM&rsquo;s proxy settings, so the desktop&rsquo;s programs use the VM&rsquo;s local proxy instead. The local proxy is a small proxy in the VM, at <code>http://127.0.77.1:3128</code>, which adds the VM&rsquo;s password to each request and sends it on to the VM&rsquo;s proxy. A browser follows the desktop&rsquo;s proxy settings unless you&rsquo;ve given it one of its own. The local proxy listens on the VM&rsquo;s loopback alone, and devvm never forwards it to this machine, even on a VM that <a href="https://next.devvm.dev/docs/using/ports-size/#ports">forwards every port</a> (<a href="https://next.devvm.dev/docs/internals/desktop/#the-local-proxy">the local proxy</a>).</p>
|
||
<p>The local proxy changes nothing about what the VM may reach. A host that the VM&rsquo;s <a href="https://next.devvm.dev/docs/safety/network/#network-tiers">network tier</a> doesn&rsquo;t allow is still blocked, and a plain <code>http://</code> page shows the proxy&rsquo;s reason and the <code>devvm network allow</code> command that allows it. An <code>https://</code> page shows the browser&rsquo;s own error instead, such as Chrome&rsquo;s <code>ERR_TUNNEL_CONNECTION_FAILED</code>, so run <code>devvm-why</code> in the desktop&rsquo;s terminal to see what was blocked.</p>
|
||
<h2 data-hextra-search-id="the-password">The password<span class="hx:absolute hx:-mt-20" id="the-password"></span>
|
||
<a href="#the-password" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Each VM has its own password of eight lowercase letters and digits. devvm makes it the first time you run <code>devvm desktop</code> and keeps it with the VM&rsquo;s state on this machine, so <code>devvm rm</code> deletes it. The password never goes into the VM, and it isn&rsquo;t in devvm&rsquo;s run log. devvm checks it on this machine before a viewer reaches the VM, whatever the VM&rsquo;s own desktop asks for. Other users and programs on this machine can also connect to <code>127.0.0.1</code>, so the password is what keeps them out, and devvm lets a viewer try only one password a second (<a href="https://next.devvm.dev/docs/internals/desktop/#on-this-machine">on this machine</a>).</p>
|
||
<h2 data-hextra-search-id="the-clipboard">The clipboard<span class="hx:absolute hx:-mt-20" id="the-clipboard"></span>
|
||
<a href="#the-clipboard" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm desktop --clipboard <span class="c1"># share the clipboard both ways, for this run</span>
|
||
</span></span><span class="line"><span class="cl">devvm desktop <span class="c1"># the next run without it shares nothing</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>The clipboard isn&rsquo;t shared unless you add <code>--clipboard</code>. With sharing on, what you copy on this machine goes into the VM, where a coding agent can read it, and what the VM copies lands on this machine&rsquo;s clipboard. Without <code>--clipboard</code>, devvm keeps this machine&rsquo;s clipboard out of the VM, even when something in the VM has changed its desktop&rsquo;s settings, and the VM&rsquo;s desktop doesn&rsquo;t send its clipboard.</p>
|
||
<p><code>--clipboard</code> turns sharing on in both directions for that run, and the next run without it turns sharing off again. devvm can&rsquo;t stop a VM whose desktop was changed from sending its clipboard to Screen Sharing, so when you don&rsquo;t want the VM&rsquo;s clipboard on this machine, also turn off Use Shared Clipboard in Screen Sharing&rsquo;s Edit menu.</p>
|
||
<h2 data-hextra-search-id="what-it-costs">What it costs<span class="hx:absolute hx:-mt-20" id="what-it-costs"></span>
|
||
<a href="#what-it-costs" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><ul>
|
||
<li>About 370 MB of disk for the <code>desktop</code> image, which every VM with the layer shares, while <code>base</code> and the VMs without the layer stay that much smaller.</li>
|
||
<li>About 500 MB of the VM&rsquo;s memory while its desktop runs, which it does from your first <code>devvm desktop</code> until the VM stops. A VM whose desktop you never open uses none.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="when-the-desktop-doesnt-open">When the desktop doesn&rsquo;t open<span class="hx:absolute hx:-mt-20" id="when-the-desktop-doesnt-open"></span>
|
||
<a href="#when-the-desktop-doesnt-open" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><ul>
|
||
<li><strong>The VM has no desktop:</strong> it was made without the <code>desktop</code> layer. Run <code>devvm layer add desktop</code> to make it again with the layer, as <a href="#adding-the-desktop">adding the desktop</a> explains.</li>
|
||
<li><strong>The desktop didn&rsquo;t start:</strong> devvm shows the end of its run log. The desktop&rsquo;s own log is <code>~/.cache/devvm-desktop.log</code> in the VM.</li>
|
||
<li><strong>Screen Sharing didn&rsquo;t open:</strong> open the address devvm shows in Screen Sharing yourself, by typing it into Finder&rsquo;s Go &gt; Connect to Server, or in another VNC viewer.</li>
|
||
<li><strong>Screen Sharing says the password is wrong:</strong> use the password <code>devvm desktop</code> shows for this VM. Each VM has its own.</li>
|
||
</ul></description></item><item><title>Starting from a container image</title><link>https://next.devvm.dev/docs/using/from/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/from/</guid><description>
|
||
<p>By default <code>base</code> starts from Ubuntu 26.04&rsquo;s cloud image. <code>--from IMAGE</code> starts it from a Debian-, Ubuntu- or Alpine-based container image instead, such as <code>node:24</code>, <code>python:3.13</code>, <code>debian:13</code>, <code>alpine:3</code> or an image you built yourself. Use it when your project needs a distribution or a system package set that Ubuntu doesn&rsquo;t give you.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm --from node:24 <span class="c1"># a new VM whose base is node:24</span>
|
||
</span></span><span class="line"><span class="cl">devvm build --from alpine:3 base <span class="c1"># just the image</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nv">DEVVM_FROM</span><span class="o">=</span>node:24 devvm <span class="c1"># a default for every new VM and build</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Everything above <code>base</code> builds and runs as usual, including base&rsquo;s own setup and the layers (<code>docker</code> and yours). The VM gets its <a href="https://next.devvm.dev/docs/using/images/#shared-tools">shared tools</a> as any VM does, and <a href="#shared-tools-and-glibc">shared tools and glibc</a> describes where devvm builds them. devvm keeps the images from each container image apart, so each <code>base</code> and the images on it sit side by side with the others, and each image&rsquo;s record keeps the container image its base came from and that image&rsquo;s digest.</p>
|
||
<p><code>--from</code> applies to new VMs and to <code>devvm build</code> and <code>devvm rebuild</code>, and <code>devvm images rm</code> takes it to delete an image on a base from that container image. An existing VM keeps what it was made from, and <code>devvm tools add</code> and <code>devvm tools update</code> build its shared tools for that <code>base</code>. devvm ignores another <code>--from</code> for an existing VM, with a warning. <a href="https://next.devvm.dev/docs/internals/images/#how-its-converted">Images and caching</a> explains how devvm turns a container image into a VM&rsquo;s disk and how it treats the image&rsquo;s code as untrusted.</p>
|
||
<h2 data-hextra-search-id="tags-and-digests">Tags and digests<span class="hx:absolute hx:-mt-20" id="tags-and-digests"></span>
|
||
<a href="#tags-and-digests" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm builds <code>base</code> from the exact image that a tag names when it builds, which is the image&rsquo;s digest, and it records that digest:</p>
|
||
<ul>
|
||
<li>When the tag moves to a new image, such as a new <code>node:24</code>, the next build makes a new <code>base</code>. That build happens for a new VM with <code>--from</code>, <code>devvm build</code>, <code>devvm rebuild</code>, <code>devvm layer add</code> or <code>devvm update</code>. The old <code>base</code> is then stale, and the VMs made from it are outdated, which <code>devvm update</code> changes (<a href="https://next.devvm.dev/docs/using/images/#outdated-vms">outdated VMs</a>).</li>
|
||
<li>Offline, or when the registry doesn&rsquo;t have the image any more, devvm uses the digest it recorded last, with a warning. With none recorded, it fails.</li>
|
||
<li>Opening an existing VM never looks anything up, because only builds do.</li>
|
||
<li><code>--from node:24@sha256:&lt;digest&gt;</code> pins an exact image, and devvm never looks it up.</li>
|
||
</ul>
|
||
<p>devvm reads a reference the way Docker does, so <code>node:24</code> is Docker Hub&rsquo;s <code>library/node</code> with the tag <code>24</code>. A first part with a dot or a port, or <code>localhost</code>, names the registry, as in <code>ghcr.io/org/image:tag</code> or <code>localhost:5000/app</code>. A reference without a tag means <code>latest</code>. <a href="https://next.devvm.dev/docs/internals/images/#digests">Digests</a> explains how devvm asks a registry for them.</p>
|
||
<h2 data-hextra-search-id="images-only-docker-has">Images only Docker has<span class="hx:absolute hx:-mt-20" id="images-only-docker-has"></span>
|
||
<a href="#images-only-docker-has" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Public images work from any registry, such as Docker Hub, ghcr.io or quay.io. When a registry doesn&rsquo;t give devvm the image, devvm takes it from Docker, as long as Docker runs and has it. That covers an image you built and never pushed, and a private one, which you get with <code>docker login</code> and then <code>docker pull</code>. devvm itself never logs in to a registry, and it never pulls, builds or deletes Docker&rsquo;s images.</p>
|
||
<p>If the image&rsquo;s tag moves to another image while devvm builds, for example because you rebuilt it, devvm stops and asks you to run it again.</p>
|
||
<h2 data-hextra-search-id="supported-images">Supported images<span class="hx:absolute hx:-mt-20" id="supported-images"></span>
|
||
<a href="#supported-images" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><ul>
|
||
<li><strong>Debian, Ubuntu and Alpine</strong> and the distributions based on them. devvm refuses any other, and an image without a shell or <code>/etc/os-release</code>.</li>
|
||
<li><strong>This machine&rsquo;s architecture.</strong> devvm refuses an image without an arm64 build (or amd64), and names the ones it has.</li>
|
||
<li><strong>Alpine</strong> uses OpenRC and musl, so its VMs get musl builds of the shared tools, built on that image and kept apart for it. Its base also gets GNU <code>tar</code> from Alpine&rsquo;s packages in place of busybox&rsquo;s, because devvm sends the VM&rsquo;s setup and <a href="https://next.devvm.dev/docs/using/coding-agents/#importing-history">imports agents&rsquo; history</a> with it.</li>
|
||
<li><strong>Unpinned packages.</strong> While <code>base</code> builds, its packages come from the container image&rsquo;s own sources as they are then, apt&rsquo;s or Alpine&rsquo;s, and so do the <a href="https://next.devvm.dev/docs/using/images/#desktop">desktop layer</a>&rsquo;s, the <a href="https://next.devvm.dev/docs/using/images/#docker">docker layer</a>&rsquo;s on Alpine and the <a href="https://next.devvm.dev/docs/using/images/#nix">nix layer</a>&rsquo;s. devvm keeps no copy of them, unlike base from Ubuntu&rsquo;s image, so building the same base again installs the sources&rsquo; packages of that day, and it needs the network for them.</li>
|
||
<li><strong>A glibc new enough for your shared tools.</strong> A Debian- or Ubuntu-based container image&rsquo;s glibc must be at least as new as each shared tool needs, which <a href="#shared-tools-and-glibc">shared tools and glibc</a> covers.</li>
|
||
<li><strong>Tested.</strong> The end-to-end tests make VMs from <code>node:24</code> (Debian 12, with node, python, claude and the docker and nix layers) and <code>alpine:3</code> (with node, dotnet and the docker, nix and desktop layers), and build <code>base</code> from <code>ubuntu:26.04</code>.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="shared-tools-and-glibc">Shared tools and glibc<span class="hx:absolute hx:-mt-20" id="shared-tools-and-glibc"></span>
|
||
<a href="#shared-tools-and-glibc" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A shared tool&rsquo;s build is mounted by every VM that gets the same version of the tool, so devvm never builds one where a container image&rsquo;s code could change it for other VMs:</p>
|
||
<ul>
|
||
<li><strong>On a Debian- or Ubuntu-based container image,</strong> VMs get the same builds of the shared tools as VMs on Ubuntu&rsquo;s own image, which devvm builds in its own <code>base</code> from Ubuntu&rsquo;s cloud image, never in the container image. When that <code>base</code> isn&rsquo;t built yet, devvm says so and builds it first, as it does for a VM on Ubuntu&rsquo;s image.</li>
|
||
<li><strong>On an Alpine-based container image,</strong> musl builds need Alpine, so devvm builds them in the VM&rsquo;s own <code>base</code> and keeps them for the VMs on that exact container image, by its digest. When the container image&rsquo;s tag moves to a new container image, devvm builds the tools it gives those VMs next again, on the new one.</li>
|
||
</ul>
|
||
<p>The <a href="https://next.devvm.dev/docs/using/images/#shared-tools">shared tools</a> are their projects&rsquo; own prebuilt releases, and each one is built against a glibc version that it needs at least. devvm reads that version from each tool&rsquo;s files when it builds the tool&rsquo;s image, and it reads the container image&rsquo;s glibc version when it converts the image (<a href="https://next.devvm.dev/docs/internals/images/#building-tools">building tools</a>). When a Debian- or Ubuntu-based image has an older glibc than a tool needs, devvm refuses to give that tool to the VM. The error names the tool, the glibc version it needs and the one the image has, and devvm doesn&rsquo;t make the VM. The same happens when <code>devvm tools add</code>, <code>devvm tools update</code> or <code>devvm update</code> would give an existing VM such a tool.</p>
|
||
<p>To fix it, start from a newer container image with <code>--from</code>, or leave that tool out. Today no shared tool needs a glibc newer than 2.28, so Debian 10 and Ubuntu 20.04 and newer images run all of them, and <a href="https://next.devvm.dev/docs/using/toolchains/#which-bases-they-run-on">toolchains</a> lists what each one needs. devvm measures it again for every new version it builds. Alpine-based images get musl builds of the tools, which need no glibc. pi is the one shared tool without a musl build, because its project releases it for glibc alone, so devvm refuses to give pi to a VM on an Alpine-based image, before it builds anything, and the error names pi. Leave pi out of that VM, or start from a Debian- or Ubuntu-based image. devvm doesn&rsquo;t check base from Ubuntu&rsquo;s own image, whose glibc is newer than any shared tool needs.</p>
|
||
<h2 data-hextra-search-id="backends">Backends<span class="hx:absolute hx:-mt-20" id="backends"></span>
|
||
<a href="#backends" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Lima starts <code>base</code> from a container image by converting the image into a disk (<a href="https://next.devvm.dev/docs/internals/backends/#features">backends</a>).</p></description></item><item><title>What devvm keeps on this machine</title><link>https://next.devvm.dev/docs/using/space/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/space/</guid><description>
|
||
<p>devvm, the tools it runs and Lima keep files on this machine outside your project folders. This page lists each of them: what it is, who makes it, where it is, whether devvm can make it again, and how it&rsquo;s cleaned up. Most of it is in devvm&rsquo;s data folder, <code>~/.local/share/devvm</code>, and devvm can make all of that again except your exports and what your commands saved, such as your agents&rsquo; logins and your secrets. Lima&rsquo;s own caches hold more, and they can also hold your own downloads.</p>
|
||
<h2 data-hextra-search-id="devvm-space">devvm space<span class="hx:absolute hx:-mt-20" id="devvm-space"></span>
|
||
<a href="#devvm-space" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>devvm space</code> shows what devvm keeps on this machine and how much disk each kind of thing takes. It changes nothing and starts no VM, and it gives Lima 30 seconds to answer. <code>devvm space --json</code> prints the same as JSON, for scripts (<a href="#devvm-space---json">devvm space &ndash;json</a>). The first table has a row for each kind of thing devvm has, followed by a total:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Column</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>WHAT</code></td>
|
||
<td><code>VMs</code>, <code>images</code>, <code>tools gnu</code> or <code>tools musl</code> for the shared tools&rsquo; builds for each C library, <code>history</code> for the exports of agents&rsquo; history, <code>network logs</code> for the VMs&rsquo; logs and the daily tools check&rsquo;s log, <code>run logs</code>, <code>mise</code>, <code>packages</code> for the copies of <a href="https://next.devvm.dev/docs/using/images/#base">base&rsquo;s packages</a>, <code>cloud images</code> for devvm&rsquo;s copies of <a href="#ubuntus-cloud-images">Ubuntu&rsquo;s cloud images</a>, <code>Nix cache</code> for the <a href="https://next.devvm.dev/docs/using/toolchains/#nix-projects">shared Nix cache</a>, <code>leftover state</code> for the whole folder of each VM that <code>devvm gc --orphans</code> would forget, and <code>state</code> for the rest of devvm&rsquo;s data folder, which includes the rest of the VMs&rsquo; folders</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>COUNT</code>, <code>SIZE</code></td>
|
||
<td>how many there are and the disk they take, in powers of 1024 (<code>2.1G</code>)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>KEPT</code></td>
|
||
<td><code>remade</code> when devvm makes it again when it&rsquo;s needed, <code>only copy</code> for VMs and exports, which nothing else has, <code>log</code> for logs, <code>state</code> for what devvm knows of its VMs and images and for the cloud images, as a release that Ubuntu removed can&rsquo;t be downloaded again, and <code>leftover</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>GC</code></td>
|
||
<td>what <code>devvm gc</code> frees of it now, which for the Nix cache is what it takes beyond its cap</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>FREED BY</code></td>
|
||
<td>what frees the rest, such as <code>devvm rm</code>, <code>images rm</code>, which deletes images that are current, <code>gc --caches</code> or <code>gc --nix-cache</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>RETAIN</code></td>
|
||
<td>the <a href="https://next.devvm.dev/docs/using/settings/#retention">retention setting</a> that applies to the row when it&rsquo;s on, such as <code>30d</code>, with what it would delete now in brackets, and <code>-</code> when none is on</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>Sizes count each file&rsquo;s blocks once, as <code>du</code> does. On macOS a Lima VM&rsquo;s disk shares its image&rsquo;s blocks until the VM writes them, so those blocks count for both the VM and its image, and the total can be more than the disk they take. When Lima doesn&rsquo;t answer while one of your VMs uses it, devvm says so, and its VMs and images aren&rsquo;t counted.</p>
|
||
<h3 data-hextra-search-id="limas-caches">Lima&rsquo;s caches<span class="hx:absolute hx:-mt-20" id="limas-caches"></span>
|
||
<a href="#limas-caches" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>The second table lists the caches that belong to Lima, with what each cache holds, how many entries it has, its size and where it is. That&rsquo;s Lima&rsquo;s download cache, which can hold your own downloads and the cloud images that earlier releases of devvm had Lima download, so it isn&rsquo;t in the total. The <a href="#lima">Lima</a> section below says what it holds.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm gc --caches <span class="c1"># gc as usual, then free the cloud images nothing needs, after asking</span>
|
||
</span></span><span class="line"><span class="cl">devvm gc --caches --force <span class="c1"># the same without asking, as a script must</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>devvm never prunes these on its own. <code>devvm gc --caches</code> cleans up as <code>devvm gc</code> does, then frees devvm&rsquo;s copies of <a href="#ubuntus-cloud-images">Ubuntu&rsquo;s cloud images</a> and devvm&rsquo;s share of Lima&rsquo;s caches that nothing of devvm&rsquo;s needs. It lists the entries it would delete with their sizes and asks. Without a terminal it refuses unless you give <code>--force</code>, which frees them without asking.</p>
|
||
<h3 data-hextra-search-id="devvm-space-json">devvm space &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-space-json"></span>
|
||
<a href="#devvm-space-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm space --json</code> prints both tables as one JSON object, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes, and devvm still says on stderr what it says without <code>--json</code>. <code>devvm</code> has a row of the first table each, with sizes in bytes:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Field</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>what</code>, <code>count</code>, <code>size</code></td>
|
||
<td>the row&rsquo;s <code>WHAT</code>, <code>COUNT</code> and <code>SIZE</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>backend</code></td>
|
||
<td>the backend that has them, <code>lima</code>, for VMs, images and shared tools, left out for the other rows and for a shared tool&rsquo;s build when devvm can&rsquo;t tell which backend it&rsquo;s for</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>sized</code></td>
|
||
<td>whether devvm knows the size, which <code>SIZE</code> shows as <code>-</code> when it doesn&rsquo;t</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>kept</code></td>
|
||
<td>the row&rsquo;s <code>KEPT</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>gc</code></td>
|
||
<td>what <code>devvm gc</code> frees of it now</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>rest</code></td>
|
||
<td>the row&rsquo;s <code>FREED BY</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>retain</code>, <code>retain_frees</code></td>
|
||
<td>the retention setting that applies to the row and what it would delete now, both left out when none is on</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p><code>total</code> and <code>gc</code> are the totals row&rsquo;s <code>SIZE</code> and <code>GC</code>. <code>backends</code> has the second table&rsquo;s rows, each with its <code>backend</code>, <code>name</code>, <code>path</code>, <code>count</code>, <code>size</code> and <code>sized</code>. <code>unknown</code> names the backends that one of your VMs uses that didn&rsquo;t answer, and <code>strays</code> has the <a href="#vms-devvm-has-no-state-for">VMs devvm has no state for</a>, each with its <code>backend</code>, <code>name</code> and the <code>data</code> folder its label names. <code>folder_gone</code> has the <a href="#vms-whose-folder-is-gone">VMs whose folder is gone</a>, each with its <code>backend</code>, <code>name</code> and <code>folder</code>, and <code>folder_not_connected</code> has those whose folder is on a disk that isn&rsquo;t connected, with the same fields. devvm leaves these out when they&rsquo;re empty.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;devvm&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;what&#34;</span><span class="p">:</span> <span class="s2">&#34;VMs&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;backend&#34;</span><span class="p">:</span> <span class="s2">&#34;lima&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;count&#34;</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;size&#34;</span><span class="p">:</span> <span class="mi">5368709120</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;sized&#34;</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;kept&#34;</span><span class="p">:</span> <span class="s2">&#34;only copy&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;gc&#34;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;rest&#34;</span><span class="p">:</span> <span class="s2">&#34;devvm rm&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;what&#34;</span><span class="p">:</span> <span class="s2">&#34;history&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;count&#34;</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;size&#34;</span><span class="p">:</span> <span class="mi">3145728</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;sized&#34;</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;kept&#34;</span><span class="p">:</span> <span class="s2">&#34;only copy&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;gc&#34;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;rest&#34;</span><span class="p">:</span> <span class="s2">&#34;gc --history&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;retain&#34;</span><span class="p">:</span> <span class="s2">&#34;30d&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;retain_frees&#34;</span><span class="p">:</span> <span class="mi">1048576</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;total&#34;</span><span class="p">:</span> <span class="mi">5371854848</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;gc&#34;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;backends&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;backend&#34;</span><span class="p">:</span> <span class="s2">&#34;lima&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;download cache&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;path&#34;</span><span class="p">:</span> <span class="s2">&#34;/Users/you/Library/Caches/lima&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;count&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;size&#34;</span><span class="p">:</span> <span class="mi">629145600</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;sized&#34;</span><span class="p">:</span> <span class="kc">true</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="devvms-data-folder">devvm&rsquo;s data folder<span class="hx:absolute hx:-mt-20" id="devvms-data-folder"></span>
|
||
<a href="#devvms-data-folder" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm keeps its state in <code>~/.local/share/devvm</code>, or in <code>$XDG_DATA_HOME/devvm</code> when <code>XDG_DATA_HOME</code> is set. Everything in it is devvm&rsquo;s own, and devvm makes most of it again when it&rsquo;s needed. The exceptions are the exports, which are the only copy of a deleted VM&rsquo;s agent history, and the defaults, agents&rsquo; logins, keys and secrets that your commands saved.</p>
|
||
<p>Only you can read it, because each time devvm runs, it makes this folder and the settings folder, <code>~/.config/devvm</code>, yours alone (mode 700), whatever mode they had, so nothing inside either one is open to others. If devvm can&rsquo;t, for example because someone else owns a folder, it warns and goes on. Whenever devvm writes into the folders that hold history, logs, keys and secrets, which are <code>exports/</code>, <code>logs/</code>, <code>logs/runs/</code>, <code>run/</code>, <code>secrets/</code>, and the <code>run/</code>, <code>run/ca/</code> and <code>logs/</code> folders in each VM&rsquo;s folder, it makes them only yours again as well, whatever mode they had.</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Path</th>
|
||
<th>What it is</th>
|
||
<th>How it&rsquo;s cleaned up</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>version</code>, <code>version.lock</code></td>
|
||
<td>the folder&rsquo;s <a href="https://next.devvm.dev/docs/using/troubleshooting/#a-newer-devvm-changed-devvms-folders">layout version</a>, and an empty file that each devvm checking it locks</td>
|
||
<td>they stay, and take no space</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>settings.json</code></td>
|
||
<td>the defaults that <code>devvm setup</code>, <code>devvm size -g</code>, <code>devvm ports -g</code>, <code>devvm network -g</code> and <code>devvm retention</code> save, below <a href="https://next.devvm.dev/docs/using/settings/#configtoml"><code>config.toml</code></a>&rsquo;s</td>
|
||
<td>it stays, and takes almost no space</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>ssh_config</code></td>
|
||
<td>the <a href="https://next.devvm.dev/docs/using/ssh/#ssh-access-by-name">ssh config</a> for running VMs</td>
|
||
<td>devvm takes a VM out when it stops or deletes the VM</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>agent-keys.json</code></td>
|
||
<td>the keys in <a href="https://next.devvm.dev/docs/using/ssh/#devvms-own-agent">devvm&rsquo;s own SSH agent</a> and their options</td>
|
||
<td><code>devvm ssh-agent rm</code> takes a key out</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>logins/</code></td>
|
||
<td>your agents&rsquo; logins in <a href="https://next.devvm.dev/docs/using/coding-agents/#devvms-agent-store">devvm&rsquo;s agent store</a>, one folder for each agent, which <code>devvm agent import</code> and <code>devvm agent login</code> save and only you can read</td>
|
||
<td>they stay until you delete them</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>secrets/</code></td>
|
||
<td>on hosts without a Keychain, such as Linux hosts, your <a href="https://next.devvm.dev/docs/safety/network/#saving-and-binding-secrets">secrets</a>, one file each</td>
|
||
<td><code>devvm secret rm</code> deletes one</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>custom-secrets.json</code>, <code>custom-secrets.lock</code></td>
|
||
<td>the <a href="https://next.devvm.dev/docs/safety/network/#your-own-secrets">secrets of your own</a>, each with its hosts, header, variable and prefix but never its value, and an empty file that each devvm changing them locks</td>
|
||
<td><code>devvm secret rm</code> takes a secret out, and both stay, taking almost no space</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>vms/&lt;hash&gt;/</code></td>
|
||
<td>one folder for each VM, which holds everything devvm keeps for it in its data folder. <code>&lt;hash&gt;</code> is the hash of the project folder&rsquo;s path that the VM&rsquo;s name ends with. The folder holds the VM&rsquo;s <a href="https://next.devvm.dev/docs/internals/overview/#a-vms-state">state</a> in <code>vm.json</code>, which records the VM&rsquo;s name, its ssh alias, its image, folder, backend and settings and the version of the devvm that made it, and the VM&rsquo;s own network rules in <code>policy</code>. The files of its proxy, port forwarder, link session and sandbox are in <code>run/</code>, with the VM&rsquo;s host keys for its current start in <code>run/known_hosts</code>, which devvm reads again each time the VM starts, and its logs are in <code>logs/</code></td>
|
||
<td><code>devvm rm</code> deletes the whole folder with the VM</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>images/</code></td>
|
||
<td>a folder for each image, named by its key, which holds the image&rsquo;s record, <code>record.json</code>; the <a href="https://next.devvm.dev/docs/using/images/#rebuilding">rebuild counters</a> in <code>rebuilds.json</code>, one for each backend, each image that base starts from and each image; the Ubuntu cloud image that base starts from on this machine, in <code>ubuntu.json</code>; and in <code>locks/</code> an empty file for each image that the devvm building it locks, one, <code>rebuilds</code>, that a devvm changing a rebuild counter locks, one, <code>ubuntu</code>, that a devvm pinning the cloud image locks, and one, <code>packages</code>, that a devvm changing <code>packages/</code> locks</td>
|
||
<td><code>devvm gc</code> and <code>devvm images rm</code> delete an image&rsquo;s folder and its lock file with the image</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>packages/</code></td>
|
||
<td>a copy of each package that a first build of base installed, named by its SHA-256, and in <code>sets/</code> the list of packages each base recorded, named by its key, which building the same base again installs from these copies (<a href="https://next.devvm.dev/docs/using/images/#base">base</a>)</td>
|
||
<td><code>devvm gc</code> deletes the lists of bases that are neither current nor built, then the copies that no list names. <code>devvm rebuild base</code> records a new list</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>tools/</code></td>
|
||
<td>the <a href="https://next.devvm.dev/docs/using/images/#shared-tools">shared tools</a>, one read-only image per tool version, each with a record beside it, <code>&lt;image&gt;.json</code>, which holds its checksum, the backend that built it, the C library it&rsquo;s built for, when it was built and, once retention finds that no VM has it, since when</td>
|
||
<td><code>devvm gc</code> deletes the versions that no VM has and that aren&rsquo;t the current ones, and <code>devvm gc --tool-images</code> also the current ones that no VM has, except while a VM is <a href="https://next.devvm.dev/docs/using/images/#cleaning-up">being made</a>, each with its record</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>mise.lock</code>, <code>mise.lock.toml</code>, <code>mise.lock.checked</code></td>
|
||
<td>the tools lock, which holds the tools&rsquo; versions and their checksums, the config it was resolved from, and when devvm last checked upstream for newer versions</td>
|
||
<td>devvm replaces them when it checks again</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>cache/</code></td>
|
||
<td>what devvm makes again whenever it needs it: its own mise, the shared Nix cache, and in <code>from-digests.json</code> the digest that each container image a <code>--from</code> base starts from had when devvm last looked it up</td>
|
||
<td>you can delete it at any time, and devvm makes each part again when it&rsquo;s needed. An image built from a container image keeps that digest in its own record, so it stays current without the cache</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>cache/mise/&lt;version&gt;</code></td>
|
||
<td>the mise that devvm runs on this machine to resolve the tools lock, one folder per mise version</td>
|
||
<td><code>devvm gc</code> deletes the folders of older versions, which an upgrade of devvm leaves</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>exports/</code></td>
|
||
<td>the agents&rsquo; <a href="https://next.devvm.dev/docs/using/coding-agents/#history">history</a> that <code>devvm history export</code> and <code>devvm rm</code> save, one <code>.tar.gz</code> per export, each with a <code>.folder</code> file beside it that names its VM&rsquo;s project folder</td>
|
||
<td><code>devvm gc --history</code> deletes them, or with <code>--older-than 30d</code> those that old, and nothing else does</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>logs/runs/</code></td>
|
||
<td>the <a href="https://next.devvm.dev/docs/using/troubleshooting/#a-command-fails">run logs</a>, one per devvm run that runs a command</td>
|
||
<td>devvm keeps the newest 20, and deletes older ones once they take more than 256 MiB together, but never one that a running devvm still writes</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>logs/tools-check.log</code></td>
|
||
<td>the output of the daily check for newer shared tools</td>
|
||
<td>each check replaces it</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>vms/&lt;hash&gt;/logs/</code></td>
|
||
<td>a VM&rsquo;s network log, <code>network.jsonl</code>, which holds its proxy&rsquo;s decisions, its proxy&rsquo;s own output, <code>proxy.log</code>, its link session&rsquo;s output, <code>links.log</code>, and its port forwarder&rsquo;s, <code>ports.log</code>. Before the network log or the proxy&rsquo;s log would grow past 10 MiB, the proxy moves it to the same name with <code>.1</code> added, replacing the older one, so each of them takes at most about 20 MiB, and <code>devvm network log</code> reads both of the network log&rsquo;s files. The link session&rsquo;s and the forwarder&rsquo;s logs do the same at 1 MiB</td>
|
||
<td><code>devvm rm</code> deletes them with the VM&rsquo;s folder, <code>.1</code> files included</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>vms/&lt;hash&gt;/run/ca/</code></td>
|
||
<td>the certificate authorities that the VM trusts for its proxy, its current one and the next, with their keys, which never leave this machine</td>
|
||
<td>devvm makes a new one when the current one has less than a week of its 30 days left, the VM&rsquo;s first start after <code>devvm network open</code> deletes them, and <code>devvm rm</code> deletes them with the VM&rsquo;s folder</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>cache/nix-cache/</code></td>
|
||
<td>the <a href="https://next.devvm.dev/docs/using/toolchains/#nix-projects">shared Nix cache</a>: the packages that VMs with the <code>nix</code> layer downloaded from Nix&rsquo;s binary cache, once for all of them</td>
|
||
<td>the VMs&rsquo; proxies and <code>devvm gc</code> delete its least recently used files while it takes more than its cap, <code>nix-cache.size</code>, which is 10 GiB when it&rsquo;s off, and <code>devvm gc --nix-cache</code> deletes all of it</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>run/</code></td>
|
||
<td>what running VMs need that isn&rsquo;t one VM&rsquo;s or whose path must be short, such as the QEMU wrapper on Linux hosts, the claims lock, <code>claims.lock</code>, which devvm holds while it chooses a new VM&rsquo;s ssh alias or a VM&rsquo;s host ports, the sockets of port forwarders and link sessions, and those that VMs&rsquo; proxies relay their SSH agents on, which are named by hashes, in <code>build-ports/</code> the ssh port of each build VM that&rsquo;s starting, and in <code>builds/</code> a folder for each build VM, laid out as a VM&rsquo;s folder is</td>
|
||
<td>devvm deletes a VM&rsquo;s sockets when it deletes the VM, a build VM&rsquo;s port once the VM has started or failed to, or, if the devvm that started the VM was killed, the first time it chooses a port 15 minutes later, and a build VM&rsquo;s folder once its image is built, or else when it deletes the build VM</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>agent.sock</code></td>
|
||
<td>the socket of <a href="https://next.devvm.dev/docs/using/ssh/#devvms-own-agent">devvm&rsquo;s own SSH agent</a></td>
|
||
<td>it takes no space</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>oci-build.lock</code></td>
|
||
<td>an empty file that the devvm building a base from a container image on Lima locks, so that one such build runs at a time</td>
|
||
<td>it stays, and takes no space</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>tools.lock</code></td>
|
||
<td>an empty file that the devvm building shared tools or updating the tools lock locks, so that one at a time writes to <code>tools/</code></td>
|
||
<td>it stays, and takes no space</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>groups.lock</code></td>
|
||
<td>an empty file that each devvm joining or leaving a <a href="https://next.devvm.dev/docs/using/links/#groups">group</a>, or changing a group&rsquo;s links, locks, so that they take turns</td>
|
||
<td>it stays, and takes no space</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>agents.lock</code></td>
|
||
<td>an empty file that each devvm writing the <a href="https://next.devvm.dev/docs/using/coding-agents/#devvms-agent-store">agent store</a> locks, so that they take turns</td>
|
||
<td>it stays, and takes no space</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>making.lock</code></td>
|
||
<td>an empty file that each devvm making a VM locks, so that <code>devvm gc --tool-images</code> can tell a VM is <a href="https://next.devvm.dev/docs/using/images/#cleaning-up">being made</a></td>
|
||
<td>it stays, and takes no space</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>retention.lock</code></td>
|
||
<td>an empty file that the devvm applying the <a href="https://next.devvm.dev/docs/using/settings/#retention">retention settings</a> locks, so that one at a time applies them</td>
|
||
<td>it stays, and takes no space</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>lima/</code></td>
|
||
<td>devvm&rsquo;s own <a href="https://next.devvm.dev/docs/backends/lima/#devvms-lima-home">Lima home</a>, with its VMs and images, unless <code>DEVVM_LIMA_HOME</code> moves it</td>
|
||
<td>see <a href="#lima">Lima</a></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<ul>
|
||
<li>Which ports each VM forwards is in its state, and its port forwarder&rsquo;s files are in its own folder too, its log in <code>vms/&lt;hash&gt;/logs/</code> and the rest in <code>vms/&lt;hash&gt;/run/</code>. <code>devvm rm</code> deletes them with the VM.</li>
|
||
<li>The <a href="https://next.devvm.dev/docs/using/settings/#retention">retention settings</a>, which are all off until you set them, make devvm delete some of these on its own, and that section lists what each one deletes. Retention also writes <code>retention.run</code> in the data folder, when it last ran, and records in each current shared tool&rsquo;s record since when no VM has had it. It never deletes anything in <code>cache/</code> but the shared Nix cache&rsquo;s files.</li>
|
||
<li>A build also makes a temporary folder in the data folder, <code>tools-build.&lt;random&gt;</code> for the shared tools, and devvm deletes it when the build ends, even after a failure or Ctrl+C.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="shared-tools">Shared tools<span class="hx:absolute hx:-mt-20" id="shared-tools"></span>
|
||
<a href="#shared-tools" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Each tool version is built once for each kind of VM that uses it, so <code>tools/</code> can hold more than one build of the same version. A base on Alpine needs its tools built for its C library, musl, rather than glibc, so a node 24 that both an Ubuntu VM and an Alpine VM use is two builds, and <code>devvm images</code> lists both. Each Alpine container image gets builds of its own, so VMs on two different Alpine images have two musl builds of it. <a href="https://next.devvm.dev/docs/using/images/#cleaning-up">Cleaning up</a> says which ones <code>devvm gc</code> deletes.</p>
|
||
<h3 data-hextra-search-id="exports">Exports<span class="hx:absolute hx:-mt-20" id="exports"></span>
|
||
<a href="#exports" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm rm</code> saves the history of a VM whose image has an agent before it deletes the VM, so each export in <code>exports/</code> can be the only copy of that VM&rsquo;s transcripts and sessions. devvm deletes an export only when you ask it to. <code>devvm history</code> lists the exports, which are named <code>&lt;vm&gt;-&lt;date&gt;-&lt;time&gt;.tar.gz</code>, with their VM, its folder, their date and their size. <code>devvm gc --history</code> lists them by their VM and date, then deletes them, each with the <code>.folder</code> file beside it, after asking in a terminal, and <code>devvm gc --history --older-than 30d</code> deletes only those written 30 days ago or more. gc leaves anything else in the folder alone, such as an export that <code>devvm history export</code> is still writing.</p>
|
||
<h3 data-hextra-search-id="leftovers-of-a-vm-deleted-outside-devvm">Leftovers of a VM deleted outside devvm<span class="hx:absolute hx:-mt-20" id="leftovers-of-a-vm-deleted-outside-devvm"></span>
|
||
<a href="#leftovers-of-a-vm-deleted-outside-devvm" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>When you delete a VM with its backend&rsquo;s own command instead of <code>devvm rm</code>, such as <code>limactl delete</code>, devvm still keeps the VM&rsquo;s folder, with its state, its logs and its backend&rsquo;s files, the VM&rsquo;s sockets in <code>run/</code>, its ssh config entry and its host keys. <code>devvm gc</code> also keeps the shared tools that the VM&rsquo;s state names. <code>devvm rm</code> deletes these only together with the VM, so once the VM is gone it says the folder has no VM.</p>
|
||
<p><code>devvm gc --orphans</code> deletes what devvm keeps for such a VM, as <code>devvm rm</code> does after it deletes a VM. That includes, for a <code>--clone</code> VM, the <code>devvm</code> remote in your repo. gc first asks each VM&rsquo;s backend whether it still has the VM, lists the VMs it would forget with their project folders, and in a terminal asks. It never deletes a VM, and it leaves a VM&rsquo;s state alone in these cases, saying why:</p>
|
||
<ul>
|
||
<li>
|
||
<p><strong>The backend doesn&rsquo;t answer</strong>, for example because it isn&rsquo;t installed. When a backend that one of your VMs uses can&rsquo;t list its images, gc warns and leaves all of that backend&rsquo;s VMs&rsquo; state alone, as it does the rest of that backend&rsquo;s (<a href="https://next.devvm.dev/docs/using/images/#cleaning-up">cleaning up</a>).</p>
|
||
</li>
|
||
<li>
|
||
<p><strong>The VM was made elsewhere.</strong> devvm records where each new VM&rsquo;s backend keeps it: the Lima home, which <code>DEVVM_LIMA_HOME</code> moves. When this run looks somewhere else, the VM may still exist there. A VM whose state doesn&rsquo;t record it counts as made in the backend&rsquo;s default place, so while <code>DEVVM_LIMA_HOME</code> is set, gc leaves such a VM alone.</p>
|
||
</li>
|
||
<li>
|
||
<p><strong>Its state changed in the last hour,</strong> because the VM may still be being made.</p>
|
||
</li>
|
||
<li>
|
||
<p>When another devvm starts to make the VM again in its folder after gc listed it, gc refuses to forget it and stops there, and so does retention&rsquo;s <code>orphans.age</code>.</p>
|
||
</li>
|
||
<li>
|
||
<p>Forgetting a VM also removes your other VMs&rsquo; <a href="https://next.devvm.dev/docs/using/links/">links</a> to it, as <code>devvm rm</code> does. <code>devvm gc --orphans</code> also removes links to VMs whose state is already gone, naming each one, and deletes the sockets that a link session, a port forwarder or a VM&rsquo;s proxy leaves on your machine when it&rsquo;s killed, which are the ones nothing listens on.</p>
|
||
</li>
|
||
</ul>
|
||
<p>Once a VM&rsquo;s state is gone, <code>devvm gc</code> treats its shared tools like any others. <code>devvm space</code> counts the whole folder of each VM that <code>devvm gc --orphans</code> would forget as <code>leftover state</code>, and each socket a link session, a port forwarder or a proxy left counts there too. A VM that gc leaves alone for one of the reasons above isn&rsquo;t leftover state, so its folder counts as <code>state</code> and its logs as <code>network logs</code>.</p>
|
||
<h3 data-hextra-search-id="vms-devvm-has-no-state-for">VMs devvm has no state for<span class="hx:absolute hx:-mt-20" id="vms-devvm-has-no-state-for"></span>
|
||
<a href="#vms-devvm-has-no-state-for" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>A VM can also be the other way around: the backend has it, with devvm&rsquo;s label, but devvm has no state for it. Usually it belongs to another devvm, such as one run with another <code>XDG_DATA_HOME</code> for a test or a sandbox. <code>devvm space</code> names each one, with the data folder its label names. devvm never deletes one, because the other devvm may still use it, but the next tools build and <code>devvm gc</code> delete the build VMs that a killed or failed tools build left, <code>devvm-tools-build</code> to <code>devvm-tools-build-4</code>. To delete any other yourself:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm limactl delete NAME <span class="c1"># delete the VM named NAME from devvm&#39;s Lima home</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="vms-whose-folder-is-gone">VMs whose folder is gone<span class="hx:absolute hx:-mt-20" id="vms-whose-folder-is-gone"></span>
|
||
<a href="#vms-whose-folder-is-gone" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>A VM whose project folder you deleted or moved still takes its disk, and it isn&rsquo;t leftover state, because its backend still has it and it may hold that project&rsquo;s work. <code>devvm space</code> names each VM whose backend has it and whose folder is gone, with that folder, and counts it among the <code>VMs</code>. Neither <code>devvm gc</code> nor retention ever deletes one. <code>devvm rm VM</code> deletes it after asking, exporting its agents&rsquo; history first (<a href="https://next.devvm.dev/docs/using/vms/#a-vm-whose-folder-is-gone">a VM whose folder is gone</a>).</p>
|
||
<p><code>devvm space</code> also names each VM whose folder is on a disk that isn&rsquo;t connected, with that folder, and counts it among the <code>VMs</code> too. Connect the disk to use the VM again. <code>devvm rm VM</code> deletes one only after you confirm in a terminal, and <code>--force</code> never answers that question (<a href="https://next.devvm.dev/docs/using/vms/#a-folder-on-a-disk-that-isnt-connected">a folder on a disk that isn&rsquo;t connected</a>).</p>
|
||
<h3 data-hextra-search-id="what-devvm-doctor-finds-in-vms">What devvm doctor finds in <code>vms/</code><span class="hx:absolute hx:-mt-20" id="what-devvm-doctor-finds-in-vms"></span>
|
||
<a href="#what-devvm-doctor-finds-in-vms" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>vms/</code> should hold only VMs&rsquo; folders, each named by a hash of 14 hexadecimal digits and holding the VM&rsquo;s <code>vm.json</code>. <code>devvm doctor</code> warns about anything else it finds there, says what to do, and changes nothing:</p>
|
||
<ul>
|
||
<li><strong>An entry that isn&rsquo;t a VM&rsquo;s folder,</strong> such as a file or a folder with another name, which devvm never uses. Move it out of <code>vms/</code> or delete it.</li>
|
||
<li><strong>A VM&rsquo;s folder without <code>vm.json</code>,</strong> which a devvm that stopped while making or deleting a VM leaves, for example one holding only the VM&rsquo;s <code>lock</code>. No VM uses the folder, so delete it.</li>
|
||
<li><strong>A folder doctor can&rsquo;t read,</strong> <code>vms/</code> itself or a VM&rsquo;s folder, so it can&rsquo;t check what&rsquo;s in it. Check that you own it and can read it, for example with <code>ls -ld</code>.</li>
|
||
</ul>
|
||
<p>These warnings never make doctor fail, and <code>devvm doctor --json</code> lists them in <code>warnings</code>.</p>
|
||
<h2 data-hextra-search-id="your-settings">Your settings<span class="hx:absolute hx:-mt-20" id="your-settings"></span>
|
||
<a href="#your-settings" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>~/.config/devvm</code> holds what you edit: <code>config.toml</code>, your network rules, your agents&rsquo; settings, your own layers, and your company&rsquo;s CA certificates. devvm also writes the folder&rsquo;s <a href="https://next.devvm.dev/docs/using/troubleshooting/#a-newer-devvm-changed-devvms-folders">layout version</a> into <code>version</code> there when the file is missing or older. <a href="https://next.devvm.dev/docs/using/settings/#your-settings">Your settings</a> lists each file. devvm never deletes any of them.</p>
|
||
<h2 data-hextra-search-id="lima">Lima<span class="hx:absolute hx:-mt-20" id="lima"></span>
|
||
<a href="#lima" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>The Lima backend&rsquo;s VMs and images are in devvm&rsquo;s Lima home, <code>~/.local/share/devvm/lima</code>. Each image is a stopped VM named <code>devvm-img-&lt;key&gt;</code>, and each project VM is a clone of one. On macOS a clone&rsquo;s disk shares its image&rsquo;s blocks until the VM writes them, so <code>du</code> counts those blocks twice. On Linux hosts a VM&rsquo;s disk is an overlay of its image&rsquo;s. <code>devvm rm</code> deletes a VM, <code>devvm gc</code> deletes stale and unfinished images, and <code>devvm images rm</code> deletes any image you name.</p>
|
||
<p>Lima keeps a download cache of its own, <code>~/Library/Caches/lima</code> on macOS and <code>~/.cache/lima</code> on Linux, or <code>$XDG_CACHE_HOME/lima</code> when <code>XDG_CACHE_HOME</code> is set. devvm gives Lima its own copy of Ubuntu&rsquo;s cloud image, so its builds add nothing to that cache. The cache can still hold the cloud images that earlier releases of devvm had Lima download, about 900 MB for each release, and on macOS a copy of each converted to a raw disk, which takes about 2.4 GB more. The cache is Lima&rsquo;s and it isn&rsquo;t in devvm&rsquo;s Lima home, so your own Lima VMs&rsquo; downloads share it.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm gc --caches <span class="c1"># free devvm&#39;s share of Lima&#39;s cache, after asking</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>devvm deletes something in it only when you run <code>devvm gc --caches</code>, and only a folder of Ubuntu&rsquo;s cloud image that all of these hold for:</p>
|
||
<ul>
|
||
<li><strong>It&rsquo;s devvm&rsquo;s.</strong> Lima keeps each download in a folder named by the SHA-256 of its address, and the folder&rsquo;s address is the one devvm downloads base from, for its Ubuntu release.</li>
|
||
<li><strong>devvm&rsquo;s own state names it.</strong> An image record of devvm&rsquo;s names that address, as a build of base by an earlier release left it, and devvm now has its own copy of that image, which builds use instead. An image that no record names stays, as your own Lima VMs may have downloaded it.</li>
|
||
<li><strong>Lima&rsquo;s own templates don&rsquo;t use it.</strong> devvm reads the templates of the <code>limactl</code> on your <code>PATH</code>, and when it can&rsquo;t read them, it frees nothing of Lima&rsquo;s cache, and the run log says why.</li>
|
||
<li><strong>It hasn&rsquo;t changed in the last hour.</strong></li>
|
||
</ul>
|
||
<p>No VM needs its entry once it&rsquo;s made, because Lima copies the disk out of the cache. <code>limactl prune</code> deletes the whole cache, your own downloads included, so devvm never runs it, and you can run it yourself to free the rest.</p>
|
||
<h3 data-hextra-search-id="ubuntus-cloud-images">Ubuntu&rsquo;s cloud images<span class="hx:absolute hx:-mt-20" id="ubuntus-cloud-images"></span>
|
||
<a href="#ubuntus-cloud-images" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>devvm keeps the Ubuntu cloud image that base starts from in <code>~/.local/share/devvm/images/ubuntu</code>, as <code>&lt;sha256&gt;.img</code>, about 900 MB for each release, and a download that stopped as <code>&lt;sha256&gt;.img.part</code>, which the next build goes on from. <code>devvm space</code> shows them as <code>cloud images</code>.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm gc --caches <span class="c1"># free the cloud images no image needs, after asking</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>devvm keeps the image pinned now, which the next build of base needs, and each image that an image&rsquo;s record names, as Ubuntu removes its dated releases after a few months and building that image again needs the copy. <code>devvm gc --caches</code> frees the others, and a stopped download of any image once that image is there whole, unless one changed in the last hour. When devvm can&rsquo;t read which image is pinned, <code>devvm gc --caches</code> fails rather than free an image the pin may name (<a href="https://next.devvm.dev/docs/internals/images/#ubuntus-cloud-image">Ubuntu&rsquo;s cloud image</a>).</p>
|
||
<h2 data-hextra-search-id="outside-devvms-folders">Outside devvm&rsquo;s folders<span class="hx:absolute hx:-mt-20" id="outside-devvms-folders"></span>
|
||
<a href="#outside-devvms-folders" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm also changes a few things outside its own folders:</p>
|
||
<ul>
|
||
<li><strong>The Keychain:</strong> on macOS, the <a href="https://next.devvm.dev/docs/safety/network/#saving-and-binding-secrets">secrets</a> you save are Keychain items under the service <code>devvm</code>. <code>devvm secret rm</code> deletes one.</li>
|
||
<li><strong><code>~/.ssh/config</code>:</strong> when you let it, devvm adds the line <code>Include ~/.local/share/devvm/ssh_config</code> so that ssh reaches VMs by name (<a href="https://next.devvm.dev/docs/using/ssh/#ssh-access-by-name">SSH and editors</a>).</li>
|
||
<li><strong>Time Machine:</strong> on macOS, devvm keeps each VM&rsquo;s <code>run/ca/</code> out of Time Machine&rsquo;s backups, because a copy of a key elsewhere could impersonate any site to that VM.</li>
|
||
<li><strong>devvm itself:</strong> the install script puts each version in <code>~/.local/lib/devvm/&lt;version&gt;</code> and links <code>~/.local/bin/devvm</code> to it. A newer install removes older versions that nothing runs (<a href="https://next.devvm.dev/docs/using/upgrading/#upgrading">upgrading</a>). Homebrew keeps devvm in its own folders.</li>
|
||
</ul>
|
||
<p><a href="https://next.devvm.dev/docs/using/upgrading/#uninstalling">Uninstalling</a> removes all of it.</p></description></item><item><title>The command line</title><link>https://next.devvm.dev/docs/using/command-line/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/command-line/</guid><description>
|
||
<p>This page covers what works the same way in every command: the help, flags and their values, the questions devvm asks and what answers them beforehand, <code>--json</code> for scripts, and shell completion. <a href="https://next.devvm.dev/docs/getting-started/commands/">Everyday commands</a> lists the commands, and the <a href="https://next.devvm.dev/docs/cli/">CLI reference</a> has every command with all its flags.</p>
|
||
<h2 data-hextra-search-id="help">Help<span class="hx:absolute hx:-mt-20" id="help"></span>
|
||
<a href="#help" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>devvm help COMMAND</code>, <code>devvm COMMAND --help</code> and <code>devvm COMMAND -h</code> print a command&rsquo;s help. It starts with a few sentences on what the command does, then its usage line and its examples, the most common first, each with a comment. Then come its commands, if it has any, and its flags, and the help ends with the address of the docs page that covers the command. <code>devvm --help</code> lists the commands in the groups that <a href="https://next.devvm.dev/docs/getting-started/commands/">Everyday commands</a> has, which are Your VM, Change your VM, Images, Disk space and This machine, with <code>help</code> under Additional Commands, and it ends with devvm&rsquo;s issue tracker after its docs page.</p>
|
||
<p>devvm itself takes no word after it but a command&rsquo;s name, so every word there is a command, and a layer may have any name a command has. When the word after <code>devvm</code> isn&rsquo;t a command, devvm refuses it as a usage error. If the word names a toolchain, an agent or a layer, your own layers included, devvm points you to the flag that chooses it for a new VM, such as <code>devvm --tools node</code> for <code>devvm node</code>, and a word that joins several with <code>+</code> or a comma gets one line with each flag, such as <code>devvm --tools node --agents claude</code> for <code>devvm node+claude</code>. Any other word gets the closest command, such as <code>devvm stop</code> for <code>devvm stpo</code>. <code>devvm stpo --help</code> and <code>devvm help stpo</code> are refused the same way.</p>
|
||
<h2 data-hextra-search-id="flags-and-values">Flags and values<span class="hx:absolute hx:-mt-20" id="flags-and-values"></span>
|
||
<a href="#flags-and-values" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>These rules hold for every command:</p>
|
||
<ul>
|
||
<li>Each flag belongs to the commands that list it in their help, and only <code>-h</code> or <code>--help</code>, <code>-v</code> or <code>--verbose</code> and <code>--no-input</code> work with every command. <code>-v</code> shows the output of the commands devvm runs as they run (<a href="https://next.devvm.dev/docs/using/troubleshooting/#a-command-fails">details</a>), and <code>--no-input</code> makes devvm ask nothing (<a href="#questions-devvm-asks">questions devvm asks</a>). A flag can come before or after the command&rsquo;s arguments, and options that take a value also work with an equals sign, such as <code>--cpus=N</code>.</li>
|
||
<li>The options for a new VM, such as <code>--tools</code> and <code>--cpus</code>, are taken only by <code>devvm</code>. Another command given one of them, such as <code>devvm ls --cpus 4</code>, fails as it does for any flag it doesn&rsquo;t know (<a href="https://next.devvm.dev/docs/using/images/#what-a-new-vm-gets">what a new VM gets</a>).</li>
|
||
<li>When a flag or a setting can mean none or off, you write that as a word: <code>devvm setup --features none</code>, <code>devvm --agents none</code>, <code>devvm ports none</code>, <code>devvm retention history.age=off</code> and <code>devvm ssh-agent add KEY_FILE --lifetime forever</code>. devvm refuses an empty value, such as <code>--features ''</code>, and an empty argument, so a blank never stands for none or for a default.</li>
|
||
<li>Every duration is a whole number followed by a unit, which is <code>m</code> for minutes, <code>h</code> for hours, <code>d</code> for days or <code>w</code> for weeks, as in <code>30m</code>, <code>12h</code>, <code>30d</code> or <code>2w</code>. That covers <code>devvm gc --older-than</code>, the retention settings&rsquo; ages and <code>devvm ssh-agent add --lifetime</code>, and only <code>--lifetime</code> also takes <code>forever</code>, for a key that devvm&rsquo;s agent keeps until it ends.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="questions-devvm-asks">Questions devvm asks<span class="hx:absolute hx:-mt-20" id="questions-devvm-asks"></span>
|
||
<a href="#questions-devvm-asks" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm asks a question only in a terminal, and each question has a flag or a command that answers it beforehand, so a script never needs to answer one. Without a terminal, with <code>--no-input</code>, or when the input ends before an answer, devvm can&rsquo;t ask, and every question is handled the same way in all three cases. A question that only adds something, such as an agent&rsquo;s folders or the <code>Include</code> line, gets its usual answer or a warning that says what to do, and a command that deletes something refuses unless you give it <code>--force</code>.</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Question</th>
|
||
<th>Answered by</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>the CPUs and memory new VMs get, on the first run</td>
|
||
<td><code>--cpus</code> and <code>--memory</code>, or <code>devvm size -g</code>, or nothing: where devvm can&rsquo;t ask, new VMs get the size they would anyway</td>
|
||
</tr>
|
||
<tr>
|
||
<td>the coding agents new VMs get, on the first run and in <code>devvm setup</code></td>
|
||
<td><code>devvm setup --agents LIST</code> or <code>devvm setup --agents none</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>base&rsquo;s features, on the first run before the new VM&rsquo;s summary, or on the first build</td>
|
||
<td><code>devvm setup --features LIST</code> or <code>devvm setup --features none</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>whether to customize a new VM, after its summary</td>
|
||
<td><code>--tools</code>, <code>--agents</code>, <code>--layers</code>, <code>--network</code>, <code>--ports</code>, <code>--cpus</code>, <code>--memory</code> and <code>--disk</code>, or nothing: where devvm can&rsquo;t ask, the VM gets what the summary shows</td>
|
||
</tr>
|
||
<tr>
|
||
<td>a new VM&rsquo;s toolchains, coding agents and layers, when you customize it</td>
|
||
<td><code>--tools</code>, <code>--agents</code> and <code>--layers</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>a new VM&rsquo;s network tier, chosen from a list when you customize it</td>
|
||
<td><code>--network TIER</code>, or <code>devvm network -g</code> with a tier for every new VM, or nothing: where devvm can&rsquo;t show the list, the VM gets the tier the summary shows</td>
|
||
</tr>
|
||
<tr>
|
||
<td>the ports a new VM forwards, chosen from a list when you customize it: every port, none, or the ports you type</td>
|
||
<td><code>--ports</code>, or <code>devvm ports -g</code> with the ports every new VM forwards, or nothing: where devvm can&rsquo;t ask, the VM forwards the ports the summary shows</td>
|
||
</tr>
|
||
<tr>
|
||
<td>a new VM&rsquo;s CPUs, memory and disk, when you customize it</td>
|
||
<td><code>--cpus</code>, <code>--memory</code> and <code>--disk</code>, or nothing: where devvm can&rsquo;t ask, the VM gets the size the summary shows</td>
|
||
</tr>
|
||
<tr>
|
||
<td>the layers new VMs get, in <code>devvm setup</code></td>
|
||
<td><code>devvm setup --layers LIST</code> or <code>devvm setup --layers none</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>a VM&rsquo;s toolchains and agents, in <code>devvm tools</code></td>
|
||
<td><code>devvm tools add</code> and <code>devvm tools rm</code>, or <code>--json</code> to show them</td>
|
||
</tr>
|
||
<tr>
|
||
<td>new VMs&rsquo; network tier, in <code>devvm setup</code></td>
|
||
<td><code>devvm network -g</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>whether to load an SSH key into your agent</td>
|
||
<td><code>devvm ssh-agent add KEY_FILE</code> beforehand</td>
|
||
</tr>
|
||
<tr>
|
||
<td>whether to restart a running VM to apply a change from <code>devvm size</code>, <code>devvm network</code>, <code>devvm ssh-agent</code> or <code>devvm git-protect</code>, or, as devvm opens it, the changes that wait for its next start, such as an agent&rsquo;s new folders</td>
|
||
<td><code>devvm restart</code> afterwards, or nothing: without a terminal or with <code>--no-input</code>, the change waits for the VM&rsquo;s next start</td>
|
||
</tr>
|
||
<tr>
|
||
<td>whether to add the <code>Include</code> line to <code>~/.ssh/config</code></td>
|
||
<td><code>--ssh-config</code> on <code>devvm</code>, <code>devvm host</code> and <code>devvm code</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>a Claude Code token or a GitHub token</td>
|
||
<td><code>devvm secret set NAME --stdin</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>an agent&rsquo;s API key, in <code>devvm agent login --api-key</code></td>
|
||
<td><code>--stdin</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>whether to delete, in <code>devvm rm</code>, <code>devvm gc</code>, <code>devvm gc --caches</code>, <code>devvm images rm</code> and <code>devvm secret rm</code></td>
|
||
<td><code>--force</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>whether to replace the images built on one, in <code>devvm rebuild</code></td>
|
||
<td><code>--force</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>whether to replace what devvm&rsquo;s agent store has, in <code>devvm agent import</code></td>
|
||
<td><code>--force</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>whether to install a release, in <code>devvm upgrade</code></td>
|
||
<td><code>--force</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>whether to use the VM made for an earlier folder here, in <code>devvm adopt</code>, or to move a VM to this folder, in <code>devvm adopt VM</code></td>
|
||
<td><code>--force</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>whether to move the VM made for this folder at the path it had before, in any command on this folder&rsquo;s VM</td>
|
||
<td><code>devvm adopt --force</code></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p><code>--force</code> only skips a confirmation, and it never deletes more than the command does without it. A command that would delete something asks first in a terminal, and where devvm can&rsquo;t ask, it refuses unless you give <code>--force</code>.</p>
|
||
<p>A few questions protect work that only you can judge, so no flag answers them, and devvm asks them only in a terminal. Where devvm can&rsquo;t ask, each of them refuses and says what to run instead. They are these:</p>
|
||
<ul>
|
||
<li><code>devvm rm</code> deleting the VM of a folder this one is inside or the VM made for an earlier folder at this path</li>
|
||
<li>a <code>--clone</code> VM&rsquo;s commits that this repo hasn&rsquo;t fetched and its uncommitted changes</li>
|
||
<li>a command giving the VM of a folder this one is inside more access</li>
|
||
<li><code>devvm agent save</code> saving a VM&rsquo;s settings for every VM</li>
|
||
</ul>
|
||
<p>With <code>--no-input</code>, devvm asks nothing even in a terminal, and it never reads an answer from a pipe or a file either. A question that has no usual answer fails instead, after devvm shows the question, and the error names the flag or command that answers it. A question fails the same way when the input ends before an answer, as it does when you press Ctrl+D at the prompt.</p>
|
||
<h2 data-hextra-search-id="output-for-scripts">Output for scripts<span class="hx:absolute hx:-mt-20" id="output-for-scripts"></span>
|
||
<a href="#output-for-scripts" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Every command that shows or lists something takes <code>--json</code>, which prints what the command shows as one JSON object instead of a table or lines, so a script can read it. The page for each command lists its fields with an example, and every command&rsquo;s JSON follows the same rules:</p>
|
||
<ul>
|
||
<li>The object&rsquo;s first field is <code>&quot;version&quot;: 1</code>. A shape only ever gains fields. devvm adds new fields to version 1, and any other change to a shape, such as a field renamed, removed or given another type, comes with a new version.</li>
|
||
<li>With <code>--json</code>, standard output gets only the JSON. devvm&rsquo;s messages, such as warnings and notes, still go to standard error, as they do without it, and the JSON is never colored.</li>
|
||
<li>A list with nothing in it is <code>[]</code>, never <code>null</code>.</li>
|
||
<li>Sizes are in bytes, unless a field&rsquo;s name gives the unit, such as <code>memory_gib</code>.</li>
|
||
<li>A field that doesn&rsquo;t apply, such as a VM&rsquo;s <code>from</code> when its base is Ubuntu&rsquo;s cloud image, is left out.</li>
|
||
</ul>
|
||
<p>A command that shows a setting when you run it bare and changes the setting when you give it a value, such as <code>devvm network</code> or <code>devvm size</code>, only shows with <code>--json</code>. devvm refuses a value given with <code>--json</code>, such as <code>devvm network open</code> with <code>--json</code>, and changes nothing.</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Command</th>
|
||
<th>Its JSON</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>devvm ls --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/using/vms/#devvm-ls---json">the project VMs</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm images --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/using/images/#devvm-images---json">the images and the shared tool images</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm tools --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/using/toolchains/#devvm-tools---json">this folder&rsquo;s VM&rsquo;s shared tools</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm size --json</code>, <code>devvm ports --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/using/ports-size/#as-json">this folder&rsquo;s VM&rsquo;s size and ports</a>, or with <code>-g</code>, new VMs'</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm network --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/safety/network/#devvm-network---json">this folder&rsquo;s VM&rsquo;s network tier and allowlist</a>, or with <code>-g</code>, new VMs&rsquo; choice</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm network log --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/safety/network/#devvm-network-log---json">this folder&rsquo;s VM&rsquo;s network log, or with <code>--blocked</code> its blocks</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm secret --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/safety/network/#devvm-secret---json">the secrets, whether each is saved and the VMs using it</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm ssh-agent --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/using/ssh/#devvm-ssh-agent---json">this folder&rsquo;s VM&rsquo;s SSH agent forwarding and devvm&rsquo;s own agent&rsquo;s keys</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm link --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/using/links/#devvm-link---json">this folder&rsquo;s VM&rsquo;s links</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm link publish --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/using/links/#devvm-link-publish---json">the ports this folder&rsquo;s VM publishes to links</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm git-protect --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/safety/git-protection/#devvm-git-protect---json">this folder&rsquo;s VM&rsquo;s <code>.git</code> protection</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm history --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/using/coding-agents/#devvm-history---json">the saved exports of agents&rsquo; history</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm space --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/using/space/#devvm-space---json">what devvm keeps on this machine</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm retention --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/using/settings/#devvm-retention---json">the retention settings</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm doctor --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/internals/install/#devvm-doctor---json">what devvm needs on this machine and what&rsquo;s missing</a>, and it prints nothing else</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm upgrade --json</code></td>
|
||
<td><a href="https://next.devvm.dev/docs/using/upgrading/#devvm-upgrade---json">the newest release and how this devvm was installed</a>, and it installs nothing</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<h2 data-hextra-search-id="shell-completion">Shell completion<span class="hx:absolute hx:-mt-20" id="shell-completion"></span>
|
||
<a href="#shell-completion" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>devvm completion SHELL</code> prints the shell completion script for <code>bash</code>, <code>zsh</code> or <code>fish</code>. The script completes commands, flags and the image names that <code>devvm build</code> and <code>devvm rebuild</code> take, including layers joined with <code>+</code> after the ones you&rsquo;ve already typed. It also completes shared tools for <code>devvm tools add</code> and <code>devvm tools rm</code>, the lists that <code>--tools</code>, <code>--agents</code> and <code>--layers</code> take, after the names you&rsquo;ve already typed and their commas, and <code>all</code> and <code>none</code> for <code>--ports</code> and <code>devvm ports</code>. Load it from your shell&rsquo;s startup file:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Shell</th>
|
||
<th>Line</th>
|
||
<th>In</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>bash</td>
|
||
<td><code>source &lt;(devvm completion bash)</code></td>
|
||
<td><code>~/.bashrc</code>, with the bash-completion package installed</td>
|
||
</tr>
|
||
<tr>
|
||
<td>zsh</td>
|
||
<td><code>source &lt;(devvm completion zsh)</code></td>
|
||
<td><code>~/.zshrc</code>, after <code>compinit</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>fish</td>
|
||
<td><code>devvm completion fish | source</code></td>
|
||
<td><code>~/.config/fish/config.fish</code></td>
|
||
</tr>
|
||
</tbody>
|
||
</table></description></item><item><title>Upgrading and uninstalling</title><link>https://next.devvm.dev/docs/using/upgrading/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/upgrading/</guid><description>
|
||
<p>This page covers upgrading devvm, switching between Homebrew and the install script, and removing devvm with everything it keeps. Each depends on how you <a href="https://next.devvm.dev/docs/getting-started/install/">installed devvm</a>, and your images, VMs and settings stay through an upgrade or a switch, because they don&rsquo;t live with devvm. <a href="https://next.devvm.dev/docs/internals/install/">Installing and updating</a> explains what the install script and devvm upgrade check.</p>
|
||
<h2 data-hextra-search-id="upgrading">Upgrading<span class="hx:absolute hx:-mt-20" id="upgrading"></span>
|
||
<a href="#upgrading" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>To upgrade devvm, run <code>devvm upgrade</code>, which installs the newest release the way you installed devvm:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm upgrade <span class="c1"># install the newest release, asking first</span>
|
||
</span></span><span class="line"><span class="cl">devvm upgrade --check <span class="c1"># say whether a newer release is out, and install nothing</span>
|
||
</span></span><span class="line"><span class="cl">devvm upgrade --force <span class="c1"># install it without asking, as a script must</span>
|
||
</span></span><span class="line"><span class="cl">devvm upgrade --to 0.1.0 <span class="c1"># install that release, even one older than the devvm you have</span>
|
||
</span></span><span class="line"><span class="cl">devvm upgrade --to 0.2.0-rc.1 <span class="c1"># install a prerelease, which only --to installs</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>It says which release it will install in place of the devvm you have, and asks first, so without a terminal or with <code>--no-input</code> it needs <code>--force</code>.</p>
|
||
<p>You don&rsquo;t have to remember to check. When you run devvm in a terminal, it checks at most once a day for a newer release without making you wait, and when one is out it says so in one line that names devvm upgrade. It never upgrades on its own, and <code>release-check = false</code> in <code>config.toml</code> or <code>DEVVM_NO_RELEASE_CHECK=1</code> turns the check off (<a href="https://next.devvm.dev/docs/using/settings/#the-release-check">the release check</a>).</p>
|
||
<p>You can also upgrade devvm without devvm upgrade, with the command for the way you installed it:</p>
|
||
<div class="devvm-install">
|
||
<div class="hextra-scrollbar hx:overflow-x-auto hx:overflow-y-hidden hx:overscroll-x-contain">
|
||
<div class="hx:mt-4 hx:flex hx:w-max hx:min-w-full hx:border-b hx:border-gray-200 hx:pb-px hx:dark:border-neutral-800" role="tablist"><button class="hextra-tabs-toggle hx:cursor-pointer hx:data-[state=selected]:border-primary-500 hx:data-[state=selected]:text-primary-600 hx:data-[state=selected]:dark:border-primary-500 hx:data-[state=selected]:dark:text-primary-600 hx:mr-2 hx:rounded-t hx:p-2 hx:font-medium hx:leading-5 hx:transition-colors hx:-mb-0.5 hx:select-none hx:border-b-2 hx:border-transparent hx:text-gray-600 hx:hover:border-gray-200 hx:hover:text-black hx:dark:text-gray-200 hx:dark:hover:border-neutral-800 hx:dark:hover:text-white hx:hextra-focus-visible-inset" id="tabs-tab-tabs-os-tabs-0-1" role="tab" type="button" aria-controls="tabs-panel-tabs-os-tabs-0-1" aria-selected="true" tabindex="0" data-state="selected"><span class="hx:inline-flex hx:items-center hx:gap-1.5"><span><svg class="devvm-icon" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="currentColor" shape-rendering="crispEdges"><path d="M5 4h1V3h1V2h1V1H6v1H5Zm-3 7h1v-1H2Zm1 1h2v-1H3Zm-2-2h1V5H1Zm4 1h1v-1H5Zm1 1h2v-1H6Zm2-1h1v-1H8ZM2 5h2V4H2Zm7 5h1V9H9ZM4 6h3V5H4Zm4 3h1V6H8ZM7 5h2V4H7Zm2 1h1V5H9Zm0 0"/></svg>macOS</span></span></button><button class="hextra-tabs-toggle hx:cursor-pointer hx:data-[state=selected]:border-primary-500 hx:data-[state=selected]:text-primary-600 hx:data-[state=selected]:dark:border-primary-500 hx:data-[state=selected]:dark:text-primary-600 hx:mr-2 hx:rounded-t hx:p-2 hx:font-medium hx:leading-5 hx:transition-colors hx:-mb-0.5 hx:select-none hx:border-b-2 hx:border-transparent hx:text-gray-600 hx:hover:border-gray-200 hx:hover:text-black hx:dark:text-gray-200 hx:dark:hover:border-neutral-800 hx:dark:hover:text-white hx:hextra-focus-visible-inset" id="tabs-tab-tabs-os-tabs-0-2" role="tab" type="button" aria-controls="tabs-panel-tabs-os-tabs-0-2" aria-selected="false" tabindex="-1"><span class="hx:inline-flex hx:items-center hx:gap-1.5"><span><svg class="devvm-icon" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="currentColor" shape-rendering="crispEdges"><path d="M3 1h5v1H3ZM2 2h1v1H2ZM8 2h1v1H8ZM2 3h1v1H2ZM4 3h1v1H4ZM6 3h1v1H6ZM8 3h1v1H8ZM2 4h1v1H2ZM8 4h1v1H8ZM1 5h1v1H1ZM4 5h3v1H4ZM9 5h1v1H9ZM0 6h1v1H0ZM3 6h1v1H3ZM7 6h1v1H7ZM10 6h1v1H10ZM0 7h1v1H0ZM2 7h1v1H2ZM8 7h1v1H8ZM10 7h1v1H10ZM0 8h1v1H0ZM2 8h1v1H2ZM8 8h1v1H8ZM10 8h1v1H10ZM1 9h2v1H1ZM8 9h2v1H8ZM2 10h7v1H2ZM1 11h3v1H1ZM7 11h3v1H7Z"/></svg>Linux</span></span></button></div>
|
||
</div>
|
||
<div><div class="hextra-tabs-panel hx:rounded-sm hx:pt-6 hx:hidden hx:data-[state=selected]:block" id="tabs-panel-tabs-os-tabs-0-1" role="tabpanel" aria-labelledby="tabs-tab-tabs-os-tabs-0-1" aria-hidden="false" tabindex="0" data-state="selected"><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">brew upgrade devvm</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>If you installed <code>devvm-rc</code>, Homebrew&rsquo;s formula for prereleases, run <code>brew upgrade devvm-rc</code> instead (<a href="#trying-a-prerelease">trying a prerelease</a>). If you installed devvm with the install script, run the script again, as on Linux.</p></div><div class="hextra-tabs-panel hx:rounded-sm hx:pt-6 hx:hidden hx:data-[state=selected]:block" id="tabs-panel-tabs-os-tabs-0-2" role="tabpanel" aria-labelledby="tabs-tab-tabs-os-tabs-0-2" aria-hidden="true"><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">curl -fsSL https://github.com/devvmhq/devvm/releases/latest/download/install.sh <span class="p">|</span> bash</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Running the install script again installs the newest release.</p></div></div>
|
||
<script>
|
||
(() => {
|
||
const group = document.currentScript.parentElement;
|
||
const platform = [navigator.userAgentData?.platform, navigator.platform, navigator.userAgent].join(" ");
|
||
if (!/linux/i.test(platform) || /android/i.test(platform)) return;
|
||
const select = (elements, attribute, on, off) =>
|
||
elements.forEach((element, i) => {
|
||
const selected = i === 1;
|
||
element.dataset.state = selected ? "selected" : "";
|
||
element.setAttribute(attribute, selected ? on : off);
|
||
if (selected) element.tabIndex = 0;
|
||
else if (attribute === "aria-selected") element.tabIndex = -1;
|
||
else element.removeAttribute("tabindex");
|
||
});
|
||
select(group.querySelectorAll("[role=tab]"), "aria-selected", "true", "false");
|
||
select(group.querySelectorAll("[role=tabpanel]"), "aria-hidden", "false", "true");
|
||
})();
|
||
</script>
|
||
</div>
|
||
<p>Your images and VMs stay, because they live in <code>~/.local/share/devvm</code>, and your settings and layers stay in <code>~/.config/devvm</code>, apart from devvm itself.</p>
|
||
<p>Images whose inputs changed are built again the next time you use them. Existing VMs keep working, and <code>devvm tools update</code> moves a VM to the new shared tools. <code>devvm gc</code> deletes the copies of devvm&rsquo;s files that older versions wrote out, except those that a VM&rsquo;s proxy was started with.</p>
|
||
<h3 data-hextra-search-id="how-devvm-upgrade-upgrades">How devvm upgrade upgrades<span class="hx:absolute hx:-mt-20" id="how-devvm-upgrade-upgrades"></span>
|
||
<a href="#how-devvm-upgrade-upgrades" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>devvm upgrade tells how devvm was installed from where the devvm you ran is, and it never runs anything to find out:</p>
|
||
<ul>
|
||
<li><strong>With the install script</strong>, devvm is <code>~/.local/lib/devvm/&lt;version&gt;/devvm</code>, and <code>~/.local/bin/devvm</code> links to it, or the same folders under <code>DEVVM_PREFIX</code>. devvm upgrade downloads the new release and checks it, as <a href="#what-devvm-upgrade-checks">What devvm upgrade checks</a> describes. It unpacks the release into a folder of its own beside the devvm you have, runs the new devvm to see that it works, and then switches <code>~/.local/bin/devvm</code> to it. When anything fails before the new devvm runs through <code>~/.local/bin/devvm</code>, the link goes back, so the devvm you had stays the one that runs. The version you upgraded from stays in <code>~/.local/lib/devvm</code>, and so does any older version that a running VM still uses, until a later upgrade finds nothing using it.</li>
|
||
<li><strong>With Homebrew</strong>, devvm is in Homebrew&rsquo;s Cellar, and devvm upgrade runs <code>brew upgrade devvm</code> after asking, or <code>brew upgrade devvm-rc</code> when you installed the formula for prereleases. Homebrew may upgrade Lima at the same time, because the formula needs it. Homebrew installs the release its formula names, which can come out a little after the release itself, so until then <code>brew upgrade devvm</code> finds nothing to upgrade.</li>
|
||
<li><strong>Any other way</strong>, such as <code>go install</code>, a build from devvm&rsquo;s source, or a copy of devvm somewhere else, devvm upgrade can&rsquo;t upgrade. It says how that devvm was installed and how to upgrade it, such as with <code>go install github.com/devvmhq/devvm/cmd/devvm@latest</code>, and fails.</li>
|
||
</ul>
|
||
<p>A devvm built without a release key it can read can&rsquo;t check a release&rsquo;s signatures, so devvm upgrade refuses to install a release with it and says to run the install script again.</p>
|
||
<h3 data-hextra-search-id="what-devvm-upgrade-checks">What devvm upgrade checks<span class="hx:absolute hx:-mt-20" id="what-devvm-upgrade-checks"></span>
|
||
<a href="#what-devvm-upgrade-checks" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>devvm upgrade downloads over HTTPS only, and checks each file before it uses the next:</p>
|
||
<ol>
|
||
<li>It downloads the release&rsquo;s <code>SHA256SUMS</code> and its signatures, and checks that the release key that has signed every release so far signed it for that release&rsquo;s version, or, once devvm has its three new release keys built in, that two of them did. The keys are built into the devvm you have, so a replaced release can&rsquo;t bring its own (<a href="https://next.devvm.dev/docs/internals/install/#the-release-keys-and-the-signatures">the release keys and the signatures</a>).</li>
|
||
<li>It downloads the archive for this machine and checks it against its checksum in <code>SHA256SUMS</code>.</li>
|
||
<li>It unpacks the archive, which must hold only devvm&rsquo;s files in one folder.</li>
|
||
<li>It runs the new devvm with <code>--version</code>, which must say the release&rsquo;s version.</li>
|
||
</ol>
|
||
<p>When a check fails, devvm upgrade installs nothing, and the devvm you have stays the one that runs. It checks the signature itself, so it doesn&rsquo;t need minisign on this machine, as the install script does. It never runs a script that it downloaded, only the new devvm&rsquo;s <code>--version</code>.</p>
|
||
<h3 data-hextra-search-id="an-older-release">An older release<span class="hx:absolute hx:-mt-20" id="an-older-release"></span>
|
||
<a href="#an-older-release" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>When the newest release is older than the devvm you have, devvm upgrade refuses to install it, even with <code>--force</code>. A server that offers an old release in place of the newest could bring back problems that a newer release fixed, so devvm upgrade never goes back a version unless you name it. <code>devvm upgrade --to VERSION</code> installs the release you name, newer or older, and it asks first, saying when the release is older than the devvm you have. When the devvm you have is a prerelease of a release that isn&rsquo;t out yet, the newest release is older too, and devvm upgrade says so and installs nothing, without failing (<a href="#trying-a-prerelease">trying a prerelease</a>).</p>
|
||
<p>Homebrew installs only its formula&rsquo;s release, so with Homebrew devvm upgrade doesn&rsquo;t take <code>--to</code>.</p>
|
||
<h3 data-hextra-search-id="trying-a-prerelease">Trying a prerelease<span class="hx:absolute hx:-mt-20" id="trying-a-prerelease"></span>
|
||
<a href="#trying-a-prerelease" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>A prerelease is a version of devvm that you can try before its release is out, such as a release candidate, <code>0.2.0-rc.1</code>, or a beta, <code>0.2.0-beta.1</code>. devvm upgrade and the install script never pick a prerelease as the newest release, and the daily release check never announces one, so you get a prerelease only when you name it or when you install <code>devvm-rc</code>, Homebrew&rsquo;s formula for prereleases.</p>
|
||
<div class="devvm-callout devvm-callout-note">
|
||
<p class="devvm-callout-title"><svg class="devvm-icon" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="currentColor" shape-rendering="crispEdges"><path d="M4 9h3V8H6V5H4v1h1v2H4Zm-3 1h1V9H1Zm1 1h1v-1H2ZM0 9h1V4H0Zm3 3h5v-1H3Zm5-1h1v-1H8ZM1 4h1V3H1Zm8 6h1V9H9ZM2 3h1V2H2Zm3 1h1V3H5Zm5 5h1V4h-1ZM3 2h5V1H3Zm6 2h1V3H9ZM8 3h1V2H8Zm0 0"/></svg> Note</p><p>The docs at <a href="https://devvm.dev/" target="_blank" rel="noopener">devvm.dev</a> are for the newest release. The docs for the next release, which a prerelease comes before, are at <a href="https://next.devvm.dev/" target="_blank" rel="noopener">next.devvm.dev</a>, and they change as that release is written, so they can describe more than a prerelease has.</p></div><p>Versions go in this order: a prerelease comes before its release, a beta before a release candidate, and the numbers in order, so <code>0.2.0-beta.3</code> comes before <code>0.2.0-rc.1</code>, then <code>0.2.0-rc.2</code>, then <code>0.2.0</code>.</p>
|
||
<h4 data-hextra-search-id="with-homebrew">With Homebrew<span class="hx:absolute hx:-mt-20" id="with-homebrew"></span>
|
||
<a href="#with-homebrew" class="subheading-anchor" aria-label="Permalink for this section"></a></h4><p>Homebrew&rsquo;s <code>devvm</code> formula always names the newest release, and the <code>devvm-rc</code> formula names the newest prerelease, or the newest release when that&rsquo;s newer. Both install the same <code>devvm</code> command, so Homebrew installs only one of them at a time. To switch from <code>devvm</code> to <code>devvm-rc</code>, uninstall <code>devvm</code> first, then trust and install <code>devvm-rc</code>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">brew uninstall devvm
|
||
</span></span><span class="line"><span class="cl">brew trust --formula devvmhq/tap/devvm-rc
|
||
</span></span><span class="line"><span class="cl">brew install devvmhq/tap/devvm-rc</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>To install <code>devvm-rc</code> when Homebrew hasn&rsquo;t installed devvm before, run only the last two lines. Your images, VMs and settings stay, because they don&rsquo;t live with devvm.</p>
|
||
<p><code>brew upgrade devvm-rc</code> moves to the next prerelease once it&rsquo;s out, and to the release once that&rsquo;s out, so <code>devvm-rc</code> never leaves you on an old prerelease. devvm upgrade runs it for you, after asking, and the daily release check announces each newer prerelease and release. Homebrew installs only its formula&rsquo;s version, so devvm upgrade doesn&rsquo;t take <code>--to</code> here either.</p>
|
||
<p>To go back to releases only, uninstall <code>devvm-rc</code> and install <code>devvm</code> again, after trusting it if you never installed it before:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">brew uninstall devvm-rc
|
||
</span></span><span class="line"><span class="cl">brew trust --formula devvmhq/tap/devvm
|
||
</span></span><span class="line"><span class="cl">brew install devvmhq/tap/devvm</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm</code> installs the newest release, even when that&rsquo;s older than the prerelease you had.</p>
|
||
<h4 data-hextra-search-id="with-the-install-script">With the install script<span class="hx:absolute hx:-mt-20" id="with-the-install-script"></span>
|
||
<a href="#with-the-install-script" class="subheading-anchor" aria-label="Permalink for this section"></a></h4><p>To install a prerelease with the install script, run the copy of the script that comes with the prerelease, which installs that prerelease, or give its version to the newest release&rsquo;s script with <code>--version</code>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">curl -fsSL https://github.com/devvmhq/devvm/releases/download/v0.2.0-rc.1/install.sh <span class="p">|</span> bash
|
||
</span></span><span class="line"><span class="cl">curl -fsSL https://github.com/devvmhq/devvm/releases/latest/download/install.sh <span class="p">|</span> bash -s -- --version 0.2.0-rc.1</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>When the install script installed the devvm you have, <code>devvm upgrade --to 0.2.0-rc.1</code> installs the prerelease too. Both check a prerelease&rsquo;s signature and checksum as they check a release&rsquo;s.</p>
|
||
<ul>
|
||
<li>While you run a prerelease that the install script installed, devvm upgrade offers the release it comes before once that release is out, and the daily check says so. It never offers a newer prerelease, such as <code>0.2.0-rc.2</code>, so install one with <code>devvm upgrade --to 0.2.0-rc.2</code>.</li>
|
||
<li>To go back to the newest release before the prerelease&rsquo;s own release is out, name the newest release&rsquo;s version, such as <code>devvm upgrade --to 0.1.0</code>. devvm upgrade asks first, because that release is older than the prerelease you have.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="devvm-upgrade-json">devvm upgrade &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-upgrade-json"></span>
|
||
<a href="#devvm-upgrade-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm upgrade --json</code> prints what <code>devvm upgrade --check</code> says as one JSON object, for scripts, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes, and installs nothing:</p>
|
||
<ul>
|
||
<li><code>current</code> is the version of the devvm you ran.</li>
|
||
<li><code>latest</code> is the newest release&rsquo;s version, which is never a prerelease&rsquo;s, except with Homebrew&rsquo;s <code>devvm-rc</code>, where it&rsquo;s the newest prerelease&rsquo;s or release&rsquo;s, whichever is newer.</li>
|
||
<li><code>newer</code> says whether that&rsquo;s newer than <code>current</code>.</li>
|
||
<li><code>install</code> is how devvm was installed, <code>install.sh</code>, <code>homebrew</code> or <code>other</code>.</li>
|
||
<li><code>path</code> is where the devvm you ran is, its links followed.</li>
|
||
</ul>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;current&#34;</span><span class="p">:</span> <span class="s2">&#34;0.1.0&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;latest&#34;</span><span class="p">:</span> <span class="s2">&#34;0.2.0&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;newer&#34;</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;install&#34;</span><span class="p">:</span> <span class="s2">&#34;install.sh&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;path&#34;</span><span class="p">:</span> <span class="s2">&#34;/Users/you/.local/lib/devvm/0.1.0/devvm&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="one-devvm">One devvm<span class="hx:absolute hx:-mt-20" id="one-devvm"></span>
|
||
<a href="#one-devvm" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Install devvm one way, with Homebrew or with the install script, but not both. With two copies, the one that comes first on your <code>PATH</code> is the one that runs, and <code>brew upgrade devvm</code> may update the one you don&rsquo;t run. So when Homebrew installed devvm, the install script stops before it downloads anything and says to run <code>brew upgrade devvm</code> instead, or <code>brew uninstall devvm</code> first if you want to use the script, and its <code>--force</code> installs a second copy anyway (<a href="https://next.devvm.dev/docs/internals/install/#the-install-script">the install script</a>).</p>
|
||
<p>To switch from one way to the other, remove devvm with the command for the way you installed it, as step 5 of <a href="#uninstalling">Uninstalling</a> shows, and then install it the other way. Your images, VMs and settings stay, because they don&rsquo;t live with devvm:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="c1"># from Homebrew to the install script</span>
|
||
</span></span><span class="line"><span class="cl">brew uninstall devvm <span class="c1"># or devvm-rc, if that&#39;s the formula you installed</span>
|
||
</span></span><span class="line"><span class="cl">curl -fsSL https://github.com/devvmhq/devvm/releases/latest/download/install.sh <span class="p">|</span> bash
|
||
</span></span><span class="line"><span class="cl">
|
||
</span></span><span class="line"><span class="cl"><span class="c1"># from the install script to Homebrew</span>
|
||
</span></span><span class="line"><span class="cl">rm -rf ~/.local/lib/devvm ~/.local/bin/devvm
|
||
</span></span><span class="line"><span class="cl">brew trust --formula devvmhq/tap/devvm
|
||
</span></span><span class="line"><span class="cl">brew install devvmhq/tap/devvm</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>After it installs devvm, the script warns when another devvm comes before <code>~/.local/bin</code> on your <code>PATH</code>. The warning names that copy&rsquo;s path and says to remove it, or to put <code>~/.local/bin</code> before its folder in <code>PATH</code>. <code>devvm doctor</code> warns the same way when the devvm first on your <code>PATH</code> isn&rsquo;t the one you ran, naming both, and the warning doesn&rsquo;t make it fail.</p>
|
||
<h2 data-hextra-search-id="uninstalling">Uninstalling<span class="hx:absolute hx:-mt-20" id="uninstalling"></span>
|
||
<a href="#uninstalling" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><ol>
|
||
<li>
|
||
<p>Delete your VMs: <code>devvm ls</code>, then <code>devvm rm</code> in each folder. For a <code>--clone</code> VM, this also removes the <code>devvm</code> git remote from the repo.</p>
|
||
</li>
|
||
<li>
|
||
<p>Delete the images: <code>devvm gc</code>, then <code>devvm images rm</code> with every name <code>devvm images</code> lists. Images built <code>--from</code> a container image need the same <code>--from</code>: <code>devvm images rm --from node:24 base</code>.</p>
|
||
</li>
|
||
<li>
|
||
<p>Free Lima&rsquo;s cache. In a terminal, <code>devvm gc --caches</code> frees devvm&rsquo;s share of it, after asking. If you don&rsquo;t use Lima yourself, you can also empty its cache: Lima keeps Ubuntu&rsquo;s cloud images in <code>~/Library/Caches/lima</code> on macOS and <code>~/.cache/lima</code> on Linux, and <code>limactl prune</code> deletes that whole cache.</p>
|
||
</li>
|
||
<li>
|
||
<p>Delete your saved secrets: <code>devvm secret rm NAME</code> for each one <code>devvm secret</code> lists. On macOS they&rsquo;re in the Keychain under the service <code>devvm</code>, and on Linux in <code>~/.local/share/devvm/secrets/</code>.</p>
|
||
</li>
|
||
<li>
|
||
<p>Remove devvm itself, with the command for the way you installed it:</p>
|
||
<div class="devvm-install">
|
||
<div class="hextra-scrollbar hx:overflow-x-auto hx:overflow-y-hidden hx:overscroll-x-contain">
|
||
<div class="hx:mt-4 hx:flex hx:w-max hx:min-w-full hx:border-b hx:border-gray-200 hx:pb-px hx:dark:border-neutral-800" role="tablist"><button class="hextra-tabs-toggle hx:cursor-pointer hx:data-[state=selected]:border-primary-500 hx:data-[state=selected]:text-primary-600 hx:data-[state=selected]:dark:border-primary-500 hx:data-[state=selected]:dark:text-primary-600 hx:mr-2 hx:rounded-t hx:p-2 hx:font-medium hx:leading-5 hx:transition-colors hx:-mb-0.5 hx:select-none hx:border-b-2 hx:border-transparent hx:text-gray-600 hx:hover:border-gray-200 hx:hover:text-black hx:dark:text-gray-200 hx:dark:hover:border-neutral-800 hx:dark:hover:text-white hx:hextra-focus-visible-inset" id="tabs-tab-tabs-os-tabs-1-1" role="tab" type="button" aria-controls="tabs-panel-tabs-os-tabs-1-1" aria-selected="true" tabindex="0" data-state="selected"><span class="hx:inline-flex hx:items-center hx:gap-1.5"><span><svg class="devvm-icon" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="currentColor" shape-rendering="crispEdges"><path d="M5 4h1V3h1V2h1V1H6v1H5Zm-3 7h1v-1H2Zm1 1h2v-1H3Zm-2-2h1V5H1Zm4 1h1v-1H5Zm1 1h2v-1H6Zm2-1h1v-1H8ZM2 5h2V4H2Zm7 5h1V9H9ZM4 6h3V5H4Zm4 3h1V6H8ZM7 5h2V4H7Zm2 1h1V5H9Zm0 0"/></svg>macOS</span></span></button><button class="hextra-tabs-toggle hx:cursor-pointer hx:data-[state=selected]:border-primary-500 hx:data-[state=selected]:text-primary-600 hx:data-[state=selected]:dark:border-primary-500 hx:data-[state=selected]:dark:text-primary-600 hx:mr-2 hx:rounded-t hx:p-2 hx:font-medium hx:leading-5 hx:transition-colors hx:-mb-0.5 hx:select-none hx:border-b-2 hx:border-transparent hx:text-gray-600 hx:hover:border-gray-200 hx:hover:text-black hx:dark:text-gray-200 hx:dark:hover:border-neutral-800 hx:dark:hover:text-white hx:hextra-focus-visible-inset" id="tabs-tab-tabs-os-tabs-1-2" role="tab" type="button" aria-controls="tabs-panel-tabs-os-tabs-1-2" aria-selected="false" tabindex="-1"><span class="hx:inline-flex hx:items-center hx:gap-1.5"><span><svg class="devvm-icon" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="currentColor" shape-rendering="crispEdges"><path d="M3 1h5v1H3ZM2 2h1v1H2ZM8 2h1v1H8ZM2 3h1v1H2ZM4 3h1v1H4ZM6 3h1v1H6ZM8 3h1v1H8ZM2 4h1v1H2ZM8 4h1v1H8ZM1 5h1v1H1ZM4 5h3v1H4ZM9 5h1v1H9ZM0 6h1v1H0ZM3 6h1v1H3ZM7 6h1v1H7ZM10 6h1v1H10ZM0 7h1v1H0ZM2 7h1v1H2ZM8 7h1v1H8ZM10 7h1v1H10ZM0 8h1v1H0ZM2 8h1v1H2ZM8 8h1v1H8ZM10 8h1v1H10ZM1 9h2v1H1ZM8 9h2v1H8ZM2 10h7v1H2ZM1 11h3v1H1ZM7 11h3v1H7Z"/></svg>Linux</span></span></button></div>
|
||
</div>
|
||
<div><div class="hextra-tabs-panel hx:rounded-sm hx:pt-6 hx:hidden hx:data-[state=selected]:block" id="tabs-panel-tabs-os-tabs-1-1" role="tabpanel" aria-labelledby="tabs-tab-tabs-os-tabs-1-1" aria-hidden="false" tabindex="0" data-state="selected"><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">brew uninstall devvm</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>If you installed <code>devvm-rc</code>, run <code>brew uninstall devvm-rc</code> instead. If you installed devvm with the install script, remove it as on Linux.</p></div><div class="hextra-tabs-panel hx:rounded-sm hx:pt-6 hx:hidden hx:data-[state=selected]:block" id="tabs-panel-tabs-os-tabs-1-2" role="tabpanel" aria-labelledby="tabs-tab-tabs-os-tabs-1-2" aria-hidden="true"><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rm -rf ~/.local/lib/devvm ~/.local/bin/devvm</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div></div>
|
||
<script>
|
||
(() => {
|
||
const group = document.currentScript.parentElement;
|
||
const platform = [navigator.userAgentData?.platform, navigator.platform, navigator.userAgent].join(" ");
|
||
if (!/linux/i.test(platform) || /android/i.test(platform)) return;
|
||
const select = (elements, attribute, on, off) =>
|
||
elements.forEach((element, i) => {
|
||
const selected = i === 1;
|
||
element.dataset.state = selected ? "selected" : "";
|
||
element.setAttribute(attribute, selected ? on : off);
|
||
if (selected) element.tabIndex = 0;
|
||
else if (attribute === "aria-selected") element.tabIndex = -1;
|
||
else element.removeAttribute("tabindex");
|
||
});
|
||
select(group.querySelectorAll("[role=tab]"), "aria-selected", "true", "false");
|
||
select(group.querySelectorAll("[role=tabpanel]"), "aria-hidden", "false", "true");
|
||
})();
|
||
</script>
|
||
</div>
|
||
</li>
|
||
<li>
|
||
<p>Remove its state: <code>rm -rf ~/.local/share/devvm ~/.config/devvm</code>. That includes your layers, in <code>~/.config/devvm/layers</code>, so copy them somewhere first to keep them. It also includes your exports, the agents&rsquo; history that <code>devvm rm</code> saved, and devvm&rsquo;s agent store, the agents&rsquo; settings in <code>~/.config/devvm/agents</code> and their logins in <code>~/.local/share/devvm/logins</code>. On macOS, the Time Machine exclusions that devvm set on its CA folders and logins folders go with the folders.</p>
|
||
</li>
|
||
<li>
|
||
<p>If you let devvm add it, remove the <code>Include ~/.local/share/devvm/ssh_config</code> line from <code>~/.ssh/config</code>.</p>
|
||
</li>
|
||
</ol></description></item><item><title>Troubleshooting</title><link>https://next.devvm.dev/docs/using/troubleshooting/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/troubleshooting/</guid><description>
|
||
<p>Each section below starts with what you see, then says what to do, with a link to the details.</p>
|
||
<h2 data-hextra-search-id="a-command-fails">A command fails<span class="hx:absolute hx:-mt-20" id="a-command-fails"></span>
|
||
<a href="#a-command-fails" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm prints its own steps and sends the output of the commands it runs to a log, and when a step fails, it prints the end of that log. To watch the output as it runs, add <code>-v</code> or <code>--verbose</code> to any command:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm -v <span class="c1"># open this folder&#39;s VM, showing each command&#39;s output</span>
|
||
</span></span><span class="line"><span class="cl">devvm -v build base <span class="c1"># the same for any command</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>With <code>-v</code>, devvm shows each line on standard error as the log gets it, in place of the status line, and it still writes the log. When a step fails with <code>-v</code>, devvm names the log instead of printing its end again.</p>
|
||
<ul>
|
||
<li><strong>The status line,</strong> which devvm shows in a terminal without <code>-v</code>, says what devvm is waiting for, such as a command it runs, a check of the VM, a look through a folder or another devvm that&rsquo;s changing the same thing. It also shows how long the wait has run and the log&rsquo;s latest line, and a step that takes more than a few seconds leaves a line with its time.</li>
|
||
<li><strong>A wait for another devvm</strong> shows nothing with <code>-v</code> or without a terminal.</li>
|
||
<li><strong>A warning</strong> prints above the status line, and a question takes the status line away until you answer it.</li>
|
||
<li><strong>The log</strong> is <code>~/.local/share/devvm/logs/runs/&lt;date&gt;-&lt;time&gt;-&lt;pid&gt;.log</code>, one for each run that runs a command, which only you can read, and devvm keeps the newest 20, fewer when they take more than 256 MiB together.</li>
|
||
<li><strong>Each command</strong> appears in it as a <code>+</code> line with its arguments, followed by its output, and a numbered step adds a <code># [2/5] &lt;step&gt;</code> line first.</li>
|
||
<li><strong>Passwords and a VM&rsquo;s proxy key</strong> stay out of it, written as <code>user:&lt;password&gt;@</code> and <code>devvm:&lt;key&gt;@</code>, including a company proxy&rsquo;s password from your shell&rsquo;s <code>HTTPS_PROXY</code> (<a href="https://next.devvm.dev/docs/internals/overview/#the-run-log">the run log</a>).</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="a-command-is-refused-before-it-runs">A command is refused before it runs<span class="hx:absolute hx:-mt-20" id="a-command-is-refused-before-it-runs"></span>
|
||
<a href="#a-command-is-refused-before-it-runs" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm checks a command&rsquo;s arguments and flags before it does anything else, so a mistyped one never reaches your VM. When one is wrong, such as a missing argument, one too many, a value the command doesn&rsquo;t take or a flag it doesn&rsquo;t have, devvm says what the command expected, then names that command&rsquo;s own help on the last line:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-console" data-lang="console"><span class="line"><span class="cl"><span class="gp">$</span> devvm ports <span class="m">5173</span> <span class="m">8080</span>
|
||
</span></span><span class="line"><span class="cl"><span class="go">devvm: The command devvm ports takes [all|none|LIST], not 5173 8080.
|
||
</span></span></span><span class="line"><span class="cl"><span class="go">devvm: https://devvm.dev/docs/using/troubleshooting/#a-command-is-refused-before-it-runs
|
||
</span></span></span><span class="line"><span class="cl"><span class="go">Run devvm ports --help to see how to use it.
|
||
</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Nothing has changed at that point, so you can fix the command and run it again.</p>
|
||
<h2 data-hextra-search-id="exit-codes">Exit codes<span class="hx:absolute hx:-mt-20" id="exit-codes"></span>
|
||
<a href="#exit-codes" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm exits with one of four codes, so a script can tell what happened:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Code</th>
|
||
<th>Meaning</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>0</td>
|
||
<td>The command succeeded.</td>
|
||
</tr>
|
||
<tr>
|
||
<td>1</td>
|
||
<td>The command failed, and devvm&rsquo;s error says why.</td>
|
||
</tr>
|
||
<tr>
|
||
<td>2</td>
|
||
<td>devvm refused the command line, such as a bad argument or flag or an unknown command, before anything ran.</td>
|
||
</tr>
|
||
<tr>
|
||
<td>130</td>
|
||
<td>The command was interrupted by Ctrl+C or a closed terminal (<a href="#you-pressed-ctrlc">you pressed Ctrl+C</a>).</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>Two programs can take devvm&rsquo;s place and exit with their own codes. Once devvm opens a shell in your VM, the shell replaces devvm, so the code is the shell&rsquo;s, and <code>devvm limactl</code> exits with limactl&rsquo;s code.</p>
|
||
<h2 data-hextra-search-id="a-build-fails">A build fails<span class="hx:absolute hx:-mt-20" id="a-build-fails"></span>
|
||
<a href="#a-build-fails" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When an image&rsquo;s build fails in its script, or as the build VM starts or stops, devvm keeps the build VM, stopped and without a record, so you can look inside. devvm&rsquo;s error names the VM and says how to open a shell in it. On Lima, that&rsquo;s <a href="https://next.devvm.dev/docs/backends/lima/#running-limactl"><code>devvm limactl</code></a>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm limactl shell --start devvm-img-&lt;key&gt;</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>--start</code> starts the VM first, outside the build&rsquo;s confinement. What happens next depends on the failure:</p>
|
||
<ul>
|
||
<li>The next build of that image deletes the VM and starts over, and <code>devvm gc</code> also deletes it.</li>
|
||
<li>A build whose create or clone fails deletes the image, once devvm has shown the end of the log, because there&rsquo;s nothing in the image to look at.</li>
|
||
<li>A first build of base also fails when the packages its VM gives back aren&rsquo;t exactly the packages apt downloaded, each named by its own checksum with apt&rsquo;s entry for it. devvm then keeps none of them, so nothing it didn&rsquo;t check reaches its package cache (<a href="https://next.devvm.dev/docs/internals/images/#bases-packages">base&rsquo;s packages</a>).</li>
|
||
</ul>
|
||
<p>Either way, the images under it, which are already built, stay. devvm deletes and builds again any image it finds without its record, such as a failed build&rsquo;s or one devvm couldn&rsquo;t clean up after a crash or a power cut.</p>
|
||
<h2 data-hextra-search-id="not-enough-free-space">Not enough free space<span class="hx:absolute hx:-mt-20" id="not-enough-free-space"></span>
|
||
<a href="#not-enough-free-space" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Before each build and each new VM, devvm checks the free space on the disk that will hold it, and it refuses when there&rsquo;s less than the step needs. With Lima on macOS, that&rsquo;s 8 GiB for base, 2 GiB for another image or a VM, and from 4 GiB for one shared tool to 8 GiB for all ten, and <a href="https://next.devvm.dev/docs/using/ports-size/#free-space">free space</a> gives the numbers for Linux hosts. The message says which folder&rsquo;s disk it checked, how much is free and how much the step needs. Nothing has been built or made yet, so you can make room and run the same command again:</p>
|
||
<ul>
|
||
<li><code>devvm gc</code> deletes stale and unfinished images and unused shared tool images (<a href="https://next.devvm.dev/docs/using/images/#cleaning-up">cleaning up</a>).</li>
|
||
<li><code>devvm images</code> lists the images and shared tool images with the space each takes, and <code>devvm images rm</code> deletes those you don&rsquo;t need (<a href="https://next.devvm.dev/docs/using/images/#deleting-images">deleting images</a>).</li>
|
||
<li><code>devvm ls</code> lists your VMs, and <code>devvm rm</code> deletes one. devvm never deletes a VM to make room, because a VM may hold work you haven&rsquo;t saved.</li>
|
||
</ul>
|
||
<p>When devvm says it couldn&rsquo;t read the free space, the error after the message says why, such as a folder it can&rsquo;t reach.</p>
|
||
<h2 data-hextra-search-id="you-pressed-ctrlc">You pressed Ctrl+C<span class="hx:absolute hx:-mt-20" id="you-pressed-ctrlc"></span>
|
||
<a href="#you-pressed-ctrlc" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Ctrl+C, or closing the terminal, stops the command that&rsquo;s running, cleans up what the run left unfinished, and exits with code 130. A second Ctrl+C doesn&rsquo;t stop the cleanup. At a question, Ctrl+C ends the run at once, and devvm doesn&rsquo;t take an answer you type after it, so nothing goes ahead.</p>
|
||
<p>devvm deletes an interrupted new VM, with its state, until its first shell opens, because nothing of yours is in it yet. An interrupted build deletes the image it was building.</p>
|
||
<h2 data-hextra-search-id="base-cant-build-on-lima">base can&rsquo;t build on Lima<span class="hx:absolute hx:-mt-20" id="base-cant-build-on-lima"></span>
|
||
<a href="#base-cant-build-on-lima" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>On Lima, base starts from a dated release of Ubuntu&rsquo;s cloud image. The first time devvm builds base, it finds the newest release on cloud-images.ubuntu.com and pins it on this machine, then downloads that image, which takes a while on a slow link (<a href="https://next.devvm.dev/docs/internals/images/#ubuntus-cloud-image">Ubuntu&rsquo;s cloud image</a>). What devvm says tells you which of these went wrong:</p>
|
||
<ul>
|
||
<li><strong>It can&rsquo;t pin a release.</strong> The first build needs to reach Ubuntu&rsquo;s list of releases and the release&rsquo;s checksums, and when it can&rsquo;t, devvm says so and pins nothing. Check that you&rsquo;re online and run the command again. When the newest release doesn&rsquo;t boot, devvm says so and builds base from the release before it.</li>
|
||
<li><strong>It couldn&rsquo;t download the image.</strong> devvm keeps what came, so check that you&rsquo;re online, or that a company proxy lets the download through, and run the command again, which goes on from where the last try stopped.</li>
|
||
<li><strong>The server&rsquo;s certificate isn&rsquo;t valid.</strong> When a CA this machine trusts signed a certificate that&rsquo;s out of date or for another host, devvm says so, for the list of releases and the image alike. Check that this machine&rsquo;s date and time are right, and that nothing on this network, such as a hotel&rsquo;s sign-in page, answers for that host. When the certificate fails for another reason, such as a weak signature from a network that inspects TLS, devvm names that reason, and trying again won&rsquo;t help. A certificate this machine doesn&rsquo;t trust at all needs your company&rsquo;s CA (<a href="https://next.devvm.dev/docs/using/settings/#a-companys-ca">a company&rsquo;s CA</a>).</li>
|
||
<li><strong>The release is gone.</strong> Once an image is pinned, building base again needs devvm&rsquo;s copy of it, Lima&rsquo;s cached copy or the release itself, which Ubuntu removes after a few months, and devvm says when Ubuntu no longer has it.</li>
|
||
<li><strong>A package is gone or changed.</strong> Building the same base again also needs the copies of its packages that devvm kept from its first build, and when one of them is gone or changed, devvm names it and builds nothing (<a href="https://next.devvm.dev/docs/internals/images/#bases-packages">base&rsquo;s packages</a>).</li>
|
||
</ul>
|
||
<p>When the release or a package is gone, start base again from the newest release and packages:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm rebuild base <span class="c1"># pin the newest cloud image again, and install the newest packages</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="no-package-source-answers">No package source answers<span class="hx:absolute hx:-mt-20" id="no-package-source-answers"></span>
|
||
<a href="#no-package-source-answers" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>The first build of base on this machine gets its packages from Ubuntu&rsquo;s archive, or first from the <a href="https://next.devvm.dev/docs/using/settings/#an-ubuntu-mirror">mirror you set</a>. When neither answers, devvm stops at once and says so, without trying again, and it keeps the build VM stopped as for any <a href="#a-build-fails">failed build</a>. Check that you&rsquo;re online, and that the mirror&rsquo;s address is right, then run the command again. Building the same base again later needs neither, because devvm installs the packages it kept from the first build.</p>
|
||
<h2 data-hextra-search-id="base-gets-old-package-lists">Base gets old package lists<span class="hx:absolute hx:-mt-20" id="base-gets-old-package-lists"></span>
|
||
<a href="#base-gets-old-package-lists" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>The first build of base checks that the package lists it got are as new as the Ubuntu cloud image it starts from, because Ubuntu&rsquo;s signed lists don&rsquo;t expire, and a server that stopped updating still serves them. When the lists for one part of the archive, such as <code>resolute-updates</code>, are more than a day older than the cloud image, devvm refuses them, keeps none of the build&rsquo;s packages and names that part, its date and the image. When you set a <a href="https://next.devvm.dev/docs/using/settings/#an-ubuntu-mirror">mirror</a>, devvm names it, so set <code>ubuntu-mirror</code> to one that&rsquo;s up to date, or remove it to use Ubuntu&rsquo;s archive. Without a mirror, the old lists came from Ubuntu&rsquo;s archive itself, so check that no proxy or cache between you and the archive serves an old copy, then run the command again.</p>
|
||
<h2 data-hextra-search-id="a-file-devvm-cant-read">A file devvm can&rsquo;t read<span class="hx:absolute hx:-mt-20" id="a-file-devvm-cant-read"></span>
|
||
<a href="#a-file-devvm-cant-read" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When devvm can&rsquo;t read one of its settings or state files, it names the file, and the line when the problem is on one. Fix the line or delete the file. <a href="https://next.devvm.dev/docs/using/settings/#your-settings">Your settings</a> lists what each file you edit holds, and <a href="https://next.devvm.dev/docs/using/space/#devvms-data-folder">devvm&rsquo;s data folder</a> what each file devvm writes holds.</p>
|
||
<p>A VM&rsquo;s own state file, <code>vm.json</code> in its folder in <code>vms/</code>, is the one to fix rather than delete, because it&rsquo;s what devvm knows of that VM. While devvm can&rsquo;t read it:</p>
|
||
<ul>
|
||
<li>Every command on that VM fails, and the commands that read every VM leave that VM out and carry on with the rest.</li>
|
||
<li><code>devvm ls</code> warns and lists the VM with its name and status alone, when its backend has it, and <code>devvm gc --orphans</code> never forgets it.</li>
|
||
<li>devvm doesn&rsquo;t know which shared tools such a VM uses or which folders it mounts, so <code>devvm space</code>, <code>devvm images</code> and <code>devvm gc</code> fail and name the file.</li>
|
||
<li>devvm refuses to add a key to its own SSH agent, or to load one into it as a VM starts, because it can&rsquo;t tell whether that VM mounts the key&rsquo;s folder.</li>
|
||
</ul>
|
||
<p>Every command on such a VM fails until you fix its file. To find every VM whose state devvm can&rsquo;t read, run doctor:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm doctor <span class="c1"># warns of each VM whose vm.json, or a section of it, devvm can&#39;t read</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>doctor reads each VM&rsquo;s <code>vm.json</code> and each of its sections as every command on a VM reads them, without changing anything. It names each VM it can&rsquo;t read once, with the file and why, even when it can&rsquo;t read the VM&rsquo;s folder, and such a VM doesn&rsquo;t hide doctor&rsquo;s other warnings, such as a line of another VM&rsquo;s policy file that isn&rsquo;t a rule.</p>
|
||
<h2 data-hextra-search-id="devvm-says-a-newer-release-is-out">devvm says a newer release is out<span class="hx:absolute hx:-mt-20" id="devvm-says-a-newer-release-is-out"></span>
|
||
<a href="#devvm-says-a-newer-release-is-out" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When you run devvm in a terminal and a newer release is out, devvm says so in one line before it opens the VM, and it opens the VM as usual. Run <code>devvm upgrade</code> to install the release, or carry on with the devvm you have, because devvm never upgrades on its own. The line comes from devvm&rsquo;s daily check, and <code>devvm doctor</code> shows the newest release that check found and the day it found it. When you&rsquo;d rather not see the line, set <code>release-check = false</code> in <code>config.toml</code>, or <code>DEVVM_NO_RELEASE_CHECK=1</code> in the environment (<a href="https://next.devvm.dev/docs/using/settings/#the-release-check">the release check</a>).</p>
|
||
<p>When devvm never says it, even though a newer release is out, the check may not have run yet, because it runs once a day and the line comes from what it found the time before. It also doesn&rsquo;t run while you&rsquo;re offline, without a terminal, with <code>--no-input</code>, for a devvm built from its source, or for a copy that neither the install script nor Homebrew installed. <code>devvm upgrade --check</code> asks GitHub at once:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm upgrade --check <span class="c1"># ask GitHub for the newest release now, and install nothing</span>
|
||
</span></span><span class="line"><span class="cl">devvm upgrade <span class="c1"># install it, after asking</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="a-newer-devvm-changed-devvms-folders">A newer devvm changed devvm&rsquo;s folders<span class="hx:absolute hx:-mt-20" id="a-newer-devvm-changed-devvms-folders"></span>
|
||
<a href="#a-newer-devvm-changed-devvms-folders" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm&rsquo;s data folder, <code>~/.local/share/devvm</code>, and its settings folder, <code>~/.config/devvm</code>, each record their layout version in a file named <code>version</code>, which says how devvm keeps its files there, and devvm checks both before each command. When either one has a newer version than this devvm&rsquo;s, a newer devvm has changed the folders, so this one refuses to run rather than misread them, and it names the file and both versions. Run the newer devvm, or upgrade this one to it, for example after going back to an older version by mistake. <code>devvm --version</code>, help and completion still run. An older version is never refused, because devvm changes the folders to its own layout before the command runs, and a folder without a <code>version</code> file gets this devvm&rsquo;s (<a href="https://next.devvm.dev/docs/internals/overview/#the-layout-version">the layout version</a>).</p>
|
||
<h2 data-hextra-search-id="devvm-names-set-id-files">devvm names set-id files<span class="hx:absolute hx:-mt-20" id="devvm-names-set-id-files"></span>
|
||
<a href="#devvm-names-set-id-files" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>On a Linux host, root in a VM can set the set-user-id and set-group-id bits on files in the project folder, and those bits reach this machine, so such a file runs as its owner for anyone who runs it. devvm names these files when it makes a VM and once a VM is stopped, by devvm stop or found stopped at a launch, but not at a launch into a running VM, because looking through a big folder takes a while. It names the ones that root owns apart from the rest, because those run as root, and it doesn&rsquo;t look in <code>.git</code> folders.</p>
|
||
<ul>
|
||
<li>For a file that root owns, don&rsquo;t run it, and delete it with <code>sudo rm FILE</code>.</li>
|
||
<li>For any other file, <code>chmod u-s,g-s FILE</code> clears its bits.</li>
|
||
</ul>
|
||
<p>Either way, don&rsquo;t run programs from the project folder outside the VM (<a href="https://next.devvm.dev/docs/safety/attack-vectors/#files-the-vm-writes">files the VM writes</a>).</p>
|
||
<h2 data-hextra-search-id="home-isnt-an-absolute-path">HOME isn&rsquo;t an absolute path<span class="hx:absolute hx:-mt-20" id="home-isnt-an-absolute-path"></span>
|
||
<a href="#home-isnt-an-absolute-path" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm finds its folders from <code>HOME</code>, so it stops when <code>HOME</code> is empty or isn&rsquo;t an absolute path. Set <code>HOME</code> to your home folder, such as <code>/Users/you</code> on macOS or <code>/home/you</code> on Linux, and run devvm again.</p>
|
||
<h2 data-hextra-search-id="a-vm-shows-as-unenforced">A VM shows as unenforced<span class="hx:absolute hx:-mt-20" id="a-vm-shows-as-unenforced"></span>
|
||
<a href="#a-vm-shows-as-unenforced" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>devvm ls</code> and <code>devvm network</code> show a VM&rsquo;s tier as <code>unenforced</code> when the VM is on a confined tier but devvm didn&rsquo;t start it confined. That happens when it was started outside devvm, such as with <code>devvm limactl start</code>, or when it has been running since before <code>devvm network</code> moved it from open to a confined tier, such as with <code>devvm network allowlist</code>. The VM then reaches the network without its proxy.</p>
|
||
<p>On the VM&rsquo;s next launch, devvm offers in a terminal to restart it confined, and if you decline, it warns and goes on. Without a terminal, or with <code>--no-input</code>, devvm stops the VM instead, and the next <code>devvm</code> starts it confined (<a href="https://next.devvm.dev/docs/internals/network/#the-self-check">the self-check</a>). To confine it at once:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm restart <span class="c1"># in the VM&#39;s folder: start it again behind its proxy</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>If you press Ctrl+C while devvm starts a confined VM, devvm stops the VM and its proxy before it exits, so the VM never runs on without the proxy, and the next <code>devvm</code> starts both again confined.</p>
|
||
<h2 data-hextra-search-id="the-proxy-doesnt-start">The proxy doesn&rsquo;t start<span class="hx:absolute hx:-mt-20" id="the-proxy-doesnt-start"></span>
|
||
<a href="#the-proxy-doesnt-start" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A confined VM runs only with its proxy, so when the proxy doesn&rsquo;t start, devvm stops the VM, and the next <code>devvm</code> starts both again. When devvm refuses before it has stopped the running proxy, such as when your company proxy&rsquo;s password isn&rsquo;t saved, the VM and that proxy run on as long as the proxy still enforces the VM&rsquo;s tier. Otherwise devvm stops the VM.</p>
|
||
<ul>
|
||
<li><strong>The proxy didn&rsquo;t start:</strong> read the log devvm names for why. A VM&rsquo;s is <code>proxy.log</code> in its logs folder, where the proxy&rsquo;s two processes, its broker and its child, each write their own lines, and a build&rsquo;s is <code>proxy.log</code> in the build proxy&rsquo;s <code>logs/</code> folder.</li>
|
||
<li><strong>Another program took the proxy&rsquo;s port:</strong> devvm picks another port the next time it starts the VM, so run <code>devvm restart</code>.</li>
|
||
<li><strong>The proxy doesn&rsquo;t stop for new settings:</strong> run <code>devvm stop</code>, then <code>devvm</code> (<a href="https://next.devvm.dev/docs/internals/network/#the-proxy">the proxy</a>).</li>
|
||
<li><strong>An open VM&rsquo;s proxy doesn&rsquo;t answer it:</strong> the VM runs on, and devvm warns you, because its tools that use the proxy fail, so run <code>devvm restart</code>, which starts both again.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="the-proxy-runs-without-a-sandbox">The proxy runs without a sandbox<span class="hx:absolute hx:-mt-20" id="the-proxy-runs-without-a-sandbox"></span>
|
||
<a href="#the-proxy-runs-without-a-sandbox" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>The part of a VM&rsquo;s proxy that reads the VM&rsquo;s network runs in a sandbox, which is macOS&rsquo;s on macOS, and Landlock and a seccomp filter on Linux. If a VM ever took that part over, the sandbox keeps it from your files, your unix sockets, this machine&rsquo;s services on <code>localhost</code> and the rest of this machine. When the sandbox can&rsquo;t start, or the kernel has only part of it, the proxy runs with what there is, so the VM keeps its network, and devvm doctor warns for each running VM:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm doctor <span class="c1"># names each VM whose proxy runs without a sandbox</span>
|
||
</span></span><span class="line"><span class="cl">tail ~/.local/share/devvm/vms/&lt;hash&gt;/logs/proxy.log <span class="c1"># the proxy&#39;s own warning, with why</span>
|
||
</span></span><span class="line"><span class="cl">devvm restart <span class="c1"># in the VM&#39;s folder: start the proxy again, sandboxed if it can be</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<ul>
|
||
<li><strong>sandbox-exec is missing:</strong> macOS&rsquo;s <code>/usr/bin/sandbox-exec</code> runs the sandbox, and Lima&rsquo;s hostagent also needs it, so check that it&rsquo;s there, and run <code>devvm restart</code> once it is.</li>
|
||
<li><strong>sandbox-exec couldn&rsquo;t start it:</strong> <code>proxy.log</code> has <code>sandbox-exec</code>&rsquo;s own error, which says why, such as a profile that this macOS refused. Run <code>devvm restart</code> once you&rsquo;ve fixed what it names, and if it names devvm&rsquo;s profile, report it as a bug (<a href="#reporting-a-bug">reporting a bug</a>), with your macOS version.</li>
|
||
<li><strong>Its sandbox let it open a file it mustn&rsquo;t:</strong> the sandbox started but didn&rsquo;t hold, so the proxy runs as if it had none. Report it as a bug (<a href="#reporting-a-bug">reporting a bug</a>), with your macOS version.</li>
|
||
<li><strong>This kernel has no Landlock, or an older one, or no seccomp filters:</strong> on Linux, the proxy gets what the kernel has. Check that Landlock is turned on with <code>cat /sys/kernel/security/lsm</code>, whose list should name <code>landlock</code>, and turn it on as your distribution&rsquo;s docs describe, or update the kernel. The proxy is fully confined with the seccomp filter and Landlock&rsquo;s ABI 8 or later, or ABI 6 or 7 with its fix for signals between threads. Then run <code>devvm restart</code>.</li>
|
||
<li><strong>An older devvm started it:</strong> a VM that ran as you upgraded devvm keeps the proxy that the older devvm started, one process without a sandbox, until devvm next opens the VM. Run <code>devvm</code> in the VM&rsquo;s folder, which starts its proxy again with the sandbox, while the VM runs on.</li>
|
||
<li><strong>devvm can&rsquo;t tell:</strong> devvm doctor reads how the proxy is confined only from the proxy that runs now, which it knows by when the system says it started. When it can&rsquo;t read that, it says it can&rsquo;t tell whether the proxy runs in its sandbox, and why. Run <code>devvm restart</code> in the VM&rsquo;s folder, and if the warning stays, report it as a bug (<a href="#reporting-a-bug">reporting a bug</a>).</li>
|
||
<li><strong>devvm can&rsquo;t confine it on this system yet:</strong> this devvm, or this machine&rsquo;s architecture, has no sandbox for it, though devvm&rsquo;s releases for macOS and for Linux on Intel and Arm have one, so install a release (<a href="https://next.devvm.dev/docs/getting-started/install/">installing devvm</a>).</li>
|
||
</ul>
|
||
<p><a href="https://next.devvm.dev/docs/internals/network/#the-childs-sandbox">The child&rsquo;s sandbox</a> has what the sandbox allows and how the proxy decides to run without it.</p>
|
||
<h2 data-hextra-search-id="a-request-is-blocked">A request is blocked<span class="hx:absolute hx:-mt-20" id="a-request-is-blocked"></span>
|
||
<a href="#a-request-is-blocked" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>On the allowlist tier, a VM reaches only the hosts on its allowlist, and on the none tier only its agents&rsquo; and secrets&rsquo; hosts. To see what the proxy blocked, run <code>devvm network log --blocked</code> on this machine, or <code>devvm-why</code> in the VM. <code>devvm network log --blocked</code> also shows the <code>devvm network allow</code> command that allows each host, and the rule applies at once, to the next connection (<a href="https://next.devvm.dev/docs/safety/network/#logs">logs</a>).</p>
|
||
<h2 data-hextra-search-id="a-name-that-doesnt-resolve">A name that doesn&rsquo;t resolve<span class="hx:absolute hx:-mt-20" id="a-name-that-doesnt-resolve"></span>
|
||
<a href="#a-name-that-doesnt-resolve" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">curl https://jenkins.corp.example.com/ <span class="c1"># in the VM: the host&#39;s full name, not jenkins</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>The proxy looks each name up on this machine as it&rsquo;s written, without this machine&rsquo;s DNS search domain, so name the host in full in the tool&rsquo;s URL or settings. What the block&rsquo;s reason says (<a href="https://next.devvm.dev/docs/safety/network/#inside-the-vm">inside the VM</a>):</p>
|
||
<ul>
|
||
<li><strong>This machine&rsquo;s DNS has no address for the name:</strong> a rule allows the name, but the proxy couldn&rsquo;t resolve it on this machine. So the block suggests no <code>devvm network allow</code> command, and <code>devvm network log --blocked</code> shows <code>-</code> for it.</li>
|
||
<li><strong>A name without a dot,</strong> such as <code>jenkins</code>, which your other tools may reach as <code>jenkins.corp.example.com</code>, gets a reason that says to use the full name.</li>
|
||
<li><strong>The DNS didn&rsquo;t answer in time, or can&rsquo;t resolve the name:</strong> the block names <code>proxy.log</code> on this machine, which holds the resolver&rsquo;s error.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="a-tool-that-skips-the-proxy-fails">A tool that skips the proxy fails<span class="hx:absolute hx:-mt-20" id="a-tool-that-skips-the-proxy-fails"></span>
|
||
<a href="#a-tool-that-skips-the-proxy-fails" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>On a confined tier, devvm&rsquo;s <a href="https://next.devvm.dev/docs/safety/network/#tools-that-ignore-the-proxy">transparent mode</a> sends a tool that ignores the proxy settings to the proxy by the names it looks up, over HTTPS and HTTP, on ports 443 and 80 and the ports your allow rules name. Such a tool still fails in these cases, and <code>devvm network log</code> shows nothing for it, because the connection never reached the proxy:</p>
|
||
<ul>
|
||
<li><strong>A connection refused on another port,</strong> such as <code>ECONNREFUSED</code> or <code>Connection refused</code> for <code>db.example.com:5432</code>. <code>devvm-why</code> lists the port under the connections the VM refused lately. Give the tool the proxy&rsquo;s address in <code>$HTTPS_PROXY</code> or its own setting, or, for HTTPS or HTTP on that port, allow the host with that port, such as <code>devvm network allow db.example.com:8443</code>, which redirects the port within 10 seconds.</li>
|
||
<li><strong>A protocol that names no host,</strong> such as a database&rsquo;s or SSH, which the proxy refuses and logs as a refused block of <code>transparent.devvm.proxy</code>. SSH in the VM goes through the proxy already, and a database client needs a proxy setting of its own.</li>
|
||
<li><strong>A DNS error,</strong> such as <code>no such host</code>, <code>Temporary failure in name resolution</code>, <code>ENOTFOUND</code> or <code>EAI_AGAIN</code>, which means transparent mode is off for the VM (<code>devvm network transparent</code>), or the VM comes from an image that predates it, which each launch says, and <code>devvm update</code> makes it again from a newer image. The tool gets the error at once.</li>
|
||
</ul>
|
||
<p>Some tools read the proxy variables only when a setting of their own turns them on, or never. Turn on the tool&rsquo;s own proxy setting, so that it uses the environment, or give it the address in <code>$HTTPS_PROXY</code>. Hugo&rsquo;s <code>resources.GetRemote</code>, for example, uses the proxy only when <code>security.http.proxyFromEnvironment</code> is <code>true</code> in the site&rsquo;s config (<a href="https://next.devvm.dev/docs/safety/network/#inside-the-vm">inside the VM</a>).</p>
|
||
<h2 data-hextra-search-id="an-open-vm-resolves-no-names-after-a-downgrade">An open VM resolves no names after a downgrade<span class="hx:absolute hx:-mt-20" id="an-open-vm-resolves-no-names-after-a-downgrade"></span>
|
||
<a href="#an-open-vm-resolves-no-names-after-a-downgrade" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A confined VM&rsquo;s programs ask the VM&rsquo;s own name server directly, through an <code>/etc/resolv.conf</code> that devvm writes, and devvm puts systemd-resolved&rsquo;s back when the VM runs open (<a href="https://next.devvm.dev/docs/internals/network/#the-vms-resolver">the VM&rsquo;s resolver</a>). An older devvm doesn&rsquo;t know that file, so after a downgrade, a VM that was confined and now runs open can keep it and resolve no names. When the VM&rsquo;s <code>/etc/resolv.conf</code> starts with <code># devvm:</code>, launch it with a current devvm, or put systemd-resolved&rsquo;s file back yourself:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">head -1 /etc/resolv.conf <span class="c1"># in the VM: &#34;# devvm: ...&#34; means devvm&#39;s file</span>
|
||
</span></span><span class="line"><span class="cl">sudo ln -sfn /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf <span class="o">&amp;&amp;</span> sudo systemctl restart systemd-resolved</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="a-servers-port-is-taken-in-a-confined-vm">A server&rsquo;s port is taken in a confined VM<span class="hx:absolute hx:-mt-20" id="a-servers-port-is-taken-in-a-confined-vm"></span>
|
||
<a href="#a-servers-port-is-taken-in-a-confined-vm" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>In a confined VM, transparent mode&rsquo;s programs listen on the stand-in address <code>198.18.0.1</code>, on port 53 and on ports 61080 and 61443 and 61100 to 61131, so a server of yours that binds one of those ports on every address, such as <code>0.0.0.0:61443</code>, fails with <code>EADDRINUSE</code>. Ports 80 and 443 stay free for your own servers. A DNS server of yours on <code>127.0.0.1:53</code> binds, but gets no lookups, from the VM or through a forward of port 53, because transparent mode sends them to its own names. Move the server to another port, or turn transparent mode off for the VM with <code>devvm network transparent off</code>, which applies at its next launch (<a href="https://next.devvm.dev/docs/safety/network/#tools-that-ignore-the-proxy">tools that ignore the proxy</a>).</p>
|
||
<h2 data-hextra-search-id="behind-a-company-proxy">Behind a company proxy<span class="hx:absolute hx:-mt-20" id="behind-a-company-proxy"></span>
|
||
<a href="#behind-a-company-proxy" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When this machine reaches the internet only through a company proxy and nothing in a VM or a build gets through, check where devvm finds the proxy. devvm reads <code>HTTPS_PROXY</code>, <code>HTTP_PROXY</code> and <code>NO_PROXY</code> from the shell you run it in, as <code>env | grep -i _proxy</code> shows, and when that shell sets neither <code>HTTPS_PROXY</code> nor <code>HTTP_PROXY</code>, it reads the <code>[proxy]</code> table of <code>~/.config/devvm/config.toml</code> instead (<a href="https://next.devvm.dev/docs/safety/network/#behind-a-company-proxy">behind a company proxy</a>). A shell without the settings, such as an editor&rsquo;s terminal that didn&rsquo;t load your profile, starts the VM&rsquo;s proxy without a company proxy, unless <code>config.toml</code> names one. So set the proxy in <code>config.toml</code>, and it works from every shell:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="p">[</span><span class="nx">proxy</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">https</span> <span class="p">=</span> <span class="s2">&#34;http://[email protected]:8080&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">http</span> <span class="p">=</span> <span class="s2">&#34;http://[email protected]:8080&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">no-proxy</span> <span class="p">=</span> <span class="s2">&#34;localhost,.example.com&#34;</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>config.toml</code> never holds the company proxy&rsquo;s password. Put only the user in the URL, as above, and save the password with <code>devvm secret set proxy</code>, which asks for it. Then run devvm again in the folder, which starts the VM&rsquo;s proxy again with the new settings:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm secret <span class="nb">set</span> proxy <span class="c1"># asks for the company proxy&#39;s password</span>
|
||
</span></span><span class="line"><span class="cl">devvm <span class="c1"># start the VM&#39;s proxy again with the new settings</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Other messages and cases:</p>
|
||
<ul>
|
||
<li>When a VM&rsquo;s proxy went through a company proxy the last time it started and devvm finds none this time, devvm warns you, names <code>config.toml</code> and starts the proxy without one, so the VM&rsquo;s requests go directly. Set the proxy in that shell or in <code>config.toml</code>, then run <code>devvm restart</code> in the folder.</li>
|
||
<li>When devvm says that <code>HTTPS_PROXY</code>, <code>HTTP_PROXY</code> or one of <code>config.toml</code>&rsquo;s <code>[proxy]</code> keys names an <code>https://</code> or <code>socks5://</code> proxy, ask your IT team for the proxy&rsquo;s <code>http://</code> address, and set that. A company proxy that inspects TLS also needs its CA, as the next section describes.</li>
|
||
<li>Builds behind a company proxy go through a proxy of devvm&rsquo;s, which allows any host. It sends a name that this machine can&rsquo;t look up on to the company proxy, which resolves it (<a href="https://next.devvm.dev/docs/safety/network/#open-vms-and-builds">open VMs and builds</a>).</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="tls-errors-behind-a-company-proxy">TLS errors behind a company proxy<span class="hx:absolute hx:-mt-20" id="tls-errors-behind-a-company-proxy"></span>
|
||
<a href="#tls-errors-behind-a-company-proxy" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When apt, <code>npm install</code>, <code>pip install</code>, <code>git clone</code> over HTTPS or an image&rsquo;s build fails with an error such as <code>certificate verify failed</code>, <code>self-signed certificate in certificate chain</code> or <code>unable to get local issuer certificate</code>, the network you&rsquo;re on may inspect TLS. Ask your IT team for the CA&rsquo;s certificate, or export it from this machine&rsquo;s store, such as Keychain Access on macOS. Put it in <code>~/.config/devvm/ca</code> and open the VM again (<a href="https://next.devvm.dev/docs/using/settings/#a-companys-ca">a company&rsquo;s CA</a>):</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">mkdir -p ~/.config/devvm/ca <span class="o">&amp;&amp;</span> cp company-root.pem ~/.config/devvm/ca/
|
||
</span></span><span class="line"><span class="cl">devvm <span class="c1"># open the VM again, which now trusts the CA</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>When resolving the shared tools&rsquo; versions fails because this machine doesn&rsquo;t trust a server&rsquo;s certificate, mise&rsquo;s lines in the run log end with <code>invalid peer certificate: UnknownIssuer</code>. On Linux, put the CA in <code>~/.config/devvm/ca</code>, or add it to this machine&rsquo;s own store, as <code>update-ca-certificates</code> does on Debian and Ubuntu, and run devvm again:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="c1"># on a Debian or Ubuntu host, not in the VM (Fedora: /etc/pki/ca-trust/source/anchors/ and sudo update-ca-trust)</span>
|
||
</span></span><span class="line"><span class="cl">sudo cp company-root.pem /usr/local/share/ca-certificates/company-root.crt <span class="o">&amp;&amp;</span> sudo update-ca-certificates</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>A bundle that <code>SSL_CERT_FILE</code> names in devvm&rsquo;s environment works too, because that mise reads it in place of the system&rsquo;s. On macOS, open the CA&rsquo;s certificate in Keychain Access and set it to be trusted, because the part of that mise that checks where each tool&rsquo;s release was built trusts only what macOS trusts.</p>
|
||
<p><code>devvm doctor</code> says so when <code>HTTPS_PROXY</code> or <code>config.toml</code>&rsquo;s <code>proxy.https</code> is set and the folder has no CA certificates. Many proxies don&rsquo;t inspect TLS, so that line isn&rsquo;t a problem in itself. When devvm refuses a file in the folder, it names the file, and you take out anything that isn&rsquo;t a CA certificate, such as a private key or a server&rsquo;s certificate.</p>
|
||
<h2 data-hextra-search-id="a-listed-port-isnt-forwarded">A listed port isn&rsquo;t forwarded<span class="hx:absolute hx:-mt-20" id="a-listed-port-isnt-forwarded"></span>
|
||
<a href="#a-listed-port-isnt-forwarded" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When a program on this machine already has a port that the VM lists, devvm warns that the VM doesn&rsquo;t forward it, and the VM runs on without it. Stop that program, then run <code>devvm restart</code>, or change the VM&rsquo;s ports with <code>devvm ports</code>, and devvm forwards the port once it&rsquo;s free (<a href="https://next.devvm.dev/docs/using/ports-size/#ports">ports</a>).</p>
|
||
<p>devvm warns about two other reasons too, each in its own words, and <code>devvm ports</code> repeats the warning while the VM runs:</p>
|
||
<ul>
|
||
<li><strong>The VM already forwards 256 ports</strong>, the most it forwards at once. Stop the servers you don&rsquo;t need in the VM, or list fewer ports with <code>devvm ports</code>, and devvm forwards the port within about 10 seconds of the VM forwarding fewer.</li>
|
||
<li><strong>This machine doesn&rsquo;t let devvm use the port.</strong> On Linux, only root can listen on a port below 1024, so a listed port such as 80 isn&rsquo;t forwarded. Have the server in the VM listen on a port from 1024 up and list that port instead.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="too-many-vms-at-once">Too many VMs at once<span class="hx:absolute hx:-mt-20" id="too-many-vms-at-once"></span>
|
||
<a href="#too-many-vms-at-once" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>At most 17 VMs run at once, because each VM&rsquo;s ssh is on one of the 17 ports that every browser refuses, so no page in your browser can reach it. A start past that fails and names the VMs that run on those ports, so stop one of them first:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm stop <span class="c1"># in a running VM&#39;s folder</span>
|
||
</span></span><span class="line"><span class="cl">devvm ls <span class="c1"># which VMs run</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>A stopped VM can give up its port to a VM that starts, and it gets another at its own next start. When the message says the ports are taken on this machine without naming your VMs, one of these has them:</p>
|
||
<ul>
|
||
<li><strong>VMs that are starting or building.</strong></li>
|
||
<li><strong>A running VM that lists them to forward,</strong> which you change with <code>devvm ports</code> in its folder.</li>
|
||
<li><strong>Another program,</strong> such as another user&rsquo;s on this machine, whom you&rsquo;d ask to end it.</li>
|
||
</ul>
|
||
<p>A VM that an older devvm started keeps its old ssh port until you stop it and start it again, and devvm warns of it at each launch until then (<a href="https://next.devvm.dev/docs/internals/lima/#what-devvm-sets-on-a-vm">the ssh port</a>).</p>
|
||
<h2 data-hextra-search-id="a-vm-wont-boot">A VM won&rsquo;t boot<span class="hx:absolute hx:-mt-20" id="a-vm-wont-boot"></span>
|
||
<a href="#a-vm-wont-boot" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A Lima VM that doesn&rsquo;t answer over ssh within a minute of starting is stopped. Read the end of its console log before you start it again, because every start overwrites the log:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">tail -n <span class="m">100</span> ~/.local/share/devvm/lima/&lt;vm&gt;/serialv.log</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>The log is <code>serialv.log</code>, or another <code>serial*.log</code>, in the VM&rsquo;s folder in devvm&rsquo;s Lima home, which is <code>~/.local/share/devvm/lima/&lt;vm&gt;/</code> unless you set <code>DEVVM_LIMA_HOME</code> (<a href="https://next.devvm.dev/docs/backends/lima/#limits">Lima&rsquo;s limits</a>). A log that passed 10 MiB while the VM ran has its earlier lines in the same name with <code>.1</code> added, and the log then starts with a long run of empty bytes, so <code>tail</code> reads it better than an editor does.</p>
|
||
<h2 data-hextra-search-id="a-vm-whose-creation-didnt-finish">A VM whose creation didn&rsquo;t finish<span class="hx:absolute hx:-mt-20" id="a-vm-whose-creation-didnt-finish"></span>
|
||
<a href="#a-vm-whose-creation-didnt-finish" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When devvm stops after it made a VM but before the VM was ready, such as when you press Ctrl+C at the wrong moment, devvm never starts that VM. The VM never opened a shell, so nothing of yours is in it. In a terminal, devvm asks whether to delete the VM and make it again, with no as the default. Without a terminal, with <code>--no-input</code> or when you answer no, devvm keeps the VM and says so, and you run <code>devvm rm</code> to delete it, then <code>devvm</code> to make it again:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm rm <span class="o">&amp;&amp;</span> devvm <span class="c1"># delete the unfinished VM, after asking, then make it again</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>While another devvm is still making the folder&rsquo;s VM, such as one waiting for your answers in another terminal, <code>devvm</code> and <code>devvm rm</code> in that folder refuse at once and say so. Finish or stop the other devvm, then run the command again: once the VM is made, <code>devvm</code> opens it.</p>
|
||
<h2 data-hextra-search-id="the-folder-is-gone">The folder is gone<span class="hx:absolute hx:-mt-20" id="the-folder-is-gone"></span>
|
||
<a href="#the-folder-is-gone" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When you delete or move a project folder, its VM stays and keeps its disk, and <code>devvm ls</code> writes <code>(gone)</code> after its folder. To keep the VM, move the folder back to its path. To delete it, run <code>devvm rm VM</code> with the name that <code>devvm ls</code> lists, in any folder. devvm asks first, and when the VM is stopped and has an agent, it needs <code>--no-export</code>, because starting the VM to export the history would make the folder again (<a href="https://next.devvm.dev/docs/using/vms/#a-vm-whose-folder-is-gone">a VM whose folder is gone</a>).</p>
|
||
<h2 data-hextra-search-id="the-folder-is-on-a-disk-that-isnt-connected">The folder is on a disk that isn&rsquo;t connected<span class="hx:absolute hx:-mt-20" id="the-folder-is-on-a-disk-that-isnt-connected"></span>
|
||
<a href="#the-folder-is-on-a-disk-that-isnt-connected" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When a project folder is on an external disk, a USB stick or a network share that isn&rsquo;t connected, <code>devvm ls</code> writes <code>(not connected)</code> after its folder, and <code>devvm space</code> names the VM. Connect the disk and the VM works as before. If you mean to delete the VM, run <code>devvm rm VM</code> in a terminal and answer yes, because devvm refuses without one, even with <code>--force</code>, as the disk may still hold the project&rsquo;s work (<a href="https://next.devvm.dev/docs/using/vms/#a-folder-on-a-disk-that-isnt-connected">a folder on a disk that isn&rsquo;t connected</a>).</p>
|
||
<h2 data-hextra-search-id="the-folder-was-made-again">The folder was made again<span class="hx:absolute hx:-mt-20" id="the-folder-was-made-again"></span>
|
||
<a href="#the-folder-was-made-again" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When you delete a project folder and make a new one at the same path, such as by cloning another repo there, devvm refuses the old folder&rsquo;s VM. Run <code>devvm rm</code> to delete the old VM, or <code>devvm adopt</code> to give it to the new folder (<a href="https://next.devvm.dev/docs/using/vms/#a-folder-made-again">a folder made again</a>).</p>
|
||
<h2 data-hextra-search-id="an-outdated-vm-or-newer-shared-tools">An outdated VM, or newer shared tools<span class="hx:absolute hx:-mt-20" id="an-outdated-vm-or-newer-shared-tools"></span>
|
||
<a href="#an-outdated-vm-or-newer-shared-tools" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm warns on each launch when an image the VM was made from has changed, and when there are newer shared tools than the VM&rsquo;s, and it leaves the VM as it is. Both warnings name <code>devvm update</code>, which moves the VM to the newest shared tools first, without asking. Then, only when the VM&rsquo;s image has changed, it makes the VM again from the new image, keeping its home folder, the project folder and its settings, after asking (<a href="https://next.devvm.dev/docs/using/images/#outdated-vms">outdated VMs</a>). <code>devvm tools update</code> moves the VM to the newest shared tools alone (<a href="https://next.devvm.dev/docs/using/toolchains/#adding-and-removing-tools">adding and removing tools</a>).</p>
|
||
<h2 data-hextra-search-id="a-download-doesnt-check-out">A download doesn&rsquo;t check out<span class="hx:absolute hx:-mt-20" id="a-download-doesnt-check-out"></span>
|
||
<a href="#a-download-doesnt-check-out" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm checks Ubuntu&rsquo;s cloud image and its own mise against checksums before it uses them, and it refuses a download that doesn&rsquo;t match. A cloud image that doesn&rsquo;t match is downloaded again from nothing once before devvm refuses it, as a download that went on from an earlier try may have joined two versions of the server&rsquo;s file. Ubuntu&rsquo;s checksums must also carry a valid signature from Ubuntu&rsquo;s cloud image key, which devvm checks itself, with nothing to install. When devvm refuses one, try again later, and if it keeps failing, the server or the network between may be serving something else. In the same way, when <code>devvm rebuild base</code> finds Ubuntu&rsquo;s list of releases ending before the release that base starts from, it says so and keeps that release (<a href="https://next.devvm.dev/docs/internals/images/#ubuntus-cloud-image">Ubuntu&rsquo;s cloud image</a>).</p>
|
||
<h2 data-hextra-search-id="a-new-tool-release-isnt-there-yet">A new tool release isn&rsquo;t there yet<span class="hx:absolute hx:-mt-20" id="a-new-tool-release-isnt-there-yet"></span>
|
||
<a href="#a-new-tool-release-isnt-there-yet" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A shared tool&rsquo;s newest release is sometimes not published for every platform yet, such as for a few days after a Node release. devvm then uses the newest older version that is, and says so, and the next daily check tries the newest again. When a release has no download for a VM&rsquo;s platform yet, try again the next day (<a href="https://next.devvm.dev/docs/internals/images/#versions">versions</a>).</p>
|
||
<h2 data-hextra-search-id="a-shared-tool-doesnt-mount">A shared tool doesn&rsquo;t mount<span class="hx:absolute hx:-mt-20" id="a-shared-tool-doesnt-mount"></span>
|
||
<a href="#a-shared-tool-doesnt-mount" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When a VM can&rsquo;t mount one of its shared tools, devvm stops the launch with an error that names the VM and the tools, and the VM keeps running. That happens when the tool&rsquo;s image is missing from the folder that devvm keeps the shared tools in, such as after you deleted it by hand, or when the VM can&rsquo;t mount the image. devvm doesn&rsquo;t let the VM download the tool in its place, because that copy would be the VM&rsquo;s own, a download you didn&rsquo;t ask for, and one that the VM&rsquo;s tier may block.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm tools update <span class="c1"># in the project folder: build the missing tools, then open the shell</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>When the VM has the newest versions, <code>devvm tools update</code> builds those, and otherwise it builds the newest versions and moves the VM to them. If the launch still stops, the run log says why the VM couldn&rsquo;t mount the image (<a href="#a-command-fails">a command fails</a>). A tool that doesn&rsquo;t mount never keeps the VM from booting. The VM mounts the tools it can and boots as usual, and only devvm&rsquo;s launch stops (<a href="https://next.devvm.dev/docs/internals/images/#the-share">the share</a>).</p>
|
||
<h2 data-hextra-search-id="reporting-a-bug">Reporting a bug<span class="hx:absolute hx:-mt-20" id="reporting-a-bug"></span>
|
||
<a href="#reporting-a-bug" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When none of this fixes it, open an issue on <a href="https://github.com/devvmhq/devvm/issues/new/choose" target="_blank" rel="noopener">devvm&rsquo;s issue tracker</a> and choose its form for bugs, features, toolchains, built-in layers or docs. The bug report asks for what <code>devvm --version</code>, <code>devvm doctor</code> and <code>limactl --version</code> print, your OS and its version, the command you ran with what it printed, and the run log (<a href="#a-command-fails">a command fails</a>). devvm hides a VM&rsquo;s proxy key and passwords in the log, but it can still hold folder names, host names and a command&rsquo;s output, so read it before you paste it. A security problem goes to <a href="https://github.com/devvmhq/devvm/security/advisories/new" target="_blank" rel="noopener">private vulnerability reporting</a> instead, never to a public issue.</p></description></item><item><title>Known limits</title><link>https://next.devvm.dev/docs/using/limits/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/using/limits/</guid><description>
|
||
<p>These are the things devvm can&rsquo;t do, everywhere, on Linux hosts and on Intel Macs.</p>
|
||
<h2 data-hextra-search-id="everywhere">Everywhere<span class="hx:absolute hx:-mt-20" id="everywhere"></span>
|
||
<a href="#everywhere" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><ul>
|
||
<li><strong>devvm runs on macOS and Linux only,</strong> not on Windows (<a href="https://next.devvm.dev/docs/getting-started/install/#requirements">requirements</a>).</li>
|
||
<li><strong>Shared tools are read-only,</strong> so a tool can&rsquo;t update itself or add components, for example with <code>rustup component add</code> (<a href="https://next.devvm.dev/docs/using/images/#shared-tools">details</a>).</li>
|
||
<li><strong>A layer goes in and comes out by making the VM again.</strong> A layer&rsquo;s script changes the VM&rsquo;s disk, so <code>devvm layer add</code> gives a VM more layers by making it again, and everything on its disk but its home folder is lost (<a href="https://next.devvm.dev/docs/using/images/#adding-layers-to-a-vm">details</a>). <code>devvm layer rm</code> takes layers out in the same way (<a href="https://next.devvm.dev/docs/using/images/#taking-layers-out-of-a-vm">details</a>). Shared tools go in with <code>devvm tools add</code> and come out with <code>devvm tools rm</code>, and the VM&rsquo;s disk stays as it is (<a href="https://next.devvm.dev/docs/using/toolchains/#adding-and-removing-tools">details</a>).</li>
|
||
<li><strong><code>--from</code> takes only Debian-, Ubuntu- and Alpine-based images,</strong> and Alpine, Debian 12 (<code>node:24</code>) and Ubuntu before 26.04 on arm64 build with unpinned packages (<a href="https://next.devvm.dev/docs/using/from/#supported-images">details</a>).</li>
|
||
<li><strong>Agent folders</strong> that you make or delete on this machine reach a running VM only after a restart, which devvm offers (<a href="https://next.devvm.dev/docs/using/coding-agents/#mounts">details</a>).</li>
|
||
<li><strong>Ports</strong> are forwarded over TCP only, and forwarding every port means every port from 1024 up. You can tunnel UDP over a forwarded TCP port with socat (<a href="https://next.devvm.dev/docs/using/ports-size/#ports">details</a>).</li>
|
||
<li><strong>Links between VMs</strong> carry TCP over IPv4 alone, and a container in a VM reaches them only with <code>--network host</code> (<a href="https://next.devvm.dev/docs/using/links/#ports">details</a>).</li>
|
||
<li><strong>Tools that ignore the proxy settings</strong> reach a confined VM&rsquo;s proxy only over HTTPS and HTTP to a host by name, on ports 443 and 80 and up to 32 more that your allow rules name. Other ports, protocols that name no host in their first bytes, such as a database&rsquo;s, addresses in URLs, HTTP/3 alone and IPv6 alone need the tool&rsquo;s own proxy settings, and a client that doesn&rsquo;t trust the VM&rsquo;s CA sees a certificate error for a blocked HTTPS host (<a href="https://next.devvm.dev/docs/safety/network/#tools-that-ignore-the-proxy">details</a>).</li>
|
||
<li><strong>Changing a running VM&rsquo;s ports</strong> closes the connections that are open through its forwards (<a href="https://next.devvm.dev/docs/using/ports-size/#ports">details</a>).</li>
|
||
<li><strong>With Lima,</strong> project paths can&rsquo;t contain commas, folder names in VM names are cut short, and disks grow but never shrink (<a href="https://next.devvm.dev/docs/backends/lima/#limits">details</a>).</li>
|
||
<li><strong>File watchers in a Lima VM</strong> don&rsquo;t see the edits you make on this machine, only those made in the VM, so set a dev server that should reload on your edits to poll the project folder (<a href="https://next.devvm.dev/docs/backends/lima/#file-watchers">details</a>).</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="linux-hosts">Linux hosts<span class="hx:absolute hx:-mt-20" id="linux-hosts"></span>
|
||
<a href="#linux-hosts" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><ul>
|
||
<li><code>.git</code> protection is read-only in the VM&rsquo;s view, not a lock on the host&rsquo;s files, so after a git command on this machine replaces <code>.git/config</code> while the VM runs, the VM can change or replace the new file until devvm locks it again. devvm names each such file when the VM stops (<a href="https://next.devvm.dev/docs/safety/git-protection/#when-git-on-this-machine-replaces-a-locked-file">details</a>). A VM whose <code>.git/config</code> or hook has another name doesn&rsquo;t start, and the VM can&rsquo;t rename a file between the working tree and <code>.git</code> (<a href="https://next.devvm.dev/docs/safety/git-protection/#linux-hosts">details</a>).</li>
|
||
<li>Where the kernel doesn&rsquo;t let devvm use a user namespace, such as on Ubuntu 23.10 and newer, there&rsquo;s no <code>.git</code> protection. devvm warns about it at each launch, and it names the <code>.git</code> hooks and config that changed, but only after the fact, so use <code>--clone</code> there (<a href="https://next.devvm.dev/docs/safety/git-protection/#when-linux-cant-lock">details</a>).</li>
|
||
<li>VMs mount the project folder with 9p instead of virtiofs, so file watchers in a VM also miss the VM&rsquo;s own changes in the folder&rsquo;s subfolders, and need polling there (<a href="https://next.devvm.dev/docs/backends/lima/#file-watchers">details</a>).</li>
|
||
<li>New VMs cache the project folder with the <code>none</code> mode, because Linux&rsquo;s 9p client loses data with Lima&rsquo;s <code>mmap</code>. A VM made before devvm chose <code>none</code> keeps <code>mmap</code>, with a warning at each launch, until you run <code>devvm mount-cache none</code> (<a href="https://next.devvm.dev/docs/backends/lima/#the-project-folders-cache">details</a>).</li>
|
||
<li>A program can&rsquo;t map a file in the project folder for shared writing, and gets <code>Invalid argument</code>, such as LMDB, which Parcel&rsquo;s <code>.parcel-cache</code> and Gatsby&rsquo;s cache use, numpy&rsquo;s <code>memmap</code> in <code>r+</code> or <code>w+</code> mode, Java&rsquo;s read-write mappings and the mold linker. Keep their files on the VM&rsquo;s own disk, or use a <code>--clone</code> VM (<a href="https://next.devvm.dev/docs/backends/lima/#programs-that-map-files-for-writing">details</a>).</li>
|
||
<li>SQLite&rsquo;s WAL mode fails in the project folder unless the connection sets <code>PRAGMA locking_mode=EXCLUSIVE</code> first, while SQLite&rsquo;s default journal works. Use a <code>--clone</code> VM for a project that needs WAL mode, as its repo is on the VM&rsquo;s own disk, or keep the database outside the folder (<a href="https://next.devvm.dev/docs/backends/lima/#sqlite-and-the-cache">details</a>).</li>
|
||
<li>Set-id bits that root in a VM sets on files in the project folder reach the host, and devvm names such files when it makes a VM and once a VM is stopped (<a href="https://next.devvm.dev/docs/using/troubleshooting/#devvm-names-set-id-files">what to do</a>).</li>
|
||
<li>devvm keeps your secrets in files under <code>~/.local/share/devvm/secrets/</code>, which only you can read, instead of the Keychain (<a href="https://next.devvm.dev/docs/using/settings/#devvms-state">details</a>).</li>
|
||
<li>devvm has no Time Machine to keep VMs&rsquo; CAs out of, so keep <code>~/.local/share/devvm/vms</code> out of your backups (<a href="https://next.devvm.dev/docs/internals/security/#secrets-stay-on-the-host">details</a>).</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="intel-macs">Intel Macs<span class="hx:absolute hx:-mt-20" id="intel-macs"></span>
|
||
<a href="#intel-macs" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>devvm has a release for Intel Macs, which the install script and Homebrew install, but nobody has tested it on one yet. The tested systems are Apple silicon Macs and Linux on arm64 and x86_64, so on an Intel Mac, VMs, <code>--from</code> and the network tiers&rsquo; confinement may fail in ways that devvm&rsquo;s tests haven&rsquo;t caught.</p></description></item></channel></rss> |