#!/usr/bin/env zsh # ── macos.zsh : Darwin-only PATH + compat wiring ───────────────────────────── # Sourced early in .zshrc's module loop. Every line is gated on Darwin, so this # file is completely inert on Linux/Omarchy — it can stay in the shared config # list without a second thought. # # What it does on a Mac: # 1. Puts Homebrew on PATH (Apple Silicon /opt/homebrew, Intel /usr/local). # 2. Prepends the dotfiles compat shim dir, so the ~15 cheat cards and tools # that call wl-copy / wl-paste / xdg-open / notify-send keep working — # install-macos writes those shims (→ pbcopy/pbpaste/open/osascript) into # ~/.local/share/dotfiles-compat/bin. # 3. Makes sure ~/.local/bin and ~/bin (the portable tool layer, incl. # crossfetch for the terminal-open splash) are on PATH. [[ "$(uname -s)" == Darwin ]] || return 0 # ── 1. Homebrew ────────────────────────────────────────────────────────────── # `brew shellenv` sets PATH/MANPATH/INFOPATH and HOMEBREW_* correctly for the # prefix it lives in; prefer it over hand-rolling the paths. if [[ -x /opt/homebrew/bin/brew ]]; then # Apple Silicon eval "$(/opt/homebrew/bin/brew shellenv)" elif [[ -x /usr/local/bin/brew ]]; then # Intel eval "$(/usr/local/bin/brew shellenv)" fi # GNU coreutils/findutils/gnu-sed, if installed via brew, expose g-prefixed # binaries by default. The tools here assume GNU flags in a few spots; put the # gnubin dirs ahead of the BSD ones when they exist. Harmless when absent. for _gnu in coreutils findutils gnu-sed gnu-tar grep gawk; do _gnudir="${HOMEBREW_PREFIX:-/opt/homebrew}/opt/$_gnu/libexec/gnubin" [[ -d "$_gnudir" ]] && path=("$_gnudir" $path) done unset _gnu _gnudir # ── 2. compat shim (wl-copy→pbcopy, xdg-open→open, notify-send→osascript) ───── _compat="$HOME/.local/share/dotfiles-compat/bin" [[ -d "$_compat" ]] && path=("$_compat" $path) unset _compat # ── 3. portable tool layer ─────────────────────────────────────────────────── # .zprofile normally seeds these, but re-assert here so an interactive-only # shell (login files skipped) still finds crossfetch et al. for _d in "$HOME/.local/bin" "$HOME/bin"; do [[ -d "$_d" ]] && path=("$_d" $path) done unset _d # Dedupe while preserving first-seen order (zsh keeps PATH and $path in sync). typeset -U path PATH