Installing WP-CLI on your MacOS (via Homebrew)

by Jun 15, 2023WordPress Maintenance, WP-CLI0 comments

Kinsta - Unlock 4 Months OFF Annual WordPress Plans

As a WordPress developer or enthusiast, having the right tools at your disposal can greatly enhance your productivity. In this tutorial, we will walk you through the process of installing Homebrew and WP-CLI on macOS. Homebrew is a package manager for macOS, while WP-CLI is a command-line tool for managing WordPress installations. Let’s dive in and get started!

Table of Contents

What is Homebrew?

Homebrew: The missing package manager for MacOS

Homebrew is a popular package manager for macOS, providing a streamlined way to install, manage, and update software packages and dependencies on your Mac.

It simplifies the process of installing and managing various open-source software, libraries, and tools that may not come pre-installed with macOS.

🌐 Website

🐙 GitHub

Benefits of Homebrew

  1. Easy Installation: Homebrew itself can be quickly installed with a simple command, and once installed, it allows you to effortlessly install other software packages with similar ease.
  2. Package Management: Homebrew helps you manage packages by handling dependencies, updating packages, and uninstalling them cleanly when no longer needed. It takes care of resolving and installing dependencies automatically, making it convenient and efficient.
  3. Access to Open-Source Software: Homebrew provides access to a vast collection of open-source software, tools, and libraries that are not included in the default macOS installation. This allows developers to easily obtain and utilize a wide range of powerful tools for their projects.
  4. Version Control: Homebrew allows you to install specific versions of software packages, giving you control over which versions are utilized for your projects. This feature is particularly useful when working with specific software versions or when you need to maintain compatibility with older code.
  5. Community Support: Homebrew has an active and supportive community of developers who contribute to its package repository. This ensures that packages are continuously maintained, updated, and improved by the community, providing reliable and up-to-date software options.

Features of Homebrew

  1. Search and Installation: Homebrew provides a simple command-line interface that allows you to search for packages and install them directly from the command line. This makes the process quick and convenient.
  2. Dependency Management: Homebrew automatically resolves and installs dependencies required by the software packages you install. It ensures that all the necessary dependencies are properly installed to avoid conflicts or issues.
  3. Update and Upgrade: Homebrew makes it easy to keep your installed packages up to date. You can update Homebrew itself and then use a single command to update all installed packages to their latest versions.
  4. Uninstallation and Cleanup: Homebrew allows you to cleanly uninstall packages, removing all associated files and dependencies. It also provides commands to clean up unused or outdated packages, freeing up disk space on your Mac.
  5. Cask Support: Homebrew extends its functionality with Homebrew Cask, a feature that allows you to install macOS applications directly from the command line. This includes popular applications like web browsers, text editors, media players, and more.

Overall, Homebrew simplifies the process of managing software packages on macOS, providing a user-friendly interface and a vast collection of open-source software options. It saves time, improves productivity, and enhances the development experience for macOS users.

What is WP-CLI?


WP-CLI (WordPress Command-Line Interface) is a powerful command-line tool specifically designed for managing WordPress websites.

It allows developers, administrators, and power users to interact with WordPress installations directly from the command line, providing a fast and efficient way to perform various tasks.

🌐 Website

🐙 GitHub

Benefits of WP-CLI

  1. Automation and Efficiency: WP-CLI enables automation of WordPress tasks, making it easier and faster to perform repetitive tasks such as plugin management, theme installation, database backups, and updates. This helps streamline workflows and saves time for developers and administrators.
  2. Scripting and Integration: With WP-CLI, you can write scripts and automate complex tasks. It can be integrated with other command-line tools, version control systems, and continuous integration workflows, allowing for seamless integration into development and deployment pipelines.
  3. Speed and Performance: WP-CLI operates directly on the command line, bypassing the need for a graphical user interface (GUI). This results in faster execution of commands and eliminates the overhead associated with loading a web page. It is particularly beneficial when working with large or multisite WordPress installations.
  4. Flexibility and Control: WP-CLI provides fine-grained control over various aspects of a WordPress installation. It allows you to manage plugins, themes, users, databases, and perform advanced administrative tasks without relying on the WordPress dashboard. This flexibility is especially useful for developers and system administrators.
  5. Reproducibility and Consistency: WP-CLI allows you to script and document tasks, making it easier to reproduce them in different environments or share them with others. This ensures consistent and reliable execution of tasks across different WordPress installations.

Features of WP-CLI

  1. Plugin and Theme Management: WP-CLI provides commands to install, activate, deactivate, update, and delete plugins and themes. It also allows you to search the WordPress plugin and theme directories directly from the command line.
  2. Database Operations: WP-CLI enables you to manage the WordPress database, including importing, exporting, backing up, and optimizing the database. It provides commands to interact with tables, run SQL queries, and perform various maintenance tasks.
  3. User and Role Management: WP-CLI allows you to create, edit, and delete WordPress users. It also enables you to manage user roles, assign capabilities, and update user information directly from the command line.
  4. Content Generation: WP-CLI provides commands to create and manage WordPress posts, pages, and other content types. It allows you to generate dummy content, import content from external sources, and perform bulk operations on content.
  5. Site Maintenance: WP-CLI offers commands to update WordPress core, plugins, and themes. It can perform maintenance tasks like clearing caches, resetting passwords, and troubleshooting common issues.

