Install WP CLI

We break down the installation process for the WordPress Command Line Interface (WP CLI) into the following 3 steps.

Step 1: Check Requirements

Before you can WordPress Command Line Interface (WP CLI), you need to check that your environment has the following list of requirements:

  • UNIX environment – Linux, for example, is the most popular web server and is likely what your WordPress site is hosted on. But, WP CLI is also supported by Mac (OS X), FreeBSD, Cygwin, and has a limited level of support for Windows.
  • PHP >= 5.4
  • WordPress >= 3.7

Step 2: Download wp-cli.phar file

SSH into your server and run the following command to download the wp-cli.phar file.

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

You can also use the wget command if you prefer it over curl.

Step 3: Make wp-cli.phar Executable and Move it to Use the wp command

To make wp-cli.phar executable, use the chmod +x command. See the code below as an example:

chmod +x wp-cli.phar

You should be able to use wp-cli.phar as you would the wp command, for example, you could type the following command in your terminal and should get a response:

wp-cli.phar --info

In order to use the wp command as shown in the WP CLI documentation, move the wp-cli.phar file in your file path and set it to wp, as shown below:

sudo mv wp-cli.phar /usr/local/bin/wp

Now, you should be able to run wp --info and get a result. And, you can do everything else that WP CLI is capable of, including installing plugins via the command line.

Leave a Reply

Your email address will not be published. Required fields are marked *