MAMP (Mac, Apache, MySQL, PHP) is the first go to solution for anyone developing anything web based on your Mac. Even more so as Apple removed the easy controls to enable ‘web sharing’ as it was called in 10.8 Mountain Lion. 

I had wanted to use WP-CLI - which is a set of command line tools for WordPress, only that they don’t install / like MAMP. Which means, now is the time to replace MAMP with my own stack.

 

Apache

Apache is installed on your Mac in 10.8 Mountain Lion - it’s just probably not running.

Open Terminal and enter the following

httpd -v

The version installed on a Mac is 2.2.22

to start it

sudo apachectl start

to stop it

sudo apachectl stop

to restart it

sudo apachectl restart

 

After you’ve started it, just head to http://localhost

Document Root 

By default, the Apache web pages are stored in

/Library/WebServer/Documents

 You’ll want to change this. So follow the linkage or look up Mac osX and VirtualHosts

 

VirtualHosts and VirtualHostX

If you want to have more than one local domain  (live wild) think about having a host for dev.local & staging.local, then you’ll need VirtualHosts.

The easiest app to use is VirtualHostX, then right the Setup Wizard. It’s free for 15 days so that should be long enough to setup your Vhosts.

VirtualHostX

 After that, you can create all the VirtualHosts you want  (something you couldn’t easily do with MAMP lite). 

 

MySQL

Is a little bit harder - you need to download and install it.

Head to http://dev.mysql.com/downloads/mysql/

Download the Mac version

Open the installer pkg files and run the Installer and when its done double-click on the Pref Pane to install it (In my testing, you don’t need to run the Startup pkg installer if you install the Preference Pane).

MySQL

From System Preferences, you can start MySQL and set it to run at boot … do that 🙂

 

Set Root Password

(or MySQL won’t work)

/usr/local/mysql/bin/mysqladmin -u root password 'yourpasswordhere'

 

Fix MySQL Unable to Connect Error

There is a bug in Mac OSx and the MySQL install location is not correctly linked.

You’ll confirm this, if you try to run a WordPress setup so ..

sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

That’s fixed - now you can go try to install / setup WordPress or whatever.

 

SequelPro

Now that you have MySQL running, you’ll want to launch SequelPro and create MySQL database.

Remember to use the Root user and the Password you set 🙂 

SequelPro

 

PHP

PHP is also on your Mac but not running.

Open Terminal and enter

sudo nano /etc/apache2/httpd.conf

(I prefer Nano - you can use Vi or whatever you prefer)

 Ctrl W to search

Look for php5_module

Remove the Hash # from the start of the line

Ctrl X to Exit

Yes to Save

sudo apachectl restart

Linkage

Setup Apache, PHP and MySQL - http://coolestguyplanettech.com/downtown/install-and-configure-apache-mysql-php-and-phpmyadmin-osx-108-mountain-lion

How to set VirtualHosts in Mac http://coolestguyplanettech.com/downtown/how-set-virtual-hosts-apache-osx-108-mountain-lion

WP-CLI http://wp-cli.org/