Running Drupal on OSX

Running Drupal 7 on OSX #

This is a two-part series on developing H5P using Drupal:

  1. Running Drupal on OSX
  2. Set up Drupal 7 for Developing H5P

Step 1. Install a server #

I recommend the free version of MAMP.

Start the server with the GUI to see that it works.

Step 2. Move to the MAMP directory #

$ cd /Applications/MAMP/htdocs

Step 3. Download Drupal 7 #

https://www.drupal.org/docs/7/install/step-1-download-and-extract-drupal

$ curl -O https://ftp.drupal.org/files/projects/drupal-7.56.tar.gz
  • Drupal 7 has the h5p development folder and 7.56 is the latest version of Drupal

Step 4. Extract Drupal 7 #

Type the following command and replace “7.x” with your downloaded version’s number:

tar -xvzf drupal-7.56.tar.gz

Then remove the compressed version of the file by using the following command:

rm drupal-7.56.tar.gz

Rename the folder

$ mv drupal-7.56 drupal

Your MAMP directory should look like:

$ ls
$ drupal index.php

Step 5. Create the db #

To create a database for Drupal

  1. Go to the MAMP start page.
  2. Under “Tools”, click the link to “phpMyAdmin”.
  3. On the phpMyAdmin page, click the “Databases” tab.
  4. Under the “Create database” section, enter a name for your Drupal database in the “Database name” field.
  5. Select “utf8_general_ci” from the “Collation” drop-down (must be utf8!).
  6. Click “Create”.
  7. Look on the left-hand column under the phpMyAdmin logo and make sure that your new database is selected. If it’s not, go ahead and click on it.
  8. Select the “Privileges” tab.
  9. Under the “New” section, click on “Add user account”.
  10. Fill out these fields in the “Login Information” form:
    1. “User name” → choose a username
    2. “Host name” → field to “Local”. Leaving it as “Any host” will not allow Drupal to connect to your local database and you’ll get an error.
    3. “Password” → choose a password
  11. Leave the default settings for the remaining sections.
  12. Click the “Go” button. This creates the user and takes you to the “Edit Privileges” for this new user on the new database.
  13. Under the “Database-specific privileges” section, make sure the following check boxes are selected: SELECT, INSERT, UPDATE, DELETE, CREATE, INDEX, DROP.
  14. Click the “Go” button.
  15. Click the small home icon under the phpMyAdmin logo in the left-hand column.
  16. Click into the “User accounts” tab.
  17. Next to your new User name, click the “Edit privileges” link. This will take you to the Global settings for this user.
  18. Under the “Data” section, make sure SELECT, INSERT, UPDATE, and DELETE are selected.
  19. Under the “Structure” section, make sure CREATE, INDEX, and DROP are selected.
  20. Click the “Go” button.

The instructions for downloading and installing drupal are here:

https://www.drupal.org/docs/7/install/step-1-download-and-extract-drupal

Here are the relevant bits: https://www.drupal.org/docs/develop/local-server-setup/mac-os-development-environment/howto-create-a-local-environment-using-mamp

https://drive.google.com/file/d/1kyLZ7KUhl9kjF6vkd6C2DiuETfC0YbGV/view?usp=sharing