ansible: command not found
ansible: command not found
DodaTech
2 min read
The “ansible: command not found” error means the Ansible CLI is not installed on your system. The shell cannot locate the ansible binary in any directory listed in your PATH environment variable.
What It Means
Your operating system searched through all directories in PATH for an executable named ansible and found none. Ansible is either not installed, or its installation directory is not included in PATH.
Why It Happens
- Ansible is not installed on the machine.
- Ansible was installed via pip but for a different Python version or user.
- The installation directory (e.g.,
~/.local/bin) is not in yourPATH. - You are inside a minimal container or virtual environment that lacks Ansible.
- The package manager installation failed or was incomplete.
How to Fix It
Install Ansible via pip (recommended)
pip install ansibleIf you get a permission error, use --user:
pip install --user ansibleInstall via package manager
Ubuntu / Debian:
sudo apt update
sudo apt install ansible -yCentOS / RHEL / Fedora:
sudo yum install epel-release -y
sudo yum install ansible -ymacOS (Homebrew):
brew install ansibleEnsure ~/.local/bin is in PATH
export PATH="$HOME/.local/bin:$PATH"
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcVerify installation
ansible --versionExpected output shows the Ansible version number and configuration file location.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro