Shortest way to install WP-CLI

That's the shortest way I know to install the WordPress shell extension WP-CLI:

curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar  /usr/local/bin/wp  chmod +x /usr/local/bin/wp

Is there an even shorter way?

Note: I use Ubuntu 16.04.

Topic wp-cli command-line linux Wordpress

Category Web


Downloading the Phar file is the recommended installation method for most users. As you showed, it's basically just one line. It can't really get shorter than that. And the steps make sense: download the file, make it executable and move it to the right location.

There are alternative ways to install WP-CLI though. For example, if you're using Composer, and have something like ~/.composer/vendor/bin in your PATH (or C:\Users\you\AppData\Roaming\Composer\vendor\bin on Windows), you can just run:

composer global require wp-cli/wp-cli

To update everything globally, run composer global update.

Alternatively, on Debian or Ubuntu you can just download and open one of the .deb packages: https://github.com/wp-cli/builds/tree/gh-pages/deb

On macOS you can install WP-CLI via Homebrew: brew install homebrew/php/wp-cli

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.