> For the complete documentation index, see [llms.txt](https://ploegert.gitbook.io/til/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ploegert.gitbook.io/til/programmy/go/build-for-a-specific-os-and-architecture.md).

# Build For A Specific OS And Architecture

Go programs can run anywhere, but you've got to create builds specific to each operating system and architecture. This can be done when building by specifying the `GOOS` and `GOARCH` environment variables.

For example, if you'd like to build a 32-bit Linux distribution:

```bash
GOOS=linux GOARCH=386 go build -o linux_386_build
```

The `GOOS` value specifies the operating system as Linux and the `GOARCH` value of `386` specifies a 32-bit architecture.

The plethora of `GOOS` and `GOARCH` options can be found [here](https://golang.org/doc/install/source#environment).
