The following tutorial is intended for Mac and Linux users.
Official Installation Procedure
For the official installation route, as outlined on the WP-CLI website, ensure you have PHP version 5.6 or later and the cURL command line utility pre-installed. To install WP-CLI, initiate these steps in your terminal:
Begin with fetching the Phar build using cURL:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
Proceed to confirm the integrity of the downloaded file:
php wp-cli.phar --info
Grant execution permissions and shift it into your PATH for ease of use:
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
Package Manager Installation Options
While WP-CLI's team may not directly oversee package manager distributions, it is possible to install WP-CLI through various package managers thanks to community contributors.
Installation via APT
For Debian/Ubuntu systems and derivatives, you can capitalize on the PPA provided by Tiago Hillebrandt:
sudo add-apt-repository ppa:tiagohillebrandt/wp-cli
sudo apt-get update
sudo apt-get install wp-cli
This string of commands will add the repository, refresh your package index, and install WP-CLI onto your system.