Skip to content

Commit

Permalink
feat: Add script to install Homebrew, XCode Command-Line Tools, and C…
Browse files Browse the repository at this point in the history
…hezmoi
  • Loading branch information
brndnblck committed Jul 6, 2023
1 parent e6d3e7f commit ad5c367
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,32 @@
set -e
cd "$(dirname "$0")/.."

# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install XCode Command-Line Tools
echo "Checking Command Line Tools for Xcode"
# Only run if the tools are not installed yet
# To check that try to print the SDK path
xcode-select -p &> /dev/null
if [ $? -ne 0 ]; then
echo "Command Line Tools for Xcode not found. Installing from softwareupdate…"
# This temporary file prompts the 'softwareupdate' utility to list the Command Line Tools
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress;
PROD=$(softwareupdate -l | grep "\*.*Command Line" | tail -n 1 | sed 's/^[^C]* //')
softwareupdate -i "$PROD" --verbose;
else
echo "Command Line Tools for Xcode have been installed."
fi

# Install Homebrew Deps
if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
brew bundle check >/dev/null 2>&1 || {
echo "==> Installing Homebrew dependencies…"
brew bundle
}
fi

# Install Chezmoi
brew install chezmoi
chezmoi init --apply brndnblck

0 comments on commit ad5c367

Please sign in to comment.