You are here

Installing Drupal 7 on a Local Mac

1.  Download Drupal 7

from drupal.org

 

2.  Install Drupal

in Sites, or in Library/WebServer/Documents.  Access the former as http://localhost/~username and the latter as http://localhost.

 

3.  Turn on Web Sharing

Open System Preferences / Sharing, turn on Web Sharing.

 

4.  Make sure php can run.

Edit your /etc/apache2/httpd.conf and make sure this line is not commented out:

LoadModule php5_module libexec/apache2/libphp5.so

(In an OS X Server install, Open Server Admin / Web / Settings / Modules /  and enable php5_module.)

 

5.  Restart Apache.

If you made changes to the Apache config file above, re-start Apache:

% sudo apachectl restart

 

6.  Download MySQL

from http://www.mysql.com/downloads/mysql/

 

7.  Configure MySQL

per the instructions here.  This tells you how to do the install, create an XML launchd config file, create a MySQL config files that is appropriate for OS X, with the right path, and start up MySQL.  The startup didn't work until I changed some permissions.  I think I did:

% sudo chmod 666 /usr/local/mysql/data/*logfile*
and maybe
% sudo chmod 775 /usr/local/mysql/data

or something like that.  Then I started it by hand:

% /usr/local/mysql/bin/mysqld_safe

 

8.  Assign root passwords.

By default, MySQL root passwords are empty.  More info here.  Set root passwords:

[Scottys-MacBook-Air:local/mysql/bin] scotty% !30 -u root
mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.28 MySQL Community Server (GPL)
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Freeer2');
Query OK, 0 rows affected (0.00 sec)
mysql> 
% /usr/local/mysql/bin/mysql -u root
Welcome to the MySQL monitor.  
[snip...]
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpassword');
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT User, Host, Password FROM mysql.user;
+------+---------------------------+-------------------------------------------+
| User | Host                      | Password                                  |
+------+---------------------------+-------------------------------------------+
| root | localhost                 | some-encrypted-password |
| root | Scottys-MacBook-Air.local |                                           |
| root | 127.0.0.1                 |                                           |
| root | ::1                       |                                           |
|      | localhost                 |                                           |
|      | Scottys-MacBook-Air.local |                                           |
+------+---------------------------+-------------------------------------------+
6 rows in set (0.00 sec)

Now set the rest of the root passwords using the same command.

Be careful if you are doing this on an existing install instead of a new one!  There is only one root user for all databases in a MySQL instance, and changing an existing root password may cause other sites with a different root password not to be able to access their database, and return a "site offline" error.  Instead, consider creating a different admin user than root.

 

9.  Create a new database.

Create new database named  "scotty":

% mysqladmin -u root create scotty -p
Enter password: 

 

10. Run the Drupal installer.

Run the Drupal installer from a browser. This assumes the Drupal folder is in the Sites folder and is called drupal-7.17.

http://localhost/~scotty/drupal-7.17/install.php