Skip to content

Instantly share code, notes, and snippets.

@DaneWeber
Created March 15, 2021 17:03
Show Gist options
  • Save DaneWeber/c8b4220e656e2bbfb21e9f038331ad0e to your computer and use it in GitHub Desktop.
Save DaneWeber/c8b4220e656e2bbfb21e9f038331ad0e to your computer and use it in GitHub Desktop.
Gentle idempotent Mac dev setup
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core"
cask "docker"
cask "iterm2"
cask "visual-studio-code"
#!/usr/bin/env zsh
brew_major_version=$(brew --version | head -c 10)
if [ "$brew_major_version" = 'Homebrew 3' ]; then
echo 'Homebrew already installed'
echo 'Updating Homebrew'
brew update
else
echo 'Installing Homebrew'
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
echo 'Install and update packages in the Brewfile`
brew bundle
#!/usr/bin/env zsh
export OMZ=~/.oh-my-zsh
if [ -d $OMZ ]; then
echo 'Oh My Zsh is already installed.'
else
echo 'Installing Oh My Zsh:'
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fi
export PLUGINS="alias-finder brew common-aliases git"
if grep -qF "plugins=(git)" ~/.zshrc; then
sed -i '' "s/plugins=(git)/plugins=($PLUGINS)/g" ~/.zshrc
echo 'Oh My Zsh plugins set to baseline.'
source ~/.zshrc
else
echo 'Oh My Zsh plugins left alone because they are not default. Current set of plugins:'
grep "^plugins=" ~/.zshrc
fi
if [ ! -d $ZSH_CUSTOM/themes/powerlevel10k ]; then
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
fi
echo 'Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc if you want this awesome theme.'
@DaneWeber
Copy link
Author

Run brew bundle dump to create a Brewfile based on your currently installed packages. You can overwrite an existing Brewfile, such as a version-controlled one, with brew bundle dump --force.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment