Skip to main content
πŸ“¬ Get weekly Production AI insightsPractical notes on Kubernetes, AI infrastructure and platform engineering. No spam.Subscribe free
Automation

How to Install Ansible on macOS with Homebrew

Install Ansible on macOS with Homebrew (brew install ansible) or pip. Step-by-step commands, verification, and post-install configuration.

Luca Berton

Β· The Production AI Expert

Published Β·1 min read

Here is how to install Ansible on macOS in 2026. Tested and verified.

The fastest way to install Ansible on macOS is with Homebrew: run brew install ansible, then verify with ansible --version. If you don’t use Homebrew, pip and pipx also work β€” see the methods below.

Prerequisites

  • macOS 13 (Ventura) or later
  • Homebrew installed (/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)")
brew install ansible

Verify:

ansible --version

Method 2: pip (Python Package Manager)

# Ensure Python 3 is installed
python3 --version

# Install pipx (recommended for CLI tools)
brew install pipx
pipx ensurepath

# Install Ansible
pipx install ansible

# Or with pip directly
pip3 install ansible --user

Method 3: pip in Virtual Environment

python3 -m venv ~/ansible-venv
source ~/ansible-venv/bin/activate
pip install ansible

Post-Installation Setup

# Create default config directory
mkdir -p ~/.ansible

# Create a basic ansible.cfg
cat > ~/.ansible.cfg << 'EOF'
[defaults]
inventory = ./inventory
host_key_checking = False
interpreter_python = auto_silent
EOF

# Create a test inventory
mkdir -p ~/ansible-project
cat > ~/ansible-project/inventory << 'EOF'
[local]
localhost ansible_connection=local
EOF

# Test with a ping
cd ~/ansible-project
ansible all -m ping

Verify Installation

ansible --version
ansible-playbook --version
ansible-galaxy --version
ansible-vault --version

Upgrade Ansible

# Homebrew
brew upgrade ansible

# pip
pip3 install --upgrade ansible

Free 30-min Production AI consultation

Book Now