# `ok`

[The `ok` tool](https://github.com/oslokommune/ok){:target="_blank"} helps you get started with writing Terraform code and manage different environments.

## Installation

`brew` is the recommended way to install `ok`. Homebrew is supported on [MacOS](https://brew.sh/){:target="_blank"}, [Linux and WSL](https://docs.brew.sh/Homebrew-on-Linux){:target="_blank"}.

=== "With `brew`"

    Run the following command:

    ```bash
    brew tap oslokommune/ok https://github.com/oslokommune/ok
    brew install ok
    ```

=== "Manual install"

    Run the following commands:

    ```
    BIN_DIR="$HOME/bin"
    PLATFORM=$(uname | tr '[:upper:]' '[:lower:]')
    ARCH=$(uname -m)

    case $ARCH in
         x86_64)
             ARCH="amd64"
            ;;
        aarch64|arm64)
            ARCH="arm64"
            ;;
         *)
            echo "Unsupported architecture: $ARCH"
            exit 1
            ;;
    esac

    gh release download \
        --repo "oslokommune/ok" \
        --pattern "ok_*_${PLATFORM}_${ARCH}.tar.gz" \
        --output - | tar -xzOf - ok > "$BIN_DIR/ok"

    chmod +x "$BIN_DIR/ok"
    "$BIN_DIR/ok" version

    ```

---

Verify that the `ok` command is available by running the following command:

```bash
ok
```

## Updating

To update the `ok` tool, run the following command:

```bash
brew update
brew upgrade ok
```

To check which version you have, you can run `ok version`.

## Delete `ok`

To delete the `ok` tool, run the following command

```bash
cd $HOME/bin
rm ok
rm port-forward
```

If `ok` isn't in that location, check

```bash
$HOME/git/golden-path-iac/bin
```
