Last active
December 16, 2025 04:00
-
-
Save gaibz/ce0e8280f02f07ccdffc80f6cddca3e2 to your computer and use it in GitHub Desktop.
Setup Fish Terminal (Ubuntu & MacOS)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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