Last active
April 3, 2025 15:24
-
-
Save tquiroga/1acb047218ad9feccca4d84f61166173 to your computer and use it in GitHub Desktop.
MacInstall
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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