#!/bin/bash # AWS CLI v2 Installer for macOS # This script downloads and installs AWS CLI v2 on macOS set -e echo "🚀 Installing AWS CLI v2 for macOS..." # Check if AWS CLI is already installed if command -v aws &> /dev/null; then echo "✅ AWS CLI is already installed:" aws --version exit 0 fi # Check if we're on macOS if [[ "$OSTYPE" != "darwin"* ]]; then echo "❌ This script is for macOS only. Please install AWS CLI manually for your platform." exit 1 fi # Create temporary directory TEMP_DIR=$(mktemp -d) cd "$TEMP_DIR" echo "📥 Downloading AWS CLI v2..." # Download AWS CLI v2 for macOS curl -O https://awscli.amazonaws.com/AWSCLIV2.pkg echo "🔧 Installing AWS CLI v2..." # Install the package sudo installer -pkg AWSCLIV2.pkg -target / # Clean up cd - > /dev/null rm -rf "$TEMP_DIR" echo "✅ AWS CLI v2 installed successfully!" # Verify installation if command -v aws &> /dev/null; then echo "🔍 AWS CLI version:" aws --version echo "" echo "🎉 Installation completed! You can now use the desktop sync tool." else echo "❌ Installation failed. Please try installing manually:" echo " https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html" exit 1 fi