# Install Spyctl CLI

Source code: <https://github.com/spyderbat/spyctl-cli>

The initial step in utilizing any software package is ensuring its correct installation, so let's get started by walking through the installation process for Spyctl.

### Prerequisites

* Python 3.8 or newer

### Installation Command

{% tabs %}
{% tab title="Debian/Ubuntu" %}
To install spyctl globally requires the pipx utility.

```bash
sudo apt install pipx
```

Install spyctl using pipx.

```bash
pipx install spyctl
```

Verify the installation.

```bash
spyctl --version
```

Alternatively, you can use a virtual environment to install spyctl.

```bash
python -m venv spyctl
source spyctl/bin/activate
pip install spyctl
```

Verify the installation.

```bash
spyctl --version
```

{% hint style="info" %}
Note: depending on your system, you may need to use `python3` or instead of `python`. If you go the virtual environment route, you may need to install virtualenv first.

```
apt install python3.X-venv
```

Where `python3.X` is the version of python you have installed.
{% endhint %}
{% endtab %}

{% tab title="Windows/MacOS/Other Linux" %}
To install Spyctl, simply run this command in your terminal of choice:

```bash
pip install spyctl
```

To verify the installation:

<pre class="language-bash" data-full-width="false"><code class="lang-bash"><strong>spyctl --version
</strong></code></pre>

{% endtab %}
{% endtabs %}

### Enabling Shell Completion

To enable shell completion, follow these steps:

{% tabs %}
{% tab title="Bash" %}
{% hint style="info" %}
The default version of Bash for Mac OS X users does not support programmable shell completion. Guides like [this](https://kizu514.com/blog/install-upgraded-gnu-bash-on-a-macbook-pro/) will help you install a newer version of Bash.
{% endhint %}

Create the Spyctl directory if you haven’t already.

```bash
mkdir -p ~/.spyctl
```

Generate the shell completion script.

```bash
_SPYCTL_COMPLETE=bash_source spyctl > ~/.spyctl/spyctl-complete.bash
```

Add the following line to the end of `~/.bashrc`.

```
. ~/.spyctl/spyctl-complete.bash
```

{% endtab %}

{% tab title="Fish" %}
Generate and save the shell completion script.

```python
_SPYCTL_COMPLETE=fish_source spyctl > ~/.config/fish/completions/spyctl-complete.fish
```

{% endtab %}

{% tab title="Zsh" %}
Create the Spyctl directory if you haven’t already.

```sh
mkdir -p ~/.spyctl
```

Generate the shell completion script.

```bash
_SPYCTL_COMPLETE=zsh_source spyctl > ~/.spyctl/spyctl-complete.zsh
```

Add the following line to the end of `~/.zshrc`.

```python
. ~/.spyctl/spyctl-complete.zsh
```

{% endtab %}
{% endtabs %}

After modifying the shell config, you need to start a new shell in order for the changes to be loaded.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.spyderbat.com/installation/spyctl.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
