How to manually upgrade to Drush 5.x and 6.x on Windows XP and 7

densolis's picture

Originally, this article was entitled "How to make Windows' Drush Make command work in Drush 5.7" but it has evolved into "How to manually upgrade Drush on Windows XP and 7".

The Drush Make command does not work in Windows 7 / Vista, when using Drush release 5.5, 5.6, or 5.7. There is a Drush 5.8 windows installer, which fixes the make issue. However, if you want to upgrade to drush 5.9 or 6.0, there are no installers for them. No worries. This article will provides instructions for manually installing the latest version of Drush in Windows.

Original Issue: Drush make (5.5, 5.6, 5.7) does not work in Windows

The Drush Make command does not work in Windows 7 / Vista, when using Drush release 5.5, 5.6, or 5.7. When running the command “drush make das-D7.make test-site”, I received a “drush_make_tmp_xxx being not readable or not existing” error. This is not a problem because the drush 5.8 windows installer fixes this issue!

Below is a copy of the make file , the Drush command, and the resulting error:

core = 7.x
api = 2
projects[] = drupal

$ drush make das-D7.make das-test
Source directory                                                         [error]

C:/Users/Dennis/AppData/Local/Temp/drush_tmp_1350617881_5080cb197e305/x
drupal-7.16 is not readable or does not exist.
Project drupal (7.16) could not be downloaded to                         [error]

How to manually install the latest version of Drush on Windows

I have noticed that the Drush Window Installer is always released much later than Drush on Drupal.org. No worries. This article provides instructions to manually installing the latest development version of Drush in Windows.

I resent started playing with Drupal 8 and found that Drush 6 was needed to download Drupal 8 modules. On April 25th, 2013 I updated and followed the below instructions to upgrade from Drush 5.8 to Drush 6 and they worked fine. If you have any issues, please post a comment below and I will respond. Thanks.

Regardless of which of the of the two below methods you use, you will want to download the latest version of Drush into a temporary directory. Do NOT download the Drush module into any web site!. This is because we will manually move the contents of the temporary Drush directory to the Drush program directory.

There are few ways to download the latest version of drush. You can either:

  • Issue a git clone command to clone the 7.x-5.x or 8.x-6.x branch.
  • Download the latest development version, which was released on April 25, 2013 (as of this writing).

In either case, you will need to open a git bash window. All of the below commands need to entered in the git bash windows (except where the instructions state to open Windows Explorer)

Clone the software

Open up a git bash directory and navigate to the root directory of your "C" drive. Create a temporary directory, in my case I called it das_temp. (Please remember to delete your temporary directory when you are done with this process.) You do this by issuing the following command:

cd /c/
mkdir das_temp
cd /das_temp

Once you are in the temporary directory you created above, you can issue the the appropriate git command to clone the latest drush version.

You can use Drush 5.x if you are on Drupal 6 or 7. The git command is:

git clone --recursive --branch 7.x-5.x http://git.drupal.org/project/drush.git
cd drush

If you want to run Drupal 8 in addition to Drupal 6 and 7, you should use Drush 6. Note: Drush 6 now has a beta release. You can either download the beta release by downloading the zip and unzipping it. Or you can download the 8.x-6.x development branch from the Drush git repository using the following command:

git clone --recursive --branch 8.x-6.x http://git.drupal.org/project/drush.git
cd drush

To get to the page that contains the git commands for drush, you can go to the drush version control page. The below form should appear.

Drush Version Control

Select which version you want to copy from the drop box entitled "Version to work from" and click on the "Show" button. The git command will be display in the box entitled "Setting up repository for the first time". Simply copy the git clone command from the git page and paste it into your bash window. Then run the git clone command.

Download the software

You can also download the latest development version of drush by:

  • Going to the http://drupal.org/project/drush web page
  • Navigating to the Development Releases box in the Download section of the page.
  • Clicking on the zip file that is on the “7.x-5.9” line or
  • Clicking on the zip file that is on the "8.x-6.0-beta1" line.
  • And unzipping the downloaded file to the temporary directory (C:\das_temp in my case) that you created on your computer.

Ok, I have downloaded the software - now what?

At this point you should have a sub-directory called drush in your temporary directory. In my case, the full path is C:\das_temp\drush. The folder should contain the following six directories and some files:

classes (depending upon which version you download)
commands
docs
examples
includes
lib
tests

And the following 10 files:

.gitignore
.travis.yml
drush
drush.bat
drush.complete.sh
drush.info
drush.ph
drush_logo–black.png
readme.text

Copy the files to the appropriate directory / folder

At this point we’re ready to copy this directory to its final destination. However, the files have to be copied to different directories depending upon your version of Windows (XP vs 7). Other than the program file location, the instructions for Windows XP and 7 are the same. I'm going to guess that Vista users should follow the Windows 7 instructions, but I've not tested it on Vista.

Display hidden file and directories.

Fortunately, you can un-hide files and directory with a few clicks of your mouse. Microsoft has instructions for displaying hidden files and folders for Windows XP . This link contains the instructions for Vista / Windows 7 .

If you are not a fan of Microsoft instructions, you can google either "display hidden files in windows xp" or "display hidden files in windows 7". You will find plenty of instructions.

Warning:When you unhide files, two new icons will appear on your desktop. Both of them have the same name: desktop.ini. Do not delete these icons. If you want, once you have copied the drush directory, you can turn back on hide "hidden files".

Windows XP

Per Cindy's comment (comment # 6) below, the instructions for XP are different from Windows 7 (thanks Microsoft).

In WinXP the folder to copy into is C:\Documents and Settings\All Users\Application Data\Drush. The Application Data directory is also a hidden folder. (Please see above instructions regarding hidden folders).

There is an extra folder named classes (containing one file named DrushRole.php) in the unzipped drush-All-versions-5.x-dev that was not in the download on the Windows 7 machine. I went ahead and copied it over with all the others into the C:\Documents and Settings\All Users\Application Data\Drush directory with all the rest of the folders and files.

Windows 7

The program files is C:/Program Data/drush. By default, the Program Data directory, is hidden by Microsoft. Therefore, it cannot be seen in Windows Explorer until it is un-hidden.

Install new version of drush

You will need to move (or copy) your temporary Drush directory from your temporary directory to C:/ProgramData directory. However, you should either rename or delete the existing C:/ProgramData/drush directory before you replace it with the new Drush directory. You can do this the directory by:
cd

  1. Open Windows Explorer
  2. Navigating to the C:/ ProgramData directory.
  3. Locate and delete (or rename) the exiting Drush sub directory.
  4. Move (or copy) the Drush directory you placed in the temporary directory to C:/ProgramData/Drush.

Congratulations - You have now installed the Drush 6 development on your computer!

To test it, enter the following command and you should get the following results:

$ drush status
PHP configuration     :  C:\Program Files (x86)\Drush\Php\php.ini
Drush version         :  6.0-dev
Drush configuration   :

Credits

This articles is based upon help provided by moshe weitzman and sylus. The original issue can be found on the Drush issue queue.

AttachmentSize
ScreenHunter_66 Nov. 02 09.29.jpg24.16 KB

Comments

Drush documentation page?

ultimike's picture

Dennis,

This is a nice article - why not post it as a sub-page of the Drush documentation (https://drupal.org/node/477684)?

It seems to me it would get a lot more exposure there...

-mike

greg.1.anderson's picture

However, Drush 5.8 should also fix the problem described at the beginning of the article, once it is released. It would therefore be good to retitle and change the intro to "how to install the latest version of Drush on Windows" when putting it in the handbook.

Drush 5.8

densolis's picture

Very good point about the title. I don't believe that "Drush make" windows will ever work in Drush 5.7 since the dev version already has it fixed. Per your suggestion, I did change the introduction.

I agree, I should re-title. I just need to figure out the new title.

That is my next step.

densolis's picture

Mike, Ben

That was going to be my next step. I was walking someone through the process today and just needed to get it published somewhere so I could test the instructions.

But now that point it out, I should have just put it on the Drush documentation page first and put a link to it here.

Good point.

Great job on this. It seems

bhosmer's picture

Great job on this. It seems you've figured out a solution to a lot of people's problems. This would make a nice addition to the drush documention.

Notes for Windows XP

cdykstra's picture

I just wanted to note two things Windows XP users may find different:

  1. In WinXP the folder to copy into is C:\Documents and Settings\All Users\Application Data\Drush. The Application Data directory is a hidden folder also, so see densolis' instructions above to see hidden folders.

  2. I found an extra folder named classes (containing one file named DrushRole.php) in the unzipped drush-All-versions-5.x-dev that was not in the download I did to my Windows 7 machine. I went ahead and copied it over with all the others into the C:\Documents and Settings\All Users\Application Data\Drush directory with all the rest of the folders and files.

Notes for Windows XP

densolis's picture

Thanks for the update on WinXp!

For simplicity, here is the link for for displaying hidden files and folders for Windows XP.

The Git Location is incorrect...

tadiou's picture

they stopped developing out of master.

Drush 5.8, but no Drush 5.8 Windows Installer yet

densolis's picture

tadiou - Thanks for the update!

Drush 5.8 was released on November 12, 2012. However, there does not appear to be a Windows Installer 5.8 yet. Therefore these instructions still apply - with the exception of the clone command. I edit the original article and changed the clone command. I will also change my article in the drush documentation.

Drush 5.8 to 6.0-dev Windows 7 manual install

JSCSJSCS's picture

After using the windows msi installation for 5.8, I needed to upgrade to the 6.0-dev version to submit a patch. I followed these instructions and got an error with drush status:

$ drush st
ERROR: can't find php.

No drush commands would work ~ in any directory.

I compared old and new drush directories and files. The new version added a classes directory with one file (DrushRole.php).

I did notice that a file called simply 'drush' in main directory was a different size and compared them. It seemed this was an important file, so I swapped the new with the old.

The errors went away. However, I went back to the new version of the file and tried running drush in the windows command prompt instead of my usual Git Bash shell and it ran fine. So the problem must be with the Git Bash that is download with Msysgit window installer is not compatible (YET?) with the 6.0-dev version.

James Sinkiewicz
Drupal Site Builder and Generalist
http://MyDrupalJourney.com

Typo in drush repo address

h4rrydog's picture

I believe that there is a typo in the drush repo address. It currently says:

http://git.drupal.org/project/drush.git/drush.git

but should be:

http://git.drupal.org/project/drush.git

Thanks!

Share your knowledge.

Oops - typo fixed

densolis's picture

h4rrydog,

Thanks for catching that. I have fixed the above documentation.

JSCSJSCS,

Sorry it took me so long to respond. I missed your response, but saw h4rrydog comment.

As I understand it, you can run drush in your windows command prompt window (aka DOS box), but not in the git bash window. I suspect this is a path issue with the git bash window.

Can you please go to the git bash window and enter the command "PATH" (with out the quotes). (Click here for a explanation of the DOS Path command). Then do the same thing in the git bash window.

Somewhere in the big long string that is displayed, you should have the following three directories.

;C:\ProgramData\Drush\;C:\Program Files (x86)\Drush\GnuWin32\bin;C:\Program Files(x86)\Drush\Php;

If you do not have ALL THREE in BOTH paths, then that is your problem. Here are a couple of articles that tell you how to update the Windows Paths:

  1. Mathworks - How do I set my system path under Windows
  2. How to set the path in Windows 7

Please let me know if this resolves your problems.

Dennis

Update the article on April 25, 2013

densolis's picture

I need to upgrade to Drush 6.0 on my machine. So I followed the above upgrade instructions. I notice a few explanations were a little fuzzy, so I try to explain them better. I also notice a new directory (classes) has been added to the drush directory, so I included that in my instructions.

As of April 25, 2013 the above instructions were working. The drush maintainers are constantly improving an release new products so these instructions will need to be modified as time goes on.

If you have any suggestions for improving the above article, please let me know. I have made quite a few improvements based on the above comments.

Good luck and I hope this helps you.

Dennis

Thanks

acmaintainer's picture

Updated to 5.9. Worked like a charm.

Florida

Group organizers

Group categories

Group events

Add to calendar

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: