install.sh: install Homebrew, add bash, and seed the colour files
Three things a machine set up from this repo alone hit on its first run:
Homebrew was a dead end -- install.sh printed the command and exited, leaving
the one prerequisite everything else needs to be run by hand. It installs it
now, NONINTERACTIVE so it does not wait on a RETURN; the sudo password is still
asked for, which is why this script is run by hand.
bash was missing from the Brewfile, so bin/open and secrets/ ran under the
3.2 macOS ships and failed on `${v,,}`; config/bashrc also looks for the
bash-completion 2.x that wants 4.2.
Ghostty refused to start -- "error opening config-file ... error.FileNotFound"
-- because config-file pointed at the colour file bin/theme writes, which does
not exist until theme has run. The include is optional now (`?`), and this
script seeds the colour files when a machine has none, leaving a machine that
already has a theme alone.
Igor Soarez igor@soarez.org
Mon, 21 Sep 2026 14:37:35 +0300
3 files changed,
38 insertions(+),
3 deletions(-)
M
Brewfile
→
Brewfile
@@ -5,6 +5,9 @@ # server software from whatever provisions that machine. install.sh applies this
# with `brew bundle`, which only adds. # Something breaks without these. +brew "bash" # bin/open and secrets/ use bash 4 syntax (${v,,}); + # macOS ships 3.2, and config/bashrc looks for the + # bash-completion 2.x that needs 4.2 brew "tmux" # both terminals start every window in tmux brew "neovim" # the editor; vi, vim and git all call nvim brew "age" # szecret
M
config/ghostty/config
→
config/ghostty/config
@@ -30,8 +30,11 @@ # theme = Monokai Pro Spectrum
# theme = Monokai Soda # theme = Builtin Light -# Import color scheme (managed by theme script) -config-file = ~/.local/share/ghostty/color +# Import color scheme (managed by theme script). The leading `?` makes it +# optional: bin/theme writes that file, so until it has run on this machine the +# file does not exist, and a plain config-file makes Ghostty refuse to start +# with "error opening config-file ... error.FileNotFound". +config-file = ?~/.local/share/ghostty/color # Shader # custom-shader = ~/.config/ghostty/shader.glsl
M
install.sh
→
install.sh
@@ -28,8 +28,26 @@ break
fi done fi + # Install Homebrew rather than print the command and stop: on a machine whose + # whole setup is this repo there is nothing else to run it, and everything + # below depends on it. NONINTERACTIVE so it does not wait on a RETURN it will + # never see; it still asks for the sudo password, which is why this script is + # run by hand and not on a timer. if ! command -v brew >/dev/null 2>&1; then - >&2 echo "ERROR: Homebrew is not installed. Install it first, then re-run this:" + echo "Homebrew is not installed; installing it now" + NONINTERACTIVE=1 /bin/bash -c \ + "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + for b in /opt/homebrew/bin/brew /usr/local/bin/brew; do + if [[ -x "${b}" ]]; then + eval "$("${b}" shellenv)" + break + fi + done + fi + if ! command -v brew >/dev/null 2>&1; then + >&2 echo "ERROR: Homebrew still not on PATH after installing it. Install it" + >&2 echo "by hand, then re-run this script:" + # shellcheck disable=SC2016 # printed for a human to paste, not expanded >&2 echo ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"' exit 1 fi@@ -61,6 +79,17 @@ # lazy-lock.json, not in the repo) has them. sync would also update every
# plugin to its latest version and rewrite that lock file. if command -v nvim >/dev/null 2>&1; then nvim --headless "+Lazy! install" +qa || true +fi + +# 4. The colours the terminals, tmux, nvim and bat read. bin/theme writes those +# files under $XDG_DATA_HOME; until it has run once they are absent, which +# every config tolerates -- nothing is themed, that is all. Seeded here only +# when this machine has none, with whatever mode and colourscheme `theme` +# reports (its own defaults on a fresh machine), so re-running this script +# never disturbs a machine whose theme is already set. +theme_bin="${dotfiles_dir}/bin/theme" +if [[ ! -e "${XDG_DATA_HOME:-${HOME}/.local/share}/tmux/color.conf" && -x "${theme_bin}" ]]; then + "${theme_bin}" --set "$("${theme_bin}" --mode)" "$("${theme_bin}" --colors)" || true fi if [[ "$(uname)" == "Darwin" ]]; then