Skip to main content

Configuring drush on Mac OS X Lion

I downloaded the drush from the drupal website at I downloaded the 7.x-4.5 version -  I was using mac os x and if you are also using mac os or any other flavour of linux - you should download the tar.gz file. 

Drush works best on linux/mac os x - it works on windows as well but has its limitations, although things are improving but you will need to install additional software that allows you to use many drush functions. If you are interested to look at how to install drush on windows then have a look at I did install on my old windows pc as well, got most of it working.

Coming back to the topic, we are installing on mac os x - so here goes.

The accompanying readme.txt file is quite good in showing what is required, and it really is straight forward. Albeit there are a few differences and may be you would like to customise your installation a little bit - but this is what i did.

The first step was to download and extract the drush-7.x-4.5.tar.gz file to a folder out of web root as recommended.

Then make 'drush' executable, I installed drush in my home folder hence my command to make drush executable was

chmod u+x ~/drush/drush

a quick jump to ~/drush folder and enter drush at the $ prompt, as you have made drush executable your should see drush options, a good way to learn options is to use drush help.

if all is fine, we can create a symlink to /usr/bin so that drush is always in the path. The command to do this of course is 

ln -s ~/drush/drush /usr/bin/drush

you may require sudo access so prepend sudo to the above command.

Thats all, i tried drush and all worked swell! I was able to download drupal, install modules, enable/disable modules and everything. I hit a block when i was trying site-install option.Drush has a powerful option that lets you install a new site from the command prompt itself, and it is extremely fast.

The usual syntax for site-install is as follows

drush si standard --db-url=mysql://root:xxx@localhost/dru7 --site-name="Drupal Example"

I got an error which was 

sh: mysql command not found.

Thankfully it was an easy fix, it was because though mysql was installed and working, mysql was not working from the path where drush was installed. so symlinking to the rescue i did the following

ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql

Thats it - all working fine now and i am enjoying working with drush.


Popular posts from this blog

Create a drupal development environment using docker.

Currently at work i am using docker to streamline and speedup of development and deployment to testing and production, I am using symfony currently and our app is dockerised, i wanted to do the same for drupal based apps.

I searched for a official drupal docker repo and i did find this.

Unfortunately there was very terse explanation but pretty much worked, i found a few hiccups along the way so wanted to share what i did.

Install docker for your environment. Lots of details are available at explaing docker and installing docker for your environment.

The docker repo holds the drupal container at, following the instructions this is how to create the drupal container:

In order to use my code base we need to mount the volume with the -v directive as below, we do this in one command:

docker run -v /$HOME/work/drupal8:/var/www/html -p 8080:80 --name mydrupal -d drupal

this will create…

Use feeds module to import XML data in Drupal 7

Recently i had to setup a xml import process to import data from an external supplier on a regular basis, the filename and format was not changing and i could choose where to store the file. Following is how i set it up.

First we need to download the following modules

feeds admin ui

enable the above modules.

We will need a sample XML so this will be the one we will use for this demonstration:

<?xml version="1.0" encoding="utf-8" ?>
<!-- Sample for demonstration of processing XML feeds with feeds module -->

How do you expose your legacy database tables to views in drupal 6 Part 1

This is a 2 part post, that shows how I exposed a legacy table to views in drupal and used the incredible power of views to create many combinations static and conditional views. This was very helpful for my client.

I had a requirement that warranted exposing existing database table to views, so that views can contain data from this table.  To enable this to happen, the following steps need to be taken.
In a custom module you need to first define the views_api hook as following:
function candidate_views_api(){ $view = array(); $view = array('api' => 2, 'path' => drupal_get_path('module','candidate'). '/views'); return$view; }
candidate module was a custom module which I already had, so it made sense to add this hook here. 
The important bit here is telling the drupal sub-system where the views file will reside. 
Then create a file with your <modulename> in my case it was, this file should have two hooks, one …