Easily Install Drush with a Phar

Greg Anderson, Open Source Contributor Reading estimate: 1 minutes

Composer has helped quite a lot in the area of installation and dependency management for Drupal and Drush; however, users who want to get a quick start with Drush are sometimes put off by the Composer-based install.  As of the Drush 8.0.0-rc3 release, it is now possible to install Drush using a phar. This requires fewer steps than the previous method.


[Related] Applying Updates to Drupal Core on Patheon with Drush

First, navigate to the Drush project page at https://github.com/drush-ops/drush


Drush Project Page

Click on the “releases” link shown above, and take a look at the most recent release. It should look something like the diagram below:


Drush Releases Tab

Click on the “drush.phar” link to download it.  Once the download is complete, rename the file to drush, and move it to a folder that is in your PATH.  If you are not sure which folders are in your PATH, you can find out from the shell:

    echo $PATH

On most systems, you will see that there is a bin directory in your home directory available for this purpose. This folder might be named something like /Users/yourname/bin (MacOS) or /home/yourname/bin (Linux). If your web browser is set up to download files to the Downloads directory, then you can move and rename your Drush phar as follows:

    mv ~/Downloads/drush.phar ~/bin/drush
    chmod +x ~/bin/drush

If you are unsure about the location of your Downloads folder, and the above command does not work for you, you can tell your web browser to reveal the Download file in the Finder.  You can then rename it to drush using the GUI, and drag it to the bin directory in your home folder.

That’s all there is to it--drush is now installed!  To test and see if it worked, type:

    drush version

You should see “Drush version: 8.0.0-rc3”, or something similar.  You are now ready to use Drush for all sorts of things!



Discover More

Special Guests at our DrupalCon Portland Booth

Steve Persch
Reading estimate: 3 minutes

How to Build Agile Web Development Practices For City Government

Steve Persch
Reading estimate: 5 minutes

Drupal for Civic Engagement: the City of Chattanooga Story

Yulia Popova
Reading estimate: 3 minutes

Try Pantheon for Free

Join thousands of developers, marketers, and agencies creating magical digital experiences with Pantheon.