DEV Community

Konstantin Läufer
Konstantin Läufer

Posted on

My fish shell AI setup on macOS

I installed the fish shell and fisher plugin manager through the malt package manager client (you can also use Homebrew, and I'm showing the paths resulting from a Homebrew install). I also just started using the Starship prompt.

The instructions also work on Linux, but you'd need to install a current version of fish through the corresponding PPA:

sudo add-apt-repository ppa:fish-shell/release-4
Enter fullscreen mode Exit fullscreen mode

Once installed, you can choose fish as your default shell:

$ chsh -s /opt/homebrew/bin/fish # set as systemwide shell
Enter fullscreen mode Exit fullscreen mode

Then I installed these plugins using fisher. You can read the documentation in their Github repos:

❯ fisher list
jorgebucaran/fisher
realiserad/fish-ai
franciscolourenco/done
jethrokuan/z
patrickf1/fzf.fish
reitzig/sdkman-for-fish@v2.1.0
Enter fullscreen mode Exit fullscreen mode

You need to install the related tools, such as fzf, sdkman, etc. separately.

Here are my settings for tide to look like omz and sdkman to work as intended.

cat ~/.config/fish/config.fish
if status is-interactive
    # Commands to run in interactive sessions can go here

    starship init fish | source

    eval "$(mt shellenv)"

    fish_add_path $HOME/.local/bin
    fish_add_path $HOME/.cargo/bin

    set -Ux SDKMAN_DIR $HOME/.sdkman

end
Enter fullscreen mode Exit fullscreen mode

Groq (not to be confused with Grok) can provide a free API key for fish AI integration, where you can type a shell comment and a hotkey, and fish expands it to the actual shell command.

 cat ~/.config/fish-ai.ini
[fish-ai]
configuration = groq

[groq]
provider = groq
model = openai/gpt-oss-20b
api_key = ...
Enter fullscreen mode Exit fullscreen mode

I had to add these completions to get git tag TAB to work.

cat ~/.config/fish/completions/git.fish
complete -c git -n '__fish_seen_subcommand_from tag' -f -a '(command git tag 2>/dev/null)'
Enter fullscreen mode Exit fullscreen mode

Top comments (0)