Skip to content

Instantly share code, notes, and snippets.

@gaibz
Last active December 16, 2025 04:00
Show Gist options
  • Select an option

  • Save gaibz/ce0e8280f02f07ccdffc80f6cddca3e2 to your computer and use it in GitHub Desktop.

Select an option

Save gaibz/ce0e8280f02f07ccdffc80f6cddca3e2 to your computer and use it in GitHub Desktop.
Setup Fish Terminal (Ubuntu & MacOS)
#!/usr/bin/env bash
set -e
echo "🐟 Fish Shell Setup (Cross OS)"
OS="$(uname -s)"
install_fish_mac() {
echo "🍎 Detected macOS"
if ! command -v brew >/dev/null 2>&1; then
echo "❌ Homebrew not found. Install brew first."
exit 1
fi
brew install fish || true
brew install fzf || true
}
install_fish_ubuntu() {
echo "🐧 Detected Linux (Ubuntu/Debian)"
if ! command -v apt >/dev/null 2>&1; then
echo "❌ apt not found. Unsupported distro."
exit 1
fi
sudo apt update || true
sudo apt install -y fish curl fzf || true
}
# ===== OS detection =====
case "$OS" in
Darwin)
install_fish_mac
;;
Linux)
install_fish_ubuntu
;;
*)
echo "❌ Unsupported OS: $OS"
exit 1
;;
esac
FISH_PATH="$(command -v fish)"
echo "➑️ Fish binary: $FISH_PATH"
# ===== Register fish shell =====
#if [ -w /etc/shells ] && ! grep -q "$FISH_PATH" /etc/shells; then
# echo "πŸ” Registering fish to /etc/shells"
# echo "$FISH_PATH" | sudo tee -a /etc/shells >/dev/null
#fi
# ===== Change default shell (optional, safe) =====
#if [ "$SHELL" != "$FISH_PATH" ]; then
# echo "πŸ” Setting fish as default shell"
# chsh -s "$FISH_PATH" || echo "⚠️ Cannot change default shell (non-interactive or restricted)"
#fi
# ===== Install Fisher (OFFICIAL LINK from you) =====
echo "πŸ“¦ Installing Fisher"
fish -c 'curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher'
# ===== Install plugins =====
echo "✨ Installing fish plugins"
fish -c '
fisher install \
IlanCosman/tide@v6 \
PatrickF1/fzf.fish \
jorgebucaran/autopair.fish \
jethrokuan/z
'
# ===== Fish config =====
#echo "βš™οΈ Writing fish config"
#mkdir -p ~/.config/fish
cat << "EOF" > ~/.config/fish/config.fish
# =========================
# Basic environment
# =========================
#set -gx LANG en_US.UTF-8
#set -gx LC_ALL en_US.UTF-8
#set -gx EDITOR nano
# =========================
# PATH handling
# =========================
#if test -d /opt/homebrew/bin
# set -gx PATH /opt/homebrew/bin \$PATH
#end
#if test -d /usr/local/bin
# set -gx PATH /usr/local/bin \$PATH
#end
# =========================
# Aliases
# =========================
#alias ll="ls -lah"
#alias gs="git status"
#alias ga="git add ."
#alias gc="git commit -m"
#alias gp="git push"
# =========================
# tmux awareness
# =========================
if test -n "\$TMUX"
set -gx TERM tmux-256color
end
EOF
echo "βœ… Fish setup finished"
echo ""
echo "➑️ Next steps:"
echo " exec fish"
echo " tide configure"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment