How do you install Drush on WSL (Windows Subsystem for Linux) when the following command from Drush docs, doesn't work?

php -r "readfile('http://files.drush.org/drush.phar');" > drush
  • It would be very helpful if you included the error message as there might be several reasons why the command didn't work. – hansfn Jun 22 '16 at 11:34
  • "I think it was 'invalid operation'". – JohnDoea Jun 23 '16 at 9:58
sudo wget http://files.drush.org/drush.phar
sudo mv drush.phar /usr/local/bin/drush
sudo chmod +x /usr/local/bin/drush
# test drush by executing:
drush status

Note_1: For possible future releases --- If there will be non-Ubuntu version of WSL you might need to download the wget Linux utility to use it for downloading drush.phar.

Note_2: To those who have yet to install WSL - See this thread.

|improve this answer|||||

Better to follow this to require with composer: https://www.drupal.org/node/1248790

  1. Install composer globaly:

    $ curl -sS https://getcomposer.org/installer | php

    $ sudo mv composer.phar /usr/local/bin/composer

  2. Require drush:

    composer global require drush/drush:7.*

The instructions in drupal.org also show how to add the path so you can use drush from everywhere.

Im working with WSL and it works great.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.