Created
November 14, 2025 05:43
-
-
Save tomschall/1db87ae2f8d5a62ae0293f5327a0e662 to your computer and use it in GitHub Desktop.
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
| ```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