Installing Drush on Windows

Jocelyn's picture

With Drush you can greatly reduce the amount of time needed to setup and upgrade your Drupal installations - even if you're not a command line expert. If you haven't used Drush yet, you've probably at least heard of it.

This walkthrough will list the steps to get Drush setup on Windows. I'm using WAMP for my localhost. If you're using something else some of your paths might be different, but the setup process is the same.

Drush is a command line shell and Unix scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.

To learn more about getting started with Drush, watch the screencast Drupal School: Jumpstart with Drush and Command Line.

Get Drush

Download the Drush project from drupal.org.

Where to Install Drush?

Drush is not a module, not specific to a Drupal site or Drupal version (5.x, 6.x...). While you can place it in sites/all/modules, it makes more sense to install it outside of your Drupal directory for example in C:/ or C:/wamp/www.

Installation on Windows

  1. Install additional applications:
  2. Use bsdtar for tar, it's more reliable. Copy the file C:\Program Files\GnuWin32\bin\bsdtar.exe to C:\Program Files\GnuWin32\bin\tar.exe

    http://drupal.org/node/594744

  3. Setup PATH environment variables for Drush, PHP, and tar/get/wget binaries installed above:

    Control Panel > System > Advanced System Settings > Environment Variables

    Select Path and click Edit.

    Append your paths (separated by semicolons) to php.exe, drush.bat and tar/get/wget binaries to the Path Variable value. This field is not so usable as a textfield. You'll probably want to copy the existing value to a text editor, append your new entries and paste everything back into the field.

    You're paths should look something like this, but they may be different depending on your setup.

    ;C:\wamp\bin\php\php5.3.0;C:\drush;C:\Program Files\GnuWin32\bin

    MySQL Path

    Check to make sure your Path variable includes the path to the folder containing mysql.exe. While this isn't necessary to use Drush, being able to use MySQL via the command line comes in handy.

    ;C:\wamp\bin\mysql\mysql5.1.36\bin

    Environment VariablesSystem Properties

    Edit Path System Variable

    If you have an open command window, you will need to reopen it to refresh your path variables.

  4. Edit drush.bat located in the root of your Drush folder to include the full path to your PHP installation.

    @C:\wamp\bin\php\php5.3.0\php.exe "%~dp0drush.php" %*

Testing your Drush Setup

Open the Command Line, type drush or drush --help and hit enter. If installed correctly you should see a help listing of Drush commands.

Drush Command Line

Comments

rRishanAladd's picture

comment_body[und][0][value]

Purna's picture

Very Nice tutorial...

Thanks a lot!

Brandon Beeler's picture

Anybody know what i'm doing wrong based of this error i'm recieving after i type drush:

Uncompressing C:\drush/lib/drush-library-2046223423.tar.gz using the [error]

gzip command failed.

kenneth's picture

I could not get the 2nd point "Use bsdtar for tar, it's more reliable. Copy the file C:\Program Files\GnuWin32\bin\bsdtar.exe to C:\Program Files\GnuWin32\bin\tar.exe"
both are in the same directory

Venky's picture

I followed the instructions, But no success http://drupal.org/node/1357718, I am getting "install profile-error unknown options:--prepare-install,--working-directory "
Can you please help me ?

Mark's picture

"Command Prompt shell optimized for Drush" is all that appears when I go to the Windows 7 Pro command prompt. If I start a Drush prompt. When I execute a command like "drush dl drush_make-6.x-2.3", I get "Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 24576 bytes) in D:\ProgramData\Propeople\Drush\includes\bootstrap.inc on line 913"

Any ideas what may be wrong?

Thanks.

kasiawaka's picture

This is an awesome post but I struggled with drush make (drupal.org/projects/drush_make) configuration.
Finally got it working following instructions from http://drupal.org/node/1260084
especially part where the drush_make is downloaded:
(type in command prompt): drush dl drush_make-6.x-2.3 (project drush_make contains 0 modules - OK) - will download drush_make in C:\users\user_name\.drush

That was the crucial piece I was missing, the drush_make should be in the users\my_windows_user directory, under .drush (notice the dot in front of .drush folder name)

Anonymous's picture

oooook... what if you drupal installation isn't local and you are starting out with drush... how do I connect drush to the online installation

Samuel's picture

Great resource. God bless you for such a wonderful step-by-step tutorial.

Jayakrishnan J's picture

Was dying to install Drush for very long time. Didnt know its this easy.. May be the blog made it very easy :) Thanks Jocelyn

Anonymous's picture

You Beauty!
The only slight difference I had was in point 4 I didn't need to change anything as it was already pointing to php installed with drush.

Anonymous's picture

The best around!

mephy's picture

nice tutorial works like a charm

Sammo's picture

So, I think I did everything correctly... but I'm getting this message on the command line:

drush
'C:\wamp\bin\php\php5.3.4php.exe' is not recognized as an internal or external c
ommand,

I apologize for my "newbiness" if this is an obvious mistake... but does anyone know what the problem is?

Sammo's picture

Nevermind! I found it, it was just a missing '\' in the path in the drush.bat file. Sorry... now I feel like an idiot =/ Anyway, thank you so much, this was a great tutorial!

Albert Skibinski's picture

For anyone getting a php5ts.dll missing error and using acquia stack:
http://drupal.org/node/506448#comment-4585172

Anonymous's picture

Thank you for posting this! :D It's just what the doctor ordered.

Paul McCrodden's picture

Drush_make on Windows...
Put drush_make in the following location:
drush/commands/drush_make

Paul McCrodden's picture

For those unfortunate Windows user (myself include at the moment). Put drush_make in the following location: drush/commands/drush_make

Julian Mancera's picture

Very nice, ages waiting to get this to work!!!!

Jean-Rémy Duboc's picture

Thank you SO MUCH for this ! I've been looking for a simple way to get Drush to work using the Windows command line (Powershell), and you wrote the first one that ACTUALLY WORKED !

Joshua Riddle's picture

I get the help screen fine but ...
Unable to download drupal-6.19.tar.gz to C:/wamp/www/ from

http://ftp.drupal.org/files/projects/drupal-6.19.tar.gz
An error occurred at function : drush_pm_download

when i use the drush dl command - any suggestions?

Anonymous's picture

Any tips on how to install drush make

wonkenstein's picture

That's awesome, thanks for the guide and to Seb for the 'Console_Table' not found error fix.

Had to set this up on a windows box after having to move from a mac setup.

Anonymous's picture

Great instructions. Worked first time for xampp just changing paths where necessary. Thanks!

Primsi's picture

Great, you helped me lots.

Peter's picture

Great, just what I needed.

Thanks!

Seb's picture

for those who get the error message ""Class 'Console_Table' not found"

go to comment #3 on http://drupal.org/node/563170. Works like a charm!

Thanks for this post Jocelyn!

jsang's picture

nice installation guide...
thanks!

Ari's picture

MMmmmuah! muchas gracias :)

Add New Comment