We’ve written a number of recent articles about how to do various things on the Unix command line. The highlight articles are:
- What is the Command Line? CLIs from First Principles
- 10-ish Unix CLI File Commands Every WordPress Developer Should Know
- Mastering the Unix Terminal: Working With Permissions, Networking, and Other Key Concepts
For a WordPress developer, a lot of this is nice to know but not super useful. WP-CLI is a Unix command line package that really makes it worth figuring out the command line. We’ll publish an article soon about why you should know and use WP-CLI, but the basic story is that makes doing lots of little administration tasks on you WordPress server so much easier.
So this week’s Quick Guide is just a simple little explanation of installing. The directions provided on the main site are quite good, and so there’s not much more than following those directions to it. But both in the video and the text below, we’ll add a bit more color so you know what each command is doing for you.
Here’s the video:
How (and What Each Step Does) of Installing WP-CLI
- Open a command prompt. Probably BASH.
- Paste in the command:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.pharand hit enter. This will download the file from the URL onto your computer and into your current directory.
- 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.)
- Make the
pharexecutable 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).
- Rename and move the executable into your path (see the end of my Unix concepts article for details), so that you can type
wpto run the command.
sudo mv wp-cli.phar /usr/local/bin/wp.
- Confirm everying worked by running
Stay tuned to WPShout for more about WP-CLI, and until then, happy hacking!
Image credit: psd