Skip to content

Instantly share code, notes, and snippets.

@tquiroga
Last active April 3, 2025 15:24
Show Gist options
  • Save tquiroga/1acb047218ad9feccca4d84f61166173 to your computer and use it in GitHub Desktop.
Save tquiroga/1acb047218ad9feccca4d84f61166173 to your computer and use it in GitHub Desktop.
MacInstall
#!/bin/bash
set -e
echo "πŸš€ Starting full Mac setup..."
# ----------------------------
# 1. Install Homebrew first
# ----------------------------
if ! command -v brew &> /dev/null; then
echo "🍺 Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
else
echo "βœ… Homebrew is already installed."
fi
# ----------------------------
# 2. Install NVM, Node, NPM
# ----------------------------
echo "πŸ“¦ Installing NVM, Node, and NPM..."
brew install nvm
mkdir -p ~/.nvm
export NVM_DIR="$HOME/.nvm"
source "$(brew --prefix nvm)/nvm.sh"
nvm install node
nvm use node
# ----------------------------
# 4. Install Xcode CLI tools
# ----------------------------
echo "πŸ›  Installing Xcode CLI tools..."
xcode-select --install 2>/dev/null || echo "βœ… Xcode CLI tools already installed."
# ----------------------------
# 5. Install Latest JDK
# ----------------------------
echo "β˜•οΈ Installing Temurin JDK..."
brew install --cask temurin
# ----------------------------
# 6.1 Install App Store apps via mas
# ----------------------------
echo "πŸ›’ Installing Mac App Store apps using mas..."
brew install mas
echo "⚠️ Please ensure you're signed into the Mac App Store before continuing."
read -p "Press [Enter] once you're signed in..."
mas install 937984704 # Amphetamine
mas install 1055511498 # Day One
mas install 1147396723 # WhatsApp
mas install 803453959 # Slack
mas install 1333542190 # 1Password
mas install 1504455889 # Figma
# ----------------------------
# 7. DMG Installer Function
# ----------------------------
install_dmg() {
local url="$1"
local filename="${url##*/}"
local download_path="$HOME/Downloads/$filename"
echo "⬇️ Downloading $filename..."
curl -L "$url" -o "$download_path"
# Handle ZIP files
if [[ "$filename" == *.zip ]]; then
echo "πŸ“¦ Unzipping $filename..."
unzip -qq "$download_path" -d /Applications
return
fi
echo "πŸ’½ Mounting $filename..."
local mount_dir
mount_dir=$(hdiutil attach "$download_path" -nobrowse | grep Volumes | awk '{print $3}')
if [ -z "$mount_dir" ]; then
echo "❌ Failed to mount $filename"
return
fi
echo "πŸ“‚ Looking for .app or .pkg in $mount_dir..."
app_path=$(find "$mount_dir" -maxdepth 1 -name "*.app" -print -quit)
pkg_path=$(find "$mount_dir" -maxdepth 1 -name "*.pkg" -print -quit)
if [ -n "$app_path" ]; then
echo "πŸš€ Copying $(basename "$app_path") to /Applications"
cp -R "$app_path" /Applications/
elif [ -n "$pkg_path" ]; then
echo "πŸ“¦ Installing $(basename "$pkg_path")"
sudo installer -pkg "$pkg_path" -target /
else
echo "⚠️ No .app or .pkg found in $mount_dir"
fi
echo "πŸ”Œ Unmounting $mount_dir..."
hdiutil detach "$mount_dir" -quiet
}
# ----------------------------
# 8. Download and Install DMG Apps
# ----------------------------
echo "πŸ“¦ Installing DMG-based apps..."
apps=(
"https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg"
"https://desktop.docker.com/mac/main/amd64/Docker.dmg"
"https://www.alfredapp.com/media/Alfred_5.0.6_2067.dmg"
"https://zoom.us/client/latest/Zoom.pkg"
"https://cdn.buildkite.com/software/paw/Paw-3.3.4.dmg"
"https://justgetflux.com/mac/Flux.zip"
"https://download.logitech.com/logitune/LogiTuneInstaller.dmg"
"https://cursor.sh/dl/mac"
"https://iterm2.com/downloads/stable/latest"
"https://herdapp.com/dl/latest/mac"
"https://tableplus.com/download/latest/mac"
"https://download.scdn.co/Spotify.dmg"
"https://redirector.gvt1.com/edgedl/android/studio/install/2022.3.1.21/android-studio-2022.3.1.21-mac.dmg"
"https://github.com/jhen0409/react-native-debugger/releases/download/v0.12.1/react-native-debugger.dmg"
"https://colorslurp.com/download"
)
for url in "${apps[@]}"; do
install_dmg "$url"
done
echo "πŸŽ‰ All setup steps completed! Enjoy your Mac 🎊"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment