Skip to content

Instantly share code, notes, and snippets.

@vitorcalvi
Last active April 22, 2025 07:30
Show Gist options
  • Save vitorcalvi/7be5b480dd57e8228b713c0f882eb298 to your computer and use it in GitHub Desktop.
Save vitorcalvi/7be5b480dd57e8228b713c0f882eb298 to your computer and use it in GitHub Desktop.
Comprehensive Bash script to automate macOS developer setup: installs essential apps with Homebrew, sets up Zsh with Oh My Zsh and Powerlevel10k, downloads FlutterFlow, updates /etc/hosts, sets up a conda environment, and installs Anaconda.
#!/usr/bin/env bash
set -euo pipefail
# --- Configurable lists ---
CASKS=(
macs-fan-control whatsapp discord lm-studio android-file-transfer balenaetcher
flutter visual-studio-code sublime-text android-studio rectangle iterm2
android-platform-tools tradingview jan xcode
)
FORMULAS=(
wget vercel-cli scrcpy git fastlane node yarn
)
HOSTS=(
"192.168.31.10 cyber"
"192.168.31.184 neurosity"
)
# --- Functions ---
install_homebrew() {
if ! command -v brew &>/dev/null; then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
}
brew_install() {
for formula in "${FORMULAS[@]}"; do
brew list "$formula" &>/dev/null || brew install "$formula"
done
for cask in "${CASKS[@]}"; do
brew list --cask "$cask" &>/dev/null || brew install --cask "$cask"
done
}
setup_ohmyzsh() {
if ! [ -d "$HOME/.oh-my-zsh" ]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
fi
if ! grep -q 'powerlevel10k' ~/.zshrc 2>/dev/null; then
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
sed -i '' 's/^ZSH_THEME=.*/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc
fi
}
backup_and_update_hosts() {
sudo cp -n /etc/hosts /etc/hosts.backup || true
for entry in "${HOSTS[@]}"; do
grep -qF "$entry" /etc/hosts || echo "$entry" | sudo tee -a /etc/hosts
done
}
# --- Main ---
install_homebrew
brew update
brew_install
setup_ohmyzsh
backup_and_update_hosts
echo "Setup complete. Please restart your terminal."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment