If you don't have git, you can download the source code as a file archive [from GitHub](https://github.com/caddyserver/caddy). Each [release](https://github.com/caddyserver/caddy/releases) also has source snapshots.
Due to <ahref="https://github.com/golang/go/issues/29228">a bug in Go</a>, these basic steps do not embed version information. If you want the version (<code>caddy version</code>), you need to compile Caddy as a dependency rather than as the main module. Instructions for this are in Caddy's <ahref="https://github.com/caddyserver/caddy/blob/master/cmd/caddy/main.go">main.go</a> file. Or, you can use <ahref="#xcaddy"><code>xcaddy</code></a> which automates this.
Cross-platform compilation with `xcaddy` works the same as with the `go` command (see below).
## Cross-platform
Go programs are easy to compile for other platforms. Just set the `GOOS`, `GOARCH`, and/or `GOARM` environment variables that are different. ([See the go documentation for details.](https://golang.org/doc/install/source#environment))
For example, to compile Caddy for Windows when you're not on Windows:
<pre><codeclass="cmd bash">GOOS=windows go build</code></pre>
Or similarly for Linux ARMv6 when you're not on Linux or on ARMv6:
<pre><codeclass="cmd bash">GOOS=linux GOARCH=arm GOARM=6 go build</code></pre>
The same works for `xcaddy`. To cross-compile for macOS: