Skip to main content
πŸš€ Claude Code Bootcamp β€” May 30 5 hours from prompting to production. Build 10 real-world projects with AI-assisted development. Register Now
Install AWS CLI on Mac with Homebrew 2026
DevOps

Install AWS CLI on Mac with Homebrew (2026 Guide)

Step-by-step guide to install, configure, and verify AWS CLI v2 on macOS using Homebrew. Includes profile setup, SSO login, autocompletion, and common troubleshooting fixes.

LB
Luca Berton
Β· 1 min read

Prerequisites

  • macOS 13 Ventura or later (Intel or Apple Silicon)
  • Homebrew installed

Verify Homebrew is working:

brew --version
# Homebrew 4.x.x

If you do not have Homebrew yet:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install AWS CLI v2

brew install awscli

That is it. Homebrew handles the download, dependency resolution, and PATH setup automatically.

Verify the installation:

aws --version
# aws-cli/2.27.x Python/3.12.x Darwin/24.x source/arm64

Configure Your First Profile

Interactive Setup

aws configure

You will be prompted for:

AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-east-1
Default output format [None]: json

This creates two files:

  • ~/.aws/credentials β€” your access keys
  • ~/.aws/config β€” region and output preferences

Named Profiles

For multiple AWS accounts:

aws configure --profile production
aws configure --profile staging

Use a profile:

aws s3 ls --profile production

# Or set as default for the session
export AWS_PROFILE=production

If your organization uses AWS IAM Identity Center (SSO):

aws configure sso

Follow the prompts:

SSO session name (Recommended): my-company
SSO start URL [None]: https://my-company.awsapps.com/start
SSO region [None]: us-east-1
SSO registration scopes [sso:account:access]:

Login:

aws sso login --profile my-sso-profile

Enable Shell Autocompletion

Zsh (Default on macOS)

Add to ~/.zshrc:

autoload bashcompinit && bashcompinit
autoload -Uz compinit && compinit
complete -C '/opt/homebrew/bin/aws_completer' aws

Reload:

source ~/.zshrc

Bash

Add to ~/.bash_profile:

complete -C '/opt/homebrew/bin/aws_completer' aws

Now you can tab-complete:

aws s3 <TAB>
aws ec2 describe-<TAB>

Verify Everything Works

# Check identity
aws sts get-caller-identity

Expected output:

{
    "UserId": "AIDAIOSFODNN7EXAMPLE",
    "Account": "123456789012",
    "Arn": "arn:aws:iam::123456789012:user/lucaberton"
}

Common Commands to Test

# List S3 buckets
aws s3 ls

# List EC2 instances
aws ec2 describe-instances \
  --query 'Reservations[].Instances[].[InstanceId,State.Name,InstanceType]' \
  --output table

# List Lambda functions
aws lambda list-functions --query 'Functions[].FunctionName' --output text

# Get current region
aws configure get region

Update AWS CLI

brew upgrade awscli

Check for available updates:

brew outdated awscli

Uninstall

brew uninstall awscli

Remove configuration files:

rm -rf ~/.aws

Troubleshooting

command not found: aws

Homebrew installs to /opt/homebrew/bin on Apple Silicon. Make sure it is in your PATH:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc
source ~/.zshrc

Wrong Python Version Conflicts

The Homebrew formula bundles its own Python β€” it will not conflict with system Python or pyenv. If you see import errors:

brew reinstall awscli

Credential Errors

# Check which credentials are being used
aws configure list

# Output shows source of each setting:
#       Name                    Value             Type    Location
#       ----                    -----             ----    --------
#    profile                <not set>             None    None
# access_key     ****************MPLE shared-credentials-file
# secret_key     ****************EKEY shared-credentials-file
#     region                us-east-1      config-file    ~/.aws/config

Multiple AWS CLI Versions

If you previously installed via the .pkg installer:

# Remove the pkg version
sudo rm -rf /usr/local/aws-cli
sudo rm /usr/local/bin/aws
sudo rm /usr/local/bin/aws_completer

# Then use Homebrew version
brew install awscli

Alternative: Official Installer

If you prefer not to use Homebrew:

# Download official installer
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"

# Install
sudo installer -pkg AWSCLIV2.pkg -target /

# Verify
aws --version

The Homebrew method is recommended because it handles updates (brew upgrade) and integrates with your existing package management workflow.

Environment Variables Reference

VariablePurpose
AWS_PROFILEActive named profile
AWS_REGIONOverride default region
AWS_ACCESS_KEY_IDOverride access key
AWS_SECRET_ACCESS_KEYOverride secret key
AWS_SESSION_TOKENTemporary session token
AWS_DEFAULT_OUTPUTOutput format (json/text/table)

Free 30-min AI & Cloud consultation

Book Now