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

# Set up command completion

> Set up command completion so that the Algolia CLI automatically completes your commands.

Command completion makes working with the CLI easier.
Instead of typing the full command,
enter the first letters and press the `Tab` key.
With completion, this automatically enters the complete command or you get a list of suggestions.

<AccordionGroup>
  <Accordion title="Homebrew">
    If you installed the Algolia CLI with Homebrew, and you've set up [shell completion](https://docs.brew.sh/Shell-Completion),
    command completion for the Algolia CLI should already work.
  </Accordion>

  <Accordion title="Bash">
    Command completion depends on the `bash-completion` package.
    If it isn't installed already, you can install it with your favorite package manager.
    For example, with Homebrew, run:
    `brew install bash-completion@2`.

    To enable completion **in the current session**, run:

    ```sh Command line icon=square-terminal theme={"system"}
    source <(algolia completion bash)
    ```

    To enable command completion **for every new session**, run:

    <CodeGroup>
      ```sh Linux theme={"system"}
      algolia completion bash > /etc/bash_completion.d/algolia
      ```

      ```sh macOS theme={"system"}
      algolia completion bash > /usr/local/etc/bash_completion.d/algolia
      ```
    </CodeGroup>

    Start a new Bash session to explore the completions.
  </Accordion>

  <Accordion title="Zsh">
    If you didn't set up shell completion in Zsh already,
    add the following to your `.zshrc` file,
    or run the commands in the current session:

    ```sh Command line icon=square-terminal theme={"system"}
    echo "autoload -U compinit; compinit" >> ~/.zshrc
    ```

    To enable completion **in the current session**, run:

    ```sh Command line icon=square-terminal theme={"system"}
    eval "$(algolia completion zsh)"
    ```

    To enable command completion **for every new session**, run:

    <CodeGroup>
      ```sh Linux theme={"system"}
      algolia completion zsh > "${fpath[1]}/_algolia"
      ```

      ```sh macOS theme={"system"}
      algolia completion zsh > /usr/local/share/zsh/site-functions/_algolia
      ```
    </CodeGroup>

    Start a new Zsh session to explore the completions.

    <Note>
      You might want to put the completion script into a directory in your profile,
      for example `~/.local/share/zsh/site-functions`.
      Then, add `fpath=(~/.local/share/zsh/site-functions $fpath)` to your `.zshrc` file.
    </Note>
  </Accordion>

  <Accordion title="Fish">
    To enable command completion **in the current session**, run:

    ```fish icon="square-terminal" theme={"system"}
    algolia completion fish | source
    ```

    To enable command completion **for every new session**:

    ```fish icon="square-terminal" theme={"system"}
    algolia completion fish > ~/.config/fish/completions/algolia.fish
    ```

    Start a new Fish session to explore the completions.
  </Accordion>

  <Accordion title="PowerShell">
    To enable command completion **in the current session**, run:

    ```powershell icon="square-terminal" theme={"system"}
    algolia completion powershell | Out-String | Invoke-Expression
    ```

    To enable command completion for PowerShell **for every new session**,
    add the output of the previous command to your PowerShell profile.
  </Accordion>
</AccordionGroup>