WP-CLI is an invaluable tool for developers, administrators, and anyone working with WordPress regularly. It simplifies WordPress management tasks, boosts productivity, and offers greater control and automation capabilities, all from the convenience of the command line.

Installation process of Homebrew & WP-CLI

Step 1: Installing Homebrew

  1. Open the Terminal application on your macOS. You can find it in the “Utilities” folder within the “Applications” folder.
  2. Visit the Homebrew website ( in your web browser.
  3. On the Homebrew website, you will see the installation command in the middle of the page. It should look like this:
/bin/bash -c "$(curl -fsSL"
  1. Copy the installation command.
  2. Return to your Terminal window and paste the copied command. Press Enter to run it.
  3. The installation process will prompt you to enter your macOS user account password. Enter your password and press Enter.
  4. Homebrew will now be installed on your system. This process may take a few minutes to complete.
  5. Once the installation is finished, you can verify that Homebrew is installed correctly by typing the following command in your Terminal window:
brew --version

You should see the version number of Homebrew displayed, indicating a successful installation.

Step 2: Installing WP-CLI

  1. With Homebrew installed, you can now proceed to install WP-CLI. WP-CLI provides a powerful command-line interface for managing WordPress sites.
  2. In your Terminal window, type the following command to install WP-CLI using Homebrew:
brew install wp-cli
  1. Press Enter to run the command. Homebrew will now download and install WP-CLI and its dependencies.
  2. Once the installation is complete, you can verify that WP-CLI is installed correctly by typing the following command in your Terminal window:
wp --version

You should see the version number of WP-CLI displayed, confirming a successful installation.

Step 3: Updating WP-CLI

  1. It’s essential to keep WP-CLI up to date to benefit from the latest features and bug fixes.
  2. To update WP-CLI, type the following command in your Terminal window:
brew upgrade wp-cli
  1. Press Enter to run the command. Homebrew will check for updates and update WP-CLI if a new version is available.

Step 4: Verifying the Installation

  1. Finally, let’s verify that WP-CLI is correctly installed and working.
  2. In your Terminal window, navigate to a directory where you have a WordPress installation or create a new directory and install WordPress using WP-CLI.
  3. Once you’re in the WordPress directory, type the following command to check if WP-CLI is functioning correctly:
wp --info
  1. Press Enter to run the command. You should see a detailed output containing information about your WordPress installation.


You have successfully installed Homebrew and WP-CLI on your macOS system.

With these powerful tools at your disposal, you can now streamline your WordPress development workflow and manage your WordPress sites efficiently from the command line.


In this tutorial, we covered the step-by-step process of installing Homebrew, a package manager for macOS, and WP-CLI, a command-line tool for managing WordPress sites. By following these instructions, you can equip yourself with the necessary tools to enhance your WordPress development experience on your macOS machine.

Kinsta - Unlock 4 Months OFF Annual WordPress Plans
0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
4 Local Development Tools for WordPress

4 Local Development Tools for WordPress

Local development environments are essential for WordPress developers to build, test, and debug websites and plugins without affecting live sites. Several tools have emerged over the years to simplify this process, making it easier for developers to work locally. In this article, we’ll compare four popular local development tools for WordPress: LocalWP, DevKinsta, Lando, and DDEV.

read more
Running WP-CLI commands remotely

Running WP-CLI commands remotely

Managing multiple WordPress sites can be a daunting task, especially when it comes to performing routine maintenance tasks like updates, plugin management, and backups. However, thanks to WP-CLI (WordPress Command Line Interface) and SSH (Secure Shell), administering remote WordPress sites has become much more efficient and streamlined. In this article, we will explore how WP-CLI and SSH can revolutionize the way you manage your WordPress sites, making your life as a web administrator much easier.

read more
How to debug an error in WordPress?

How to debug an error in WordPress?

WordPress is an incredibly powerful and versatile content management system that allows people to create stunning websites with ease. However, like any complex software, it can occasionally throw up errors that can be frustrating to deal with. Debugging an error in WordPress can be a time-consuming process, but with the right approach, it is possible to identify and fix the issue.

read more
Cool Snippets for wp-config.php

Cool Snippets for wp-config.php

As a WordPress developer, you may already be familiar with the wp-config.php file. This file is an essential part of your WordPress installation and contains important configuration information. But did you know that you can enhance your WordPress site’s functionality and performance by adding some cool and useful snippets to this file? In this blog post, we’ll explore 12 snippets that you can add to your wp-config.php file to improve your WordPress site.

read more
Doing cool things with WP-CLI

Doing cool things with WP-CLI

If you’re managing a WordPress website, you know that there are a lot of tasks that need to be performed regularly to keep your site up and running smoothly. While there are many ways to accomplish these tasks, one tool that can make your life easier is WP-CLI.

WP-CLI is a command-line interface for WordPress that allows you to manage your website from the terminal. In this post, we’ll look at some of the cool things you can do with WP-CLI to manage your WordPress website.

read more
6 Reasons to use a WordPress Maintenance Service

6 Reasons to use a WordPress Maintenance Service

If you own a WordPress website, you may already know the importance of keeping it up-to-date and secure. However, maintaining a website can be time-consuming and sometimes requires specialized knowledge. This is where a WordPress maintenance service can come in handy. In this blog post, we will discuss why paying for a WordPress maintenance service is a good idea for website owners.

read more
Buy me a Beer
Ad - Web Hosting from SiteGround - Crafted for easy site management. Click to learn more.
Sucuri - Complete end-to-end security