Skip to article

Guides

Autocompletion

Install POSH, then run the commands for your shell once to complete commands and flags with Tab.

Bash

Requires the bash-completion package. On macOS, install it with brew install bash-completion@2.

mkdir -p ~/.local/share/posh
posh completion bash > ~/.local/share/posh/completion.bash
echo 'source ~/.local/share/posh/completion.bash' >> ~/.bashrc

Zsh

mkdir -p ~/.zsh/completions
posh completion zsh > ~/.zsh/completions/_posh
echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
echo 'autoload -Uz compinit && compinit' >> ~/.zshrc

Fish

Fish loads the script automatically:

mkdir -p ~/.config/fish/completions
posh completion fish > ~/.config/fish/completions/posh.fish

Try it

Open a new terminal, type posh , and press Tab.

New commands and flags appear automatically after upgrading POSH. If completion stops working after an upgrade, run the posh completion line for your shell again.