cmc/dotfiles

Using GNU Stow to manage my dotfiles.

clone: git clone https://gitbay.org/cmc/dotfiles.git

main: macos/brew.sh · raw

 1#!/usr/bin/env bash
 2
 3# Get the directory where this script lives
 4MACOS_DIR=$(dirname "$(realpath "$0")")
 5
 6echo "🍺 Syncing Homebrew with Brewfile..."
 7
 8if ! command -v brew &> /dev/null; then
 9    echo "Installing Homebrew first..."
10    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
11    eval "$(/opt/homebrew/bin/brew shellenv)"
12fi
13
14# Use bundle to install everything in the Brewfile
15# --cleanup would remove anything NOT in the Brewfile (use with caution!)
16brew bundle --file="$MACOS_DIR/Brewfile"
17
18# Restart services to ensure they pick up any stowed config changes
19echo "♻️  Restarting services..."
20brew services restart koekeishiya/formulae/yabai
21brew services restart koekeishiya/formulae/skhd
22
23echo "✅ macOS environment synced."