Installing Drush in Ubuntu 14.04 via Composer

site-admin Blogs, Software Development, Uncategorized Tagged Tags: , , , ,

I haven’t used Drupal for a while now, so I decided to check the latest stable version. Before, I used to install Drupal manually until I heard about Drush. Drush is a command line tool that is designed to interact and manage Drupal. I then explored using Drush and was amazed on how easy it is to maintain a Drupal project using it.

But since I cleaned up my dev machine a few months ago by freshly installing Ubuntu 14.04 (Trusty Tahr) in it, I need to re-install Drush again in my system. I checked the Drush documentation site and found that there is a new way of installing it via composer.

I decided to give it a try and followed the instructions step by step. But as soon as I tried to verify if Drush was installed successfully by running this command:

$ drush status

I got this error:

The program 'drush' is currently not installed. You can install it by typing:
sudo apt-get install drush

I checked the steps if I missed anything. Where did I go wrong? I figured that it must be path of the Drush binary executable file, Ubuntu couldn’t find it. So I decided to write this article to provide the steps needed to install Drush for Ubuntu 14.04 users. The steps are the same but with a slight modification.

Installing Drush via Composer

  1. Install Composer globally.
    $ curl -sS | php
    $ sudo mv composer.phar /usr/local/bin/composer
  2. Add composer’s bin directory to the system path by placing
    export PATH="$HOME/.config/composer/vendor/bin:$PATH" into your ~/.bashrc
  3. Install latest stable Drush:
    $ composer global require drush/drush.
  4. Verify that Drush works:
    $ drush status

Notice the change in step 2? I corrected the path in order to point to the correct binary executable file of Drush.

Leave a Reply

Your email address will not be published. Required fields are marked *