Skip to main content
๐ŸŽ“ Claude Code Masterclass Learn AI-assisted development on Udemy โ€” plus the companion book on Leanpub & Amazon. Start Learning
Install Ansible on macOS
Automation

Install Ansible on macOS (Step-by-Step 2026)

How to install Ansible on macOS in 2026. Complete step-by-step guide with commands, verification, and post-install configuration.

LB
Luca Berton
ยท 1 min read

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

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 AI & Cloud consultation

Book Now