Run Drupal locally on your Mac

Drupal on your Mac

Drupal is becoming a highly popular CMS and several readers requested for help with installation on their Macs. You can test and build a Drupal site locally on your Mac without the need for a hosting server.

There are many ways of installing Drupal and I’m trying to come up with the simplest solution for you, so I packaged all the needed files into one downloadable package and put together a step by step tutorial. The installation altogether will take around 15 minutes in total.

Please feel free to correct me or further simpify the process. I’ve written about this subject before, but that was a bit too complicated for some and it didn’t touch up on Drupal. Hopefully this time it’s going to be easier.

  1. Download this package which includes all files you will need in step two, three and four.
  2. Update PHP by running the installation file for Entropy-PHP-4.3.10-1. PHP is installed on OS X by default, but you may want to update it. This is the programming language that will run your web site.
  3. Install MySQL: CompleteMySQL-4.0.21. MySQL doesn’t come with OS X. This is the database engine that will serve your site with data.
  4. Drag the MySQL.prefPane from the mounted volume to your System Preferences pane to add.
  5. Open your new System Preferences called MySQL and click Initialize. You will need to put your MySQL password, which is not set at this stage, so just press Enter and then you will need to put your admin password. Once it’s finished, you can click Start.
  6. Install CocoaMySQL-v0.5. This is free OS X application that will help you manage your databases. Put it into your Application folder.
  7. Switch on Personal Web Sharing in your System Preferences/ Sharing/ Services pane. This will start the built in Apache server on your Mac.
  8. Copy the Drupal folder into your /Library /Webserver/ Documents/ folder. (Main root directory, not under your user.)
  9. Open CocoaMySQL and enter host:localhost and user:root. Leave the rest empty.
  10. Click the little icon on the left with a plus sign to add a new database and enter: drupal.
  11. Now still in CocoaMySQL go to File/ Import/ CocoaMySQL dump and select this file: /Library /Webserver/ Documents/ drupal/ database/ database.mysql. This will populate your new database with the essential data to run your Drupal site.
  12. Open your browser and type http://localhost/drupal.
  13. Register the first user, which will be the administrator user on your local site. It doesn’t matter what email address you enter. Once you are logged in change your password to something you can easily remember under the edit tab.

Now you can start adding content and exploring the different features of Drupal.

Optionally you may want to add a password to your MySQL. You can do that in the MySQL system preferences by clicking the Set Root Password. Once you set it up you will need to open a file: /Library /Webserver /Documents /drupal /sites /default /settings.php and find the line that starts as $db_url = 'mysql://root: and enter your password right after it and just before the @ sign. Save.

To password protect your whole site you can follow these directions