Skip to content

How to Install WP-CLI

This text and video Quick Guide covers how to install WP-CLI, the WordPress command line interface.

What WP-CLI Is and Why to Install WP-CLI

First off, WP-CLI is a command line utility. We’ve written a number of articles about how to do various things on the Unix command line. The highlight articles are:

For a WordPress developer, a lot of this is nice to know but not super-useful—without a system that lets us do WordPress development in the command line. WP-CLI is exactly that system.

WP-CLI is a Unix command line package that really makes it worth figuring out the command line. It makes doing lots of little administration tasks on you WordPress server so much easier.

We’ve made an entire free course on using WP-CLI:

But the first thing you’ll need to understand is how to install WP-CLI itself. The video and the text below will show you how.

Here’s the video:

And here’s a text guide to installing WP-CLI:

How to Install WP-CLI  (and What Each Step Does)

  1. Open a command prompt. Probably BASH.
  2. Paste in the command: curl -O and hit enter. This will download the file from the URL onto your computer and into your current directory.
  3. Make sure the above command worked via a run of `php wp-cli.phar –info`. If you get output, keep going. If not, redo step 2. (We’re just running WP-CLI here, with one of it’s simplest commands.)
  4. Make the phar executable via `chmod +x wp-cli.phar`. CHMOD is the method to change permissions on a file, we need it be executable so that we can invoke it without calling PHP first (as we did in step 3).
  5. Rename and move the executable into your path (see the end of my Unix concepts article for details), so that you can type wp to run the command. sudo mv wp-cli.phar /usr/local/bin/wp.
  6. Confirm everything worked by running wp --info.

And that’s it! Now that you’ve got WP-CLI installed, have a look at our free course on WP-CLI. Happy hacking!

Yay! 🎉 You made it to the end of the article!
David Hayes

Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Working With The Command Line and WP-CLI – WPShout
June 6, 2017 12:12 pm

[…] Installing WP-CLI […]

Anatomy of a WP-CLI Command: wp database import | WPShout
May 9, 2017 11:00 am

[…] Quick Guide: Installing WP-CLI […]

The What, How and Why of WP-CLI: WordPress in Your Terminal | WPShout
January 31, 2017 10:32 am

[…] into your terminal is doing. If you’re looking for that check out our latest Quick Guide: Installing WP-CLI. Here’s its […]

The What, How and Why of WP-CLI: WordPress in Your Terminal | | Null Shop
January 31, 2017 10:13 am

[…] Installing WP-CLI […]

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!

Would love your thoughts, please comment.x

Most Searched Articles

Best JavaScript Libraries and Frameworks: Try These 14 in 2024

In this post, we look at the best JavaScript libraries and frameworks to try out this year. Why? Well, with JavaScript being available in every web browser, this makes it the most accessible programming language of ...

20 Best Free WordPress Themes for 2024 (Responsive, Mobile-Ready, Beautiful)

If you're looking for only the best free WordPress themes in the market for this year, then you're in the right place. We have more than enough such themes for you right ...

12 Best WordPress Hosting Providers of 2024 Compared and Tested

Looking for the best WordPress hosting that you can actually afford? We did the testing for you. Here are 10+ best hosts on the market ...

Handpicked Articles

How to Make a WordPress Website: Ultimate Guide for All Users – Beginners, Intermediate, Advanced

Many people wonder how to make a WordPress website. They’ve heard about WordPress, its incredible popularity, excellent features and designs, and now they want to join the pack and build a WordPress website of their own. So, where does one get ...

How to Start an Ecommerce Business: Ultimate Guide for 2024

Is this going to be the year you learn how to start an eCommerce business from scratch? You’re certainly in the right place! This guide will give you a roadmap to getting from 0 to a fully functional eCommerce business. ...