Configure local wordpress development on mac OS

Haifeng Wang
2 min readSep 24, 2020

--

I can’t use newest wamp version because of my windows 7 system. So I decided to set up a local wordpress environment on my mac.

I recorded all the process in case I have to do the same in the future.

Apache and PHP are already on my machine by using the command

apachetl -v

php -v

Then make a tiny adjustment in its configuration(I use visual studio which I can use code command to open ):

sub code /etc/apachectl2/httpd.conf

1.Enable vhost

Access wordpress projects with custom domains

2.Enable rewrites

By default mod_rewrite follows the filesystem path. We can have more customized wordpress URL by enable it

3. Enable PHP

Let server know how to deal with .php file. cause wordpress is written in PHP.

4. Change the default location for our projects

It is not a requirement, just a convention. I prefer to store the source files in the home folder

5. Enable .htaccess

The AllowOverride controls section of the configuration file allows us to enable the use of .htaccess files

6. Point customized .localhost domain to 127.0.0.1

sudo code /etc/hosts

7. Manage local domains using vhost

sudo code /etc/apache2/extra/httpd-vhosts.conf

Build a wordpress website via WP-CLI

brew install wp-cli

Command line interface is a way to save our time than traditional way.

Create that folder, and open that folder

wp core download

wp config create --dbname=NAME_OF_YOUR_DATABASE --dbuser=root --dbpass= --dbhost=127.0.0.1

Helpful tip

Most front end developer rarely build wordpress projects so there is no need to keep Apache and Mysql always running in a background. this 2 quick bash aliases can help us quick enable/disable Apache and Mysql. But need to add it to .bash_profile file.

Reference from: https://pawelgrzybek.com/configure-a-local-wordpress-development-on-macos-from-scratch/

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Haifeng Wang
Haifeng Wang

No responses yet

Write a response