How to setup Wordpress in M1 Mac Local — CLI

A quick step by step guide to setting up Wordpress in your localhost with just Homebrew

Rameez Kakodker
6 min readDec 11, 2021

There are many guides out there that will help you setup Wordpress in your localhost. I’ve tried them and faced some issues (and eventually solved them).

Here is the step by step guide for a layman.


  1. Install Homebrew
  2. Install PHP (get the right version)
  3. Install MySQL and setup your database
  4. Download Wordpress and copy to development folder
  5. Configure Wordpress

Step 1: Install Homebrew

Installing homebrew is very simple and all it takes is you open a terminal by pressing (Space + Enter) and typing Terminal. It should open a black window:

Copy paste the following:

/bin/bash -c "$(curl -fsSL"

Once the installation is complete, you can proceed to the next step. If you’re prompted for a password, please provide it. This installs Homebrew on your local machine.

Step 2: Install PHP

This is the tricky part. As of writing this article (Dec 2021), the latest version of PHP is not supported. Unfortunately, very little literature deals with this. You should opt for a lower version of PHP (ideally 7.4), and run it as the default PHP version. To install php@7.4, all you need to do is copy paste & run the following command:

brew install php@7.4

It should take a couple of mins to install:

You need to do a couple of things once that’s done:

Step 2.1: Load PHP@7.4 as the default PHP version

You might have a new version of PHP installed in your system. If you get the following message while installing (just scroll up)

If that’s the case, all you need to do is to let MacOS know that the 7.4 version is the latest one when you type php in your terminal:

echo 'export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"' >> ~/.zshrcecho 'export PATH="/opt/homebrew/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc

Step 2.2: [Optional] Update php.ini to allow for bigger file uploads

This is a pre-emptive step that allows you to test new themes without running into errors for uploads. Do not do this on a production environment.

Type the following sequentially:

cd /opt/homebrew/etc/php/7.4/
vim php.ini

Once the vim editor is open:

  1. Type /upload_max_filesize and navigate with your keyboard to where it says 2M:
  2. Press i to get into edit mode.
  3. Remove 2M and replace with 10M — this sets the maximum file upload size for the PHP server.
  4. Press the escape key and type wq — this writes and quits the editor.

Your php.ini file should have this:

Step 3: Install MySQL

MySQL is the database that you’ll use for Wordpress. It’s where the information that Wordpress needs to function is stored. To install, in the same terminal window, type:

brew install mysql

Once the installation is complete, type:

brew services start mysql

which will start the mysql service.

For Wordpress, we’ll have to create a new database to put all that information in… you can choose to call the database whatever you want. We’ll stick to the standard wordpress database name for now, but you can choose a different one.

To create a new database, type the following:

mysql -u root

This opens the mysql prompt, where you can create a new database:


Tip: You can see all your databases by type SHOW DATABASES;

Create database command creates a new database ‘test_wordpress’.

Remember the name you’ve given to the database.

Step 4: Download Wordpress to the right folder

It is important for you to know where you’re downloading the actual wordpress file. I prefer to create a Development folder to keep a track of all my projects — but that’s a personal preference. You can create a new folder in your Documents folder by either creating it from the UI, which you should know, or via command line. To do that, first exit from mysql by typing exit, and follow the below instructions.

Step 4.1: Create/Go to the right folder

mkdir development/new-site/
cd development/new-site/

You can use pwd to find where you are in the terminal. PWD stands for Present Working Directory — so that’ll be easy to remember.

Step 4.2: Install WGET

Before you continue, you have to install WGET. WGET is a command-line tool for downloading files. You can do a lot more, but we’ll use it for this. To install, simply type:

brew install wget

It will take a few seconds.

Step 4.3: Download Wordpress and uncompress

Finally, it’s time to download wordpress:


You’re downloading a tar.gz file which is a highly compressed zip file. To extract it:

tar xfz latest.tar.gz

This creates a new folder in your new-site folder called wordpress. Which we don’t want… we want to get the wordpress files inside the new-site folder. To do that:

mv wordpress/* ./

which moves all the content from the wordpress folder to the current folder. * denotes all files and the ./ path returns the current working directory.

Once that’s done, you’re on your way to configure and start using Wordpress.

Step 5: Configure and start Wordpress

To start using wordpress, you’ll need to start a PHP server:

php -S localhost:8000

This starts a server on your localhost on the port 8000. You can change the port to whatever you want, but 8000 is usually safe. You should see this:

Open your browser and navigate to localhost:8000. If you’ve followed the above instructions you should see:

Let’s start configuring:

First, select your language and proceed to the second step. Here you can simply press “Let’s go” to get to this screen:

The following values should work:

Database Name: <the name of the mysql database you gave>
Username: root
Password: <clear the input>
Leave everything else as it is...

It should look like this:

Submit and you should be ready with your own localhost installation of Wordpress!

Thank you for reading!



Rameez Kakodker

100+ Articles on Product, Design & Tech | Top Writer in Design | Simplifying complexities at Majid Al Futtaim |