# Installation

## Using Pre-Compiled Binaries

Stackable provides pre-compiled binaries of stackablectl, which should work on most environments such as Windows, macOS, and Linux distributions like Ubuntu and Arch. You can also build the binary from source. More information about the manual building steps can be found in [this](https://docs.stackable.tech/management/stable/stackablectl/installation/index.md) section.

**Tab: Linux**

Download the appropriate binary file for your architecture from the [latest release](https://github.com/stackabletech/stackablectl/releases/tag/stackablectl-1.5.3), then rename the file to `stackablectl`. You can also use the following command:

**x86\_64** (amd64):

```console
$ curl -L -o stackablectl https://github.com/stackabletech/stackablectl/releases/download/stackablectl-1.5.3/stackablectl-x86_64-unknown-linux-gnu
```

**aarch64** (arm64):

```console
$ curl -L -o stackablectl https://github.com/stackabletech/stackablectl/releases/download/stackablectl-1.5.3/stackablectl-aarch64-unknown-linux-gnu
```

Install the binary into a directory in the `$PATH`, and make it executable:

> **Note:** If you have a directory in your `$HOME` for user binaries, you can remove `sudo`, and change the directory to that.

```console
$ sudo install -m 755 -t /usr/local/bin stackablectl
```

Test that it works:

```console
$ stackablectl --version
```

**Tab: macOS**

Download the appropriate binary file for your architecture from the [latest release](https://github.com/stackabletech/stackablectl/releases/tag/stackablectl-1.5.3), then rename the file to `stackablectl`. You can also use the following command:

**x86\_64** (amd64):

```console
$ curl -L -o stackablectl https://github.com/stackabletech/stackablectl/releases/download/stackablectl-1.5.3/stackablectl-x86_64-apple-darwin
```

**aarch64** (arm64):

```console
$ curl -L -o stackablectl https://github.com/stackabletech/stackablectl/releases/download/stackablectl-1.5.3/stackablectl-aarch64-apple-darwin
```

Install the binary into a directory in the `$PATH`, and make it executable:

> **Note:** If you have a directory in your `$HOME` for user binaries, you can remove `sudo`, and change the directory to that.

```console
$ sudo install -m 755 stackablectl /usr/local/bin
```

Test that it works:

```console
$ stackablectl --version
```

> **Tip:** If macOS denies the execution of `stackablectl` go to Settings → Security & Privacy → General. Here you will see a pop up asking if you want to allow access for `stackablectl`. You must allow access.

**Tab: Windows**

Currently, there are no pre-built binaries available for Windows. At the time of writing, compiling `stackablectl` on Windows was impossible due to upstream bugs. While it may have become possible since then, it’ll still provide significant challenges due to high technical complexity related to FFI, cgo and Windows-specific issues.

For Windows users, WSL will probably be the best option for using `stackablectl`.

If you do want to attempt compiling for Windows, please refer to [this](https://docs.stackable.tech/management/stable/stackablectl/installation/index.md) section - and if you are successful, by all means, give us a shout and we will reward you handsomely!

## Building from Source

To build `stackablectl` from source you need to have the following tools installed:

-   **The Rust toolchain:** Needed for compiling the source code of `stackablectl` itself. Use [rustup](https://rustup.rs/) to easily install all required tools.

-   **The Go toolchain:** Needed for compiling a wrapper around the Go library `go-helm-client`.


Continue by cloning the repository located at [https://github.com/stackabletech/stackablectl](https://github.com/stackabletech/stackablectl). Then, compile the binary using the following command:

```console
$ cargo build -p stackablectl --release
```

After a successful build, the binary will be placed in `target/release/stackablectl`. Copy it to your systems path to access it from anywhere if you like:

```console
$ cp target/release/stackablectl /usr/local/bin
```

Test that it works:

```console
$ stackablectl --version
```

## Shell Completions

We provide completions for `stackablectl` for major shells out there. Currently, ZSH, Fish, Bash, Nushell, and Elvish are supported. The repository provides pre-generated completion files. These can be downloaded and copied to the appropriate location on your system.

**Tab: ZSH**

Download the completions file and place it in `/usr/local/share/zsh/site-functions/` to load it automatically.

```console
$ curl -LO https://raw.githubusercontent.com/stackabletech/stackablectl/main/extra/completions/_stackablectl
$ mv _stackablectl /usr/local/share/zsh/site-functions/
```

**Tab: Fish**

Download the completions file and place it in any of the supported location listed [here](https://fishshell.com/docs/current/completions.html#where-to-put-completions).

```console
$ curl -LO https://raw.githubusercontent.com/stackabletech/stackablectl/main/extra/completions/stackablectl.fish
```

**Tab: Bash**

Download the completions file and place it in `/etc/bash_completion.d/` to load it automatically.

```console
$ curl -LO https://raw.githubusercontent.com/stackabletech/stackablectl/main/extra/completions/stackablectl.bash
$ mv stackablectl.bash /etc/bash_completion.d/
```

**Tab: Nushell**

Download the completions file at a location where it is loaded for all Nushell sessions, see [here](https://www.nushell.sh/book/custom_commands.html#persisting).

```console
$ curl -LO https://raw.githubusercontent.com/stackabletech/stackablectl/main/extra/completions/stackablectl.nu
```

**Tab: Elvish**

```console
$ curl -LO https://raw.githubusercontent.com/stackabletech/stackablectl/main/extra/completions/stackablectl.elv
```

You can generate the completions on your own by using the `stackablectl completions` command. See [here](https://docs.stackable.tech/management/stable/stackablectl/commands/completions/index.md) for more information.
