> ## Documentation Index
> Fetch the complete documentation index at: https://errand.nuvrel.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# os

> Return the name of the current operating system.

`os()` returns the name of the operating system on which Errand is running. Common values are `"linux"`, `"darwin"`, and `"windows"`.

## Signature

```
os() string
```

## Example

Build platform-specific binaries and package them with the correct archive format:

```hcl theme={null}
variable "version" {
  type = string
}

computed "current_os" {
  description = "Current operating system"
  expression  = os()
}

computed "archive_ext" {
  description = "Platform-appropriate archive extension"
  expression  = computed.current_os == "windows" ? ".zip" : ".tar.gz"
}

task "package" {
  description = "Build and archive the binary for the current platform"
  commands = [
    "go build -o bin/app${computed.current_os == "windows" ? ".exe" : ""} ./cmd/app",
    "tar -czf app-${var.version}-${computed.current_os}.tar.gz bin/",
  ]
}
```

## Notes

* Common values: `linux`, `darwin` (macOS), `windows`, `freebsd`.
* To detect the CPU architecture, use [`arch`](/functions/runtime/arch).
