How to Upgrade Ansible on macOS Using Homebrew
By Luca Berton · Published 2024-01-01 · Category: installation
Keeping Your Ansible Environment Up-to-Date with Homebrew. Practical examples and step-by-step guidance on How to Upgrade Ansible on macOS.

Introduction
Ansible is a powerful open-source automation tool that simplifies the management of your infrastructure through code. If you’re using Ansible on macOS and want to keep it up to date, Homebrew is a convenient package manager to help you with that. In this guide, we’ll walk you through the steps to upgrade Ansible on your macOS using Homebrew.Prerequisites:
- Homebrew: Ensure that you have Homebrew installed on your macOS. If not, you can install it by following the instructions on the Homebrew website.
- Terminal: You’ll need access to your macOS terminal to run the necessary commands.
Checking the Current Version
Before upgrading Ansible, it’s a good practice to check the current installed version. Open your terminal and run the following command:ansible --versionThis command will display information about your current Ansible installation, including the version number.
ansible [core 2.15.5]
config file = /Users/lberton/prj/gitlab/ansible-pilot/scp/ansible.cfg
configured module search path = ['/Users/lberton/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /opt/homebrew/Cellar/ansible/8.5.0_1/libexec/lib/python3.11/site-packages/ansible
ansible collection location = /Users/lberton/.ansible/collections:/usr/share/ansible/collections
executable location = /opt/homebrew/bin/ansible
python version = 3.11.6 (main, Oct 2 2023, 13:45:54) [Clang 15.0.0 (clang-1500.0.40.1)] (/opt/homebrew/Cellar/ansible/8.5.0_1/libexec/bin/python)
jinja version = 3.1.2
libyaml = TrueSee also: Install Ansible on macOS: Homebrew & pip Installation Guide
Upgrading Ansible
Now that you have confirmed the current version, you can proceed with upgrading Ansible using Homebrew. Follow these steps:- Update Homebrew: Ensure Homebrew is up to date by running the following command:
brew updateThis command fetches the latest package information from Homebrew’s repository.
- Upgrade Ansible: Upgrade Ansible to the latest version using the following command:
brew upgrade ansibleHomebrew will automatically download the latest version of Ansible and install it on your system. If you already have the latest version installed, Homebrew will let you know that there’s nothing to upgrade.
- Check the New Version: After the upgrade process is complete, run the
ansible --versioncommand again to confirm that you're now using the updated version.
ansible [core 2.15.5]
config file = /Users/lberton/prj/gitlab/ansible-pilot/scp/ansible.cfg
configured module search path = ['/Users/lberton/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /opt/homebrew/Cellar/ansible/8.5.0_1/libexec/lib/python3.11/site-packages/ansible
ansible collection location = /Users/lberton/.ansible/collections:/usr/share/ansible/collections
executable location = /opt/homebrew/bin/ansible
python version = 3.11.6 (main, Oct 2 2023, 13:45:54) [Clang 15.0.0 (clang-1500.0.40.1)] (/opt/homebrew/Cellar/ansible/8.5.0_1/libexec/bin/python)
jinja version = 3.1.2
libyaml = TrueNow, you should see the updated Ansible version displayed in the terminal.
Checking Ansible-Lint
If you also have ansible-lint installed and want to upgrade it, you can follow a similar process:
- Check the Current Version:
ansible-lint --versionThis will display information about your current ansible-lint installation, including the version number.
- Upgrade ansible-lint:
brew upgrade ansible-lintHomebrew will fetch and install the latest version of ansible-lint.
- Check the New Version:
ansible-lint 6.21.0 using ansible-core:2.15.5 ansible-compat:4.1.10 ruamel-yaml:0.17.35 ruamel-yaml-clib:0.2.8See also: Ansible Troubleshooting Installation Issues on macOS and Python
Conclusion
Upgrading Ansible and its associated tools like ansible-lint using Homebrew is a straightforward process. By staying up to date with the latest versions, you can take advantage of new features, bug fixes, and security enhancements, ensuring your automation workflows are as efficient and secure as possible.Related Articles
Category: installation
Watch the video: How to Upgrade Ansible on macOS Using Homebrew — Video Tutorial