How should I install Drush on WSL when running the following command shown in the Drush documentation fails?

php -r "readfile('http://files.drush.org/drush.phar');" > drush
  • 1
    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, 2016 at 11:34

1 Answer 1


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.

  • Yes, Drush is installed on WSL in the same way it's installed on Linux. I would add that the Drush installation instructions now suggest to avoid installing it globally.
    – apaderno
    Jul 13, 2022 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.