Skip to content

Instantly share code, notes, and snippets.

@tomschall
Created November 14, 2025 05:43
Show Gist options
  • Select an option

  • Save tomschall/1db87ae2f8d5a62ae0293f5327a0e662 to your computer and use it in GitHub Desktop.

Select an option

Save tomschall/1db87ae2f8d5a62ae0293f5327a0e662 to your computer and use it in GitHub Desktop.
```bash
#!/usr/bin/env bash
set -e
echo "๐Ÿš€ Setting up Rust-based CLI tools on macOS..."
# --- Helper functions --------------------------------------------------------
append_if_missing() {
local FILE="$1"
local LINE="$2"
touch "$FILE"
if ! grep -Fq "$LINE" "$FILE"; then
echo "$LINE" >> "$FILE"
echo " โž• Added to $FILE: $LINE"
else
echo " โœ” Already in $FILE: $LINE"
fi
}
# --- Check Homebrew ----------------------------------------------------------
if ! command -v brew >/dev/null 2>&1; then
echo "โŒ Homebrew is not installed."
echo "๐Ÿ‘‰ Install with: /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""
exit 1
fi
echo "โœ… Homebrew found."
# --- Install tools -----------------------------------------------------------
TOOLS=(
ripgrep
fd
eza
bat
zoxide
nushell
alacritty
zellij
starship
dust
procs
hyperfine
bottom
)
echo "๐Ÿ“ฆ Installing CLI tools via Homebrew..."
brew install "${TOOLS[@]}"
echo "โœ… Tools installed."
# --- Zsh configuration -------------------------------------------------------
ZSHRC="${HOME}/.zshrc"
mkdir -p "${HOME}/.config"
echo "๐Ÿ“ Updating ${ZSHRC} ..."
# Aliases
append_if_missing "$ZSHRC" 'alias ls="eza --git --icons --group-directories-first"'
append_if_missing "$ZSHRC" 'alias ll="eza -lah --git --icons --group-directories-first"'
append_if_missing "$ZSHRC" 'alias la="eza -la --git --icons --group-directories-first"'
append_if_missing "$ZSHRC" 'alias cat="bat"'
append_if_missing "$ZSHRC" 'alias f="fd"'
append_if_missing "$ZSHRC" 'alias rg="rg --hidden --glob \x27!.git\x27"'
# zoxide init
append_if_missing "$ZSHRC" 'eval "$(zoxide init zsh)"'
# starship init
append_if_missing "$ZSHRC" 'eval "$(starship init zsh)"'
echo "โœ… Zsh aliases & init blocks configured."
# --- starship basic config ---------------------------------------------------
STARSHIP_CONFIG_DIR="${HOME}/.config"
STARSHIP_CONFIG_FILE="${STARSHIP_CONFIG_DIR}/starship.toml"
if [ ! -f "$STARSHIP_CONFIG_FILE" ]; then
echo "๐Ÿ›  Creating basic starship config at ${STARSHIP_CONFIG_FILE} ..."
cat > "$STARSHIP_CONFIG_FILE" << 'EOF'
add_newline = true
[character]
success_symbol = "[โžœ](bold)"
error_symbol = "[โœ—](bold)"
[directory]
truncation_length = 3
[git_status]
conflicted = "โš”๏ธ "
ahead = "โ‡ก"
behind = "โ‡ฃ"
staged = "+ "
modified = "~ "
untracked = "? "
EOF
echo "โœ… starship config created."
else
echo "โ„น๏ธ starship config already exists at ${STARSHIP_CONFIG_FILE}, leaving it untouched."
fi
echo ""
echo "๐ŸŽ‰ Done!"
echo "๐Ÿ‘‰ Bitte ein neues Terminal รถffnen oder ausfรผhren:"
echo " source \"$ZSHRC\""
echo ""
echo "Viel Spass mit deinem neuen Rust-CLI-Setup, Tom ๐Ÿฆ€๐Ÿ”ฅ"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment