Skip to content

Instantly share code, notes, and snippets.

@aloisdeniel
Last active July 5, 2026 15:03
Show Gist options
  • Select an option

  • Save aloisdeniel/e1142c0dc107e817a4882d07261bc04b to your computer and use it in GitHub Desktop.

Select an option

Save aloisdeniel/e1142c0dc107e817a4882d07261bc04b to your computer and use it in GitHub Desktop.
Terminal Essentials (macOS)
#!/usr/bin/env bash
# Terminal Essentials
# bash -c "$(curl -fsSL https://gist.github.com/aloisdeniel/e1142c0dc107e817a4882d07261bc04b/raw/macos-essentials.sh)"
# For a more complete configuration check out my dotfiles: https://github.com/aloisdeniel/dotfiles
GIST_RAW="https://gist.githubusercontent.com/aloisdeniel/e1142c0dc107e817a4882d07261bc04b/raw/"
# Helper function for config files
write_config() {
local path="$HOME/.config/$1"
mkdir -p "$(dirname "$path")"
cat > "$path"
}
# Homebrew
# -------------------------------------
# https://brew.sh/
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
brew upgrade
# Make the brew executable available in the shell
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc
# Use the XDG config dir (~/.config) so lazygit (and nvim, herdr, etc.)
# load their configs from there instead of ~/Library/Application Support
echo 'export XDG_CONFIG_HOME="$HOME/.config"' >> ~/.zshrc
# Reload shell config
source ~/.zshrc
# Ghostty
# -------------------------------------
# https://ghostty.org
brew install --cask ghostty
write_config "ghostty/config" << 'EOF'
theme = TokyoNight
font-size = 12
macos-titlebar-style = transparent
EOF
# Claude Code
# -------------------------------------
# https://claude.com/product/claude-code
brew install --cask claude-code # | codex | opencode
# Git
# -------------------------------------
# https://git-scm.com
brew install git
# Neovim
# -------------------------------------
# https://neovim.io
brew install neovim
# https://www.lazyvim.org
git clone https://github.com/LazyVim/starter ~/.config/nvim
# https://junegunn.github.io/fzf
brew install fzf
# https://github.com/burntsushi/ripgrep
brew install ripgrep
# Lazygit
# -------------------------------------
# https://lazygit.dev
brew install lazygit
# https://www.hunk.dev/
brew install modem-dev/tap/hunk
write_config "hunk/config.toml" << 'EOF'
theme = "catppuccin-mocha"
EOF
write_config "lazygit/config.yml" << 'EOF'
git:
pagers:
pager: hunk pager
EOF
# Github
# -------------------------------------
# https://cli.github.com
brew install gh
# https://www.gh-dash.dev
gh extension install dlvhdr/gh-dash
# Herdr
# -------------------------------------
# https://herdr.dev
brew install herdr
# Desktop shortcuts
# -------------------------------------
DESKTOP1="118,106,38" # Desktop 1 -> CTRL+SHIFT+J
DESKTOP2="119,107,40" # Desktop 2 -> CTRL+SHIFT+K
DESKTOP3="120,108,37" # Desktop 3 -> CTRL+SHIFT+L
/bin/bash -c "$(curl -fsSL "$GIST_RAW/set-macos-shortcuts.sh")" _ "$DESKTOP1" "$DESKTOP2" "$DESKTOP3"
#!/usr/bin/env sh
set -eu
# Modifier bitmask applied to every shortcut.
# Default: Control (262144) + Shift (131072) = 393216.
# Override by exporting MODS first, e.g. MODS=1703936 sh set-macos-shortcuts.sh ...
# Shift=131072 Control=262144 Option=524288 Command=1048576 (sum the ones you want)
MODS=${MODS:-393216}
usage() {
echo "Usage: sh $0 ID,ASCII,KEYCODE [ID,ASCII,KEYCODE ...]" >&2
echo "Example: sh $0 118,106,38 119,107,40 120,108,37" >&2
echo " (118/119/120 = Switch to Desktop 1/2/3; j/k/l)" >&2
exit 1
}
[ "$#" -ge 1 ] || usage
for spec in "$@"; do
# Split "ID,ASCII,KEYCODE" into fields (heredoc keeps this POSIX-portable)
IFS=',' read -r id ascii keycode rest <<EOF
$spec
EOF
# Validate: exactly three fields, all numeric
if [ -z "${id:-}" ] || [ -z "${ascii:-}" ] || [ -z "${keycode:-}" ] || [ -n "${rest:-}" ]; then
echo "Error: bad spec '$spec' (expected ID,ASCII,KEYCODE)" >&2
usage
fi
case "$id$ascii$keycode" in
*[!0-9]*) echo "Error: non-numeric value in '$spec'" >&2; usage ;;
esac
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add "$id" "
<dict>
<key>enabled</key><true/>
<key>value</key>
<dict>
<key>type</key><string>standard</string>
<key>parameters</key>
<array>
<integer>$ascii</integer>
<integer>$keycode</integer>
<integer>$MODS</integer>
</array>
</dict>
</dict>
"
echo "Set hotkey ID $id -> ascii=$ascii keycode=$keycode mods=$MODS"
done
# Reload the shortcut daemon so changes apply without a full logout
/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
echo "Done. If the shortcuts don't take effect, log out and back in."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment