Drush Your Drupal Development: Install and Get to Know Drush Quickly!15 Nov · by Tim Kamanin · 3 min read
I have been omitting Drush for a long time because of being too busy to spend time on another new feature. But here is what I'll say you: I can't excuse myself for escaping Drush since I've discovered it. This is so huge time saver for any Drupal developer and you just can't have a right to escape it. So if you still don't know what the Drush is or don't have it installed on your development machine read this short Drush Windows installation and usage tutorial.
What is Drush?
Drush - is a shell/command line installator/modificator swiss army knife for Drupal. It helps you to quickly download and enable/disable modules, drupal packages, launch cron, reindex site, clear caches and more. It saves time. A lot of time. Point.
Is it hard to install Drush?
Not at all. Below I will show you how to do this on Windows machine:
Drush installation on Windows:
1. Download Drush itself and unpack it to C:/Drush (Download from here: http://drupal.org/project/drush)
2. Download these four files and install them in folders, on request always click 'Yes' and 'Next', this is simple:
3. Use bsdtar for tar. People say it's more reliable. Copy the file C:\Program Files\GnuWin32\bin\bsdtar.exe to C:\Program Files\GnuWin32\bin\tar.exe
4. Now set Windows PATH environment variable to include drush and binaries installed above. You can reach Windows PATH settings by going this way: Control panel - > System -> Advanced System Properties -> Advanced Tab -> Environment variables. In the Environment Variables window you will notice two columns User variables for a username and System variables. Scroll down System variables until you notice PATH variable. Click it to edit, Add to the end of the PATH line something like this: C:\drush;C:\Program Files (x86)\GnuWin32\bin Don 't forget to separate each property with a semicolon ";" Make sure you have your php installation path added here, if not add it too.
5. Now launch Windows Command Line ( Start - > Run -> cmd.exe)
6. Navigate web projects folder with command line (using cd command) and enter command:
drush dl drupal-6.19
This will download and unpack latest Drupal package to your web server folder. All the content now is in drupal-6.19 folder. You can rename this folder the way you want.
7. Install drupal as you usually do.
~~8. In the sites/all folder create modules folder and themes folders, then inside modules folder create 'contrib' folder.~~ This step is not needed, Drush will make everything for you. What a clever piece of code!
9. Now in command line tool, staying inside your web project folder (on any level), type command:
drush dl views
This will download Views module and automatically unpack it to sites/all/modules/contrib folder. You can enter the command even like this:
drush dl views cck admin_menu
and it will download and unpack all three modules in one go. Same approach works with themes: command
drush dl zen
will download and extract Zen theme to sites/all/themes folder
9. Time to enable downloaded modules: type command
drush en -y views admin_theme
and press enter. Now modules are enabled from command line! Whoa!
10. Let's count how much precious time can we save thanks to Drush! Do you still want to work without Drush after that?
Of course this is just the beginning of Drupal Dojo. It has lots of features and cool tricks to offer. I showed you basics and now you're on the path of light and once installed and tried Drush you won't be able to imagine your Drupal development life without it. See below several lists with more cool Drupal Drush commands:
- Drush commands reference: http://groups.drupal.org/node/28088
- Drupal Cheat Sheet (in .pdf): http://drupal.org/files/drush-cheat-sheet.pdf
- Drush 3.0 Beta 1 Cheat Sheet (in .pdf): http://groups.drupal.org/files/drush-cheatsheet.pdf
If you've already discovered Drush tell us here how Drush changed your life as a developer.