Digital Media Insights for Business Owners

Applying Patches in Drupal on your Mac via Terminal

Quick little tutorial here. Let’s get to it. Let’s say that you have a Drupal website running in your web server in your Mac -for example with MAMP. And lets say that you have installed a couple of contributed modules manually or through Drush. However, the module developer found a bug and fixed and instead of updating the module itself, they decided to issue a patch for you to apply.
Now you may ask, that is great stuff, but how do I install the patch for that particular module? Don’t worry it is simpler than you may think.
1. Find the URL of the patch.
The first step is to find where the patch resides. Sometimes this is going to be directly in drupal.org path.

2. Open up Terminal in your Mac and navigate to your Drupal installation.
3. Drill down to the module’s directory, if it is a core module you are about to patch, or to the sites > all > modules folder if it is a contributed module.
4. Navigate to the folder of the module and type the following command:

curl -O http://www.drupal.org/the-location-of-the-patch.patch

5. This command would download the patch to the same directory as your module.
6. Then to apply the patch simply type the following command:

patch < the-name-of-the-patch.patch

That’s it. Now you should see the application of the patch in your command line, and you are done and set.

I hope this helps everybody out there wanting to learn how to apply patches in Drupal in your Mac OS X terminal.

Say: "Hola" to your new clients.

Follow us on Social Media for more Tips & Tricks.

Other Posts You May Enjoy