First step to build local environment for developing applications based on Wordpress on Mac OS

For startups, we can start few things without prototype. So the most important factor is speed in prototype phase. Honestly I don't like PHP and Wordpress but I chose Wordpress in order to develop prototype quickly.

In this blog, I introduce what I did to build local environment on Mac OS. But honestly this is bad practice but I recommend to build virtual environment for some reasons. This is just a reference.

Preconditions & technical requirement

  • Mac OS X 10.9.5
  • Control source code version by git
  • Use as same environment as possible (Cent OS 6.5, PHP 5.6, MySQL 5.5, Wordpress 4.2.6)

Add a repository of Github

I wanted to control source code version by git and wanted to execute source code review, I needed to have repository on Github.
The way is very easy and we just follow this tutorial.

git clone on local PC

Then, in order to download source code on my local PC, I git clone.
You can check URL in the right column of each repository page.
$ git clone

Install Apache, PHP, MySQL, Composer by Homebrew

Install homebrew

Only run this command following homepage of brew.
$ ruby -e "$(curl -fsSL"

Confirm installation of brew

$ brew -v

Install git

$ brew install git

Health check of brew itself

$ brew doctor

Install MySQL

$ brew install mysql


$ mysql.server start

You'd better change password of root user

$ mysqladmin -u root password

Stop MySQL

$ mysql.server stop

Install PHP

Add repositories

$ brew tap homebrew/dupes
$ brew tap homebrew/versions
$ brew tap homebrew/homebrew-php

Confirm whether or not external formula is available

$ brew search php

Install PHP 5.6

$ brew install php56 --with-apache --without-pear

Modify php.ini

You can modify /usr/local/etc/php/5.6/ if you need.

Install Apache

I got lots of troubles in this steps and honestly I gave it up...

Add repositories

$ brew tap homebrew/dupes
$ brew tap homebrew/apache

Confirm whether or not external formula is available

$ brew search httpd

Install apache 2.4

$ brew install httpd24
What we have to notice is Mac OS has default apache. Especially since Marverics, default apache is on automatically. So we must confirm apache installed by brew is working or not.
$ which apachectl
If console returns /usr/local/bin/apachectl, this means apache by brew is available. Actually my console returns this. So I started apache.
$ apachectl stop
Then contents deployed on the file path on local PC defined in httpd.conf but it was not displayed on browser!
I checked working processes with ps -ef | grep httpd and I found default apache is working. As I referred this site, I can kill all processes with this command.
$ sudo killall httpd
With this command, I could kill processes of default apache but it revived automatically!

Finally I couldn't find perfect solution against it and I gave up to build local environment with using homebrew.
The next solution was to build on virtual environment and I could successfully. In the next blog, I'll introduce how to do that.
If you liked this article

Let's subscribe the updates of Scuti!
Share on Google Plus

About Tomohide Kakeya

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment


Post a Comment