Installing Drush on Win 7 so it runs in a Git Bash Window

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
densolis's picture

All,

I noticed that quite a few people in the Drupal Easy Career Starter Program could not get drush to work in their git bash windows.

This is because the software was not installed with the correct option! When you install drush using the Drush 5.7 Windows Installer, the attached screen will appear.

If you notice, there are three boxes that are "X" out. The second box / line is titled "Register Environmental Variables". You should un "X" this box. When you click on this box, you will receive a drop down menu. Choose "Will be installed on local hard drive".

Then proceed with the installation.

The Register Environment Variable with update the Path so that git bash knows where to find the drush programs.

You can also fix this problem after you have installed drush. Note: I've only tested this with Drush 5.7. It may work with other version, but then again - the required path maybe different on other versions. However, the technique will be identical - you will just need to determine the drush path.

To fix this, click on Start and then right click on My Computer or Computer (same thing). Then choose Properties from the menu.

When the Windows' System Control Panel opens, click on Advance Systems Setting (top left hand corner). The System Property window will open and the Advance tab will be active.

Click on Environmental Variables, which is at the bottom of the Advanced Tab page. The Environmental Variables window will not appear.

There are two sets of Environmental Variables. DO NOT CHANGE THE SYSTEM VARIABLES. You can break a lot of stuff!!

You want to change the User variables, which appear in the top portion of the Environment Variables window.

If the environment variable PATH already exist, then edit it, add a ";" to the end of the current line, and paste the below path onto the end of the existing path string that is in the Variable value text box.

If it does not exist, then add it via the New button and simply paste the below path (without the starting ;) into the Variable Value text box:

C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\ProgramData\Drush\;C:\Program Files (x86)\Drush\GnuWin32\bin;C:\Program Files (x86)\Drush\Php

Then click OK and close all of the windows we just opened, including the git bash window if you have it open. Open a new git bash window and enter the drush command:

drush status

You should get something like:

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

If you receive some other message, then the above did not work. At this point, either figure out the error or simply uninstall and re-install drush using the above instructions.

Dennis

AttachmentSize
ScreenHunter_63 Oct. 19 00.08.jpg51.54 KB
ScreenHunter_64 Oct. 19 00.11.jpg51.25 KB

Comments

Thank you for posting this.

lscook's picture

Thank you for posting this.

Dennis, this is great. I

bhosmer's picture

Dennis, this is great.

I wonder if adding it somewhere here in the drupal.org git documentation might also be beneficial for an even wider audience.

8k limitation on Path in XP / W7 - 2k in Windows 2000

densolis's picture

All,

The issue

I was reading the Drush Installation document at drush.org / drush.ws. I believe sections of it are quite out of date. It states there is a 2k limitation on the size of the Path environmental variable.

Summary

Windows XP and forward has a 8k limitation on the size of the Path environmental variable. This is should not be an issue anymore.

Full Explanation

If you read Microsoft Knowledge Article KB830473, you will see that this limitation applies to Windows 2000 or Windows NT 4.0. This limitation was increase to 8191 characters in Windows XP! Therefore, unless you have a LOT of stuff in system or you are still on Windows 2000 / NT, this should not be an issue.

If you are concerned about the length of your Path, you can go to Start >> My computer (right click) >> Properties >> Advanced system setting >> Environmental variables. Once there, you can copy the Path variable from your User variables and System variables into you favorite text editor and figure out the length of the two variables. I have about 50 programs installed and the length of my path is only 901 characters, well under both the 2k and 8k limitations.

You may ask why is the path so small given the 50 program. Well, the answer is most windows programs do not use the Path anymore. Instead, they register themselves in the dreaded Windows Registry. The path is used by DOS based programs, of which there are not many. However, both git and drush are DOS based / command line programs.

8k limitation on Path in XP / W7 - 2k in Windows 2000

densolis's picture

All,

The issue

I was reading the Drush Installation document at drush.org / drush.ws. I believe sections of it are quite out of date. It states there is a 2k limitation on the size of the Path environmental variable.

Summary

Windows XP and forward has a 8k limitation on the size of the Path environmental variable. This is should not be an issue anymore.

Full Explanation

If you read Microsoft Knowledge Article KB830473, you will see that this limitation applies to Windows 2000 or Windows NT 4.0. This limitation was increase to 8191 characters in Windows XP! Therefore, unless you have a LOT of stuff in system or you are still on Windows 2000 / NT, this should not be an issue.

If you are concerned about the length of your Path, you can go to Start >> My computer (right click) >> Properties >> Advanced system setting >> Environmental variables. Once there, you can copy the Path variable from your User variables and System variables into you favorite text editor and figure out the length of the two variables. I have about 50 programs installed and the length of my path is only 901 characters, well under both the 2k and 8k limitations.

You may ask why is the path so small given the 50 program. Well, the answer is most windows programs do not use the Path anymore. Instead, they register themselves in the dreaded Windows Registry. The path is used by DOS based programs, of which there are not many. However, both git and drush are DOS based / command line programs.

windows path

thomaske's picture

Dennis,

good info. thanks. never thought I'd have to deal with PATH issues, again. That's almost prehistoric

I think you're still having issues with the site -- I got three copies of this message -- at 7:16, 7:17 and 7:30

It's not a problem, just wanted to let you know.

tk

Awesome - thank you

redrider's picture

Awesome - thank you

Drush install

magellen's picture

Thanks oh great mentor! Even I can do it with this cheat sheet.

Florida

Group organizers

Group categories

Florida Topics

Group notifications

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