How to setup chruby for fish shell instead of regular bash/zsh

I just ran into the same issue. Here’s how to solve it:

You have to change things around a bit for Fish. First, you can’t use chruby from homebrew, because it uses .sh scripts which don’t play nice inside config.fish. This is what you need to do:

brew install chruby-fish ruby-install

echo "source "(brew --prefix)"/Cellar/chruby-fish/0.8.2/share/chruby/chruby.fish" >> ~/.config/fish/config.fish
echo "source "(brew --prefix)"/Cellar/chruby-fish/0.8.2/share/chruby/auto.fish" >> ~/.config/fish/config.fish
echo "chruby ruby-3.1.2" >> ~/.config/fish/config.fish

source ~/.config/fish/config.fish

NOTE: The version of Ruby is newer than that’s in the Jekyll docs. The one that homebrew installed for me was 3.1.2. You can find out for sure by running chruby.