How to install WordPress on Mac

The installation will be done in three main steps:

  1. Install MySQL.
  2. Install PHP.
  3. Install WordPress site.

Install MySQL

You can use the following resource to install MySQL on MAC:

After installing it, run create database my_wordpress_site; command to create a database locally to your mysql instance:

Connect to mysql instance first:

mysql -u root -p
mysql> create database my_wordpress_site;
Query OK, 1 row affected (0.03 sec)

Run SHOW SCHEMAS; command to get the list of databases on your mysql instance:

mysql> SHOW SCHEMAS;
+-------------------------------+
| Database                      |
+-------------------------------+
| information_schema            |
| my_wordpress_site             |
| mysql                         |
| performance_schema            | |
| sys                           |
+-------------------------------+

You can confirm from the above results that the my_wordpress_site database has been created.

Create a new user for your database:

CREATE USER 'my_wordpress_site_user'@'localhost' IDENTIFIED BY '<NewPasswordForThisUser>';

Grant permissions to that user to your wordpress db.

GRANT ALL ON my_wordpress_site.* TO 'my_wordpress_site_user'@'localhost';

Confirm whether the user has got the permissions for that db:

SHOW GRANTS FOR 'my_wordpress_site_user'@'localhost';

Output will show like this:

+---------------------------------------------------------------------------------------+
| Grants for my_wordpress_site_user@localhost                                           |
+---------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `my_wordpress_site_user`@`localhost`                            |
| GRANT ALL PRIVILEGES ON `my_wordpress_site`.* TO `my_wordpress_site_user`@`localhost` |
+---------------------------------------------------------------------------------------+

Install PHP

You can use the following resource to install PHP on MAC

Install WordPress site

Go to https://wordpress.org/download/

Click the download button for the latest version from that site:

Extract the zip and unzip to a location say /WordPress/MyWordPressSite on your MAC:

Open the terminal at the folder (/WordPress/MyWordPressSite):

Run php -S localhost:9000 command to start the PHP server on that web site at 9000 port

php -S localhost:9000

Output:

PHP 7.4.29 Development Server (http://localhost:9000) started

Accessing http://localhost:9000 will take you to the WordPress set up screen now:

Click Let’s go button on the next screen:

Enter the following details on tne next page:

  • Database Name: my_wordpress_site
  • Username: my_wordpress_site_user
  • Password: <The password you set for my_wordpress_site_user>
  • Database Host: localhost
  • Table Prefix: wp_

Click the Run the installation button on the next page:

On Information needed page add the following details:

  • Site Title: My WordPress Site
  • Username: wp_admin
  • Password: <Any strong password> (Save it for future usage)
  • Your Email: <Your Email>
  • Search engine visibility: Check the checkbox.

Click the Install WordPress button.

Next page will display a success message to show that the installation has been done:

Click the Log In button.

On the login page enter your credentials which you added in the WordPress configuration set up.

You will be taken to the admin dashboard page of your WordPress site after successfull login.

The installation is completed now for your WordPress site on MAC.