Installing drupal on Mac with Apache and MySQL

Pre-requsites: You already have Apache server and MySQL server installed on your Mac. If not, you can follow this guide to install them.

1. Download the zip file from drupal.org, unzip it and rename the folder to example. The following commands in the Terminal, creates a folder sites in your home directory, mv the unzipped drupal folder to the folder sites and rename it to example.

cd
mkdir sites
cd sites
mv ~/Download/drupal-7.38 ./
mv drupal-7.38 example

2. Create a database called example in mysql

CREATE DATABASE example CHARACTER SET utf8 COLLATE utf8_general_ci;

3. Make a copy of the default settings php file, and create a files folder in sites/default/, and give read, write and execute permissions

cd ~/sites/example/sites/default
cp default.settings.php settings.php
chmod 777 settings.php
mkdir files
chmod 777 files

4. Create example.config for adding the drupal example website to the apache server. Change yourname in the following to your max os username that appears on the Terminal window.

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot "/Users/yourname/sites/example"
    <Directory "/Users/yourname/sites/example">
        Options +MultiViews +FollowSymLinks
        AllowOverride All
        <IfVersion < 2.3 >
        Order allow,deny
        Allow from all
        </IfVersion>
        <IfVersion >= 2.3>
        Require all granted
        </IfVersion>
    </Directory>
</VirtualHost>

5. Openg the apache config file and include the config file created from the above step. If you installed apache 2.4 using brew, the config file is in /usr/local/etc/apache2/2.4/httpd.conf, open it using your favoriate text editor, add this line at the end and save it. Again, yourname is your user name.

Include '/Users/yourname/sites/example/example.conf'

6. Open the host file in /etc/hosts using your favorite text edit, add the following and save it.

127.0.0.1 example.com
127.0.0.1 www.example.com

7. Restart Apache server.

sudo apachectl restart

8. Visit example.com in your favorite browser and you shall see the drupal installation page.

9. Follow and complete the installating steps and you will have a fresh drupal installed on your Mac.

10. If you see command line messages like permission denied when running any of the above commands, just add sudo in front of the command and it will prompt you for password. As long as you have the admin right, you will be fine.

Search within Codexpedia

Custom Search

Search the entire web

Custom Search