Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 UTC on 18 March 2024, to get $100 off your ticket.
Install Drush on Windows - The easy way.
Here are the complete steps you need to take:
- Install Cygwin
- Install ncurses package. You need to select ncurses manually in cygwin setup. If you miss to install this you will get an error message that tput is missing.
- Install Git package
- Install bsdtar package or you cannot restore archives and get errors like Unable to untar and Unable to extract site archive tarball.
- Install Curl package or you cannot disable modules.
- Now install Composer for Windows globally.
- Install Drush the common way. e.g. Drush 8.x (stable):
composer global require drush/drush:8.*
NOTE: Drush cannot run with GnuWin32 as it has no sh.exe support.
NOTE: Drush 9 aka the "master" branch only works with Drupal 8.
Comments
Clarification
Although this is elaborated on the issue resolution - it should be clarified here also. The PATH environment variable should be assigned by going to My Computer > Right-click any blank area inside window > Properties > Advanced tab > Environment Variables > System Variables > select PATH & edit as described.
This instruction is for Windows XP SP3 32-bit.
Thank you,
Ivan
User path on Windows 8.1 not recognized in git bash window
On Windows 8.1, for reasons I don't understand, drush 6.0 installed fine via the windows installer and ran from the DOS command window, but would not run from the git bash window. Only the system path was recognized. I added the PHP path to the system path, and it work. I removed it (leaving it in the user path), and it still worked. Perhaps some odd caching??
%* works, no need for step 4
On windows XP, %* works and accept all arguments, so I'm not sure you need to put
%1 %2...
, although setting up this would limit you to 9 arguments...Works on Windows 7 Home Premium 64-bit.
Works on Windows 7 Home Premium 64-bit.
dl not working in XP SP3
I tried this
drush dl cck
i get an alert saying libssl32.dll not found
It didnt work even after installin .dll file
Windows 7 64 bits with IIS 7.5
A little variation that works for me.
1. Added path
;C:\Program Files (x86)\PHP;C:\inetpub\wwwroot\drush;C:\Program Files (x86)\GnuWin32\bin;C:\Program Files\MySQL\MySQL Server 5.1\bin
2. For drush.bat, keep the original. No need to change anything. Although as recommend to put the full path to php.
Drush ruless !
$ drush or $drush.bat both
$ drush or $drush.bat both work on Windows
I was under the impression that I had to call drush.bat on Windows but drush works fine as an alias
~are you netsperienced?
♥ follow me @decibelplaces ∞
You may get warnings when using xampp
When using xampp on windows you may get warnings like "PHP Startup: Unable to load dynamic library (...)".
In this case look at the php.ini file (since xampp 1.7.1 in the xampp\php folder see: http://www.apachefriends.org/en/faq-xampp-windows.html#phpini).
I had to change the line 'extension_dir = "\xampp\php\ext"' to 'extension_dir = "E:\xampp\php\ext"' and do the same for browscap.
Do not forget the dependencies!
If you download the zip versions of the binary packages, do not forget to download the dependencies as well.
step 3 & 4 notes for Windows 7 (32-bit) and Drush 7.x-4.4
Step 3
Using Xampp installed at c:\xampp the PATH to PHP is c:\xampp\php
Step 4
In drush.bat I had to change
@php.exe "%~dp0drush.php" %*
to
@php.exe "%~dp0drush.php" %1 %2 %3 %4 %5 %6 %7 %8 %9
~are you netsperienced?
♥ follow me @decibelplaces ∞
Thanks for your help
Thanks for your help
Create tmp folder
I had to create C:\tmp to avoid "Fail to open stream" errors.
Success
Got it working with above instructions and a minor tweak for the batch file:
http://drupal.org/node/506448#comment-4585172
succesfull on Win 7 Professional, 64bit, Acquia stack (6.20)
Albert Skibinski - Homepage
Git
If using Git and Drush isn't finding it, add the path to Git/bin to your Path environment variable; e.g.
;c:\Program Files (x86)\Git\bin
. Then restart whatever shell you're using (i.e. cygwin).Work on Windows 7 64 Bit
This procedure also work on Windows 7 Professionals 64 bit.
My PATH
C:\drush\;C:\Program Files (x86)\GnuWin32\bin;C:\xampp\php
Thanks
Download drush location has moved to github
Although it is mentioned in top line that this tutorial was updated 16th April, the very first line in installating the hard way, Drush download url has not been corrected.
Kindly update that to GITHUB from drupal.org https://github.com/drush-ops/drush
Thanks guy above!
:)
The drush command 'status' could not be found
Hi,
I have follow all steps but again show this error blow :-
The drush command 'status' could not be found, Run 'drush cache-clear drush' to clear the commandfile cache if you have installed new extensions. function and the attempt to download this file automatically failed.To continue you will need to download the 1.1.3 package from website
Drush on windows 8.1
For my windows 8 I used the exe file to install Drush. Then I set the path like cited above in
control panel>system and security>system>advanced system settings> environment variables
And it was done. Had a few issue with a step by step installation, but the exe did the trick!
Now it's working fine Apart from a migrate thing havent quite figured out yet, but I guess that's just me ;)
sh.exe": drush: command not found
If still you're getting this error on Windows 7, then you should add this in your "Environment Variables"
C:\ProgramData\Drush;D:\xampp\php
Since, my XAMPP is installed in
D
drive, hence I've used that accordingly.Issues with pear/console_table on Windows 10
I'm making this comment in case anyone else runs into this issue.
After banging my head for a couple of days because I kept getting an error about
pear/console_table
I realized that the reason it was failing was that Composer had locked the Drush andconsole_table
files at the requirements for Drush 7.Uninstalling Drush ( via composer ) then installing Drush again loaded the proper dependencies and allowed me to update to
v8.1.8
Hope this helps someone else
How To Install Drush On Windows 10
Here is a short video of the steps I used in this thread and others + internet that helped me to install Drush for Windows 10:
https://www.youtube.com/watch?v=laYrXwmw95E
For D8 users
composer global require drush/drush:8.*
D8.4+ sites need at least Drush 8.1.15, so if you have updated to D8.4 recently - update Drush version as well.
One detail... run Drush commands via cygwin terminal from site root folder. Running Drush commands via Windows command prompt doesn't work (for me at least).
---------------------------------------------------
Drupal developer. Available for new projects
Drush issues with Windows
I had a whole heap of trouble trying to get drush to work with remote aliases, local aliases, rsync and sql-sync on Windows. I wrote blog over here about it - https://www.drupology.co.uk/blog/settings-drush-windows-pc.
Here's a copy of the post: -
The problem with Drush on Windows
Windows just isn't geared up to work with Drush out the box for things like site alises, sql-sync, rsync etc.
The Solution
Site aliases
Site alias commands involving SSH will fail on Windows because drush will use single quotes rather than double quotes. To solve this, you just need to add a os setting to the drush alias file like this: -
That's it. Now when the command is concatenated, it will know you are using Windows and use the double-quotes.
Next you'll need to add your local site alias if you plan to copy files or databases between sites. Documentation can found all over to do this. You'll need to put these into drush/sites/example.site.yml in your project's docroot, or you can put them in your home directory's site alias directory.
drush rsync on Windows
You will need to download and extract cwRsync from here - https://www.itefix.net/cwrsync. Now it doesn't work out the box. You'll have to add the path of wherever you extracted to into the windows path variables.
Next problem is (depending on your command line interpreter) rsync will see paths like c:/folder as a remote destination, so expect errors like this: -
"the source and destination cannot both be remote"
To resolve this problem, create a rsync.bat file in bin directory of wherever you extracted cwrsync to and put something like this into it: -
This simply replaces C:\ with a path that cwrsync recognises as a local path.
Now you should be able to rsync from and to your site's docroot like this: -
drush rsync @self:sites/default/files @site-alias:sites/default/files
drush sql-sync
Lastly to ensure sql-sync works you need to add the mysql path to your windows environmental variables. If you see any errors with rsych, refer to the section above to get that working first.
Conclusion
That's it I think. Reach out if you have any questions or problems getting drush to work in Windows.
P.S. It's always useful to know what's going on. Running drush with a -vvv argument dumps all sorts of useful info which can help debug and fix any issues you may be having.
Read this blog for easy installation
Follow the steps in https://modulesunraveled.com/drush/installing-drush-windows