Install WordPress on Mac OS X Without installing MAMP or AMPPS from Command Line just like we do for Ubuntu or any kind of Linux. Mac OS X Lion has Apache, PHP and virtual hosts. Mac OS X looks funky in front but it is actually UNIX, so it is quite obvious that it will take almost all commands like Linux. There is no need to install any third party software like MAMP, AMPSS etc. Extra software means extra load and when we can actually configure Mac OS X like a server to run WordPress as on localhost, why we will use those junks. You can actually run any PHP MySQL based softwares, this guide to Install WordPress on Mac OS X With Command Line is a prototype example.
Install WordPress on Mac OS X With Command Line : The Basics
Basically labeling it as LAMP will be wrong, the right will be UAMP – Unix Apache MySQL and PHP. We will use iTerm2 for this guide to Install WordPress on Mac OS X With Command Line. Apache, PHP is already installed on Mac, we just need to configure to Install WordPress on Mac OS X. There is vim, nano etc.text editors preinstalled as well. Basically the only needed software is MySQL. Basically its the Windows that is abnormal. UNIX, Linux and BSD basically takes almost same commands. There is minor variation from distro to distro, like yast for SUSE/openSUSE, yum for CentOS / REHL and so on.
Install WordPress on Mac OS X With Command Line : The Commands
Just like we said before in the linked article, First open iTerm2, type :
It will ask for password, type it and hit Return key. You will be root user now.
sudo nano /etc/apache2/httpd.conf
In the above screenshot, you can see, I have used nano text editor to configure the httpd.conf file. You can open with vi (vim) command too. You need to change permission (chmod) it to edit in vim :
sudo chmod u+w /etc/apache2/httpd.conf
Otherwise you will get a read only file in vi. But in that case you have to revert back again by using :
sudo chmod u-w /etc/apache2/httpd.conf
…after editing. That is why using nano is better option.
Uncomment these lines :
LoadModule php5_module libexec/apache2/libphp5.so
Uncomment means making the directives active by removing the hash (#) and a space before them. Save it. The Include lines are for enabling virtual host and httpd-ssl. If you do not want these extra advanced setup, you only can uncomment the LoadModule (for enabling PHP) thing.
Run the four commands like above like a blind :
sudo mkdir /usr/local/include
sudo mkdir /usr/local/bin
sudo mkdir /usr/local/lib
sudo mkdir -p /usr/local/man/man1
I basically checked by going to the folder and listing (ls) them. As I do not have those folders. You will not have too, create them as I did above. Now restart Apache :
sudo apachectl restart
This is how to setup the php :
sudo cp php.ini.default php.ini
sudo chmod ug+w php.ini
sudo chgrp admin php.ini
Open php.ini file by using :
sudo nano /etc/php.ini
Edit these lines and save it :
error_reporting = E_ALL | E_STRICT
display_errors = On
html_errors = On
extension_dir = “/usr/lib/php/extensions/no-debug-non-zts-20090626”
These are only PHP and Apache native part. If you put a simple php file in /Library/WebServer/Documents ; it will load fine if you point your browser to http://localhost/ or the localhost’s IP (127.0.0.1).
Now the remaining points are MySQL and some other PHP components. MySQL can be directly installed or you can use Homebrew to get MySQL running :
brew install mysql
mysql_install_db –verbose –user=`whoami` –basedir=”$(brew –prefix mysql)” –datadir=/usr/local/var/mysql –tmpdir=/tmp
You can start MySQL server in either ways :
Change write-version-here to full version number. You can install PHPMyAdmin if you want, but probably there is no need.
Now installing the dependencies:
brew install mcrypt mcrypt-php
Please enable mycript from /etc/php.ini (in the way we enabled PHP). It will be looking like “extension=/usr/local/Cellar/mcrypt-php/…”
Setting up Pear is important.
sudo php install-pear-nozlib.phar
Open /etc/php.ini and change that include_path = to pointing towards /usr/lib/php/pear.
sudo pear channel-update pear.php.net
sudo pecl channel-update pecl.php.net
sudo pear upgrade-all
pear install MDB2-2.5.0b3
(check the version when you will install)
pear install MDB2_Driver_mysqli-1.5.0b3
Now your work toinstall WordPress on Mac OS X is almost done. It is like a LAMP server. Download WordPress and put it in /Library/WebServer/Documents. You need to create a MySQL database, the commands will be like in normal server installation like we described here in the last steps.
To know more, please visit : http://thecustomizewindows.com/