Install Ansible on Mac OSX

Brew Install

  • Install Homebrew if there is no brew.
    /usr/bin/ruby -e "$(curl -fsSL"
  • Install Ansible
    brew install ansible

Native Python Install

  • Install Xcode
    Check if your already have the developer tools:

    Before OSX mavericks, the package name was


    If the tools are not installed, you will see this output:

    No receipt for '' found at '/'.

    In that case, download and install Xcode form apple website.
    If the tools are installed, you should see output similar to this:

    volume: /
    location: /
    install-time: 1397415256
  • Install pip
    sudo easy_install pip
  • Install Ansible
    sudo pip install ansible
  • Upgrade Ansible
    sudo pip install ansible --upgrade
  • Inventory hosts filename
    The default inventory hosts file is /etc/ansible/hosts. There are two ways to change the defualt file:
    • Set environment variable:
      export ANSIBLE_HOSTS=/root/ansible_hosts
    • Specify the Ansible hosts location with the –inventory-file= (or -i) flag:
      ansible all --inventory-file=/root/ansible_hosts -m ping


Written on June 6, 2017