5

I want to install drush-toolbox project globaly on my linux server box so all users can use it. How can I do it?

4 Answers 4

7

Put it in /usr/share/drush/commands for global accessibility. On Windows, Drush will look in the folder named Drush/share/drush/commands inside the location specified by the ALLUSERSPROFILE environment variable.

After adding new commands, you will need to run drush cc drush to clear the Drush command cache, so that Drush will once again scan its command searchpath.

2
  • Not works for today versions.
    – Bobík
    Nov 11, 2015 at 9:28
  • /usr/share/drush/commands is still working fine with Drush 8; I just tested to confirm. Perhaps you did not clear your cache after adding new commands? I updated the answer to include this advice. Nov 11, 2015 at 14:51
3

You can also specify your own directory for Drush modules/commands by drushrc.php:

$options['include'] = array('/path/to/commands','/path2/to/more/commands');

This file could be placed in several directories:

  1. Drupal site folder (e.g. sites/{default|example.com}/drushrc.php).
  2. Drupal sites/all/drush folder.
  3. In any location, as specified by the --config (-c) option.
  4. User's .drush folder (i.e. ~/.drush/drushrc.php).
  5. System wide configuration folder (e.g. /etc/drush/drushrc.php).

More useful informations can be found in example.drushrc.php.

2

Newer versions of drush (6.2 here) are installed with composer, the new PHP dependency manager. So the installation of an additional command is now like this, in your case:

  1. Go to the installation directory for drush commands:

    cd [drupal-site-docroot]/vendor/drush/drush/commands
    

    This assumes the default case where composer installed drush for each of your Drupal sites separately (it can also install it once per user, or system-wide – I prefer the latter).

  2. Download, unpack and clean up:

    wget https://github.com/zroger/drush-toolbox/archive/master.zip;
    unzip master.zip;
    mv drush-toolbox-master drush-toolbox;
    rm master.zip;
    
  3. Clear the commandfile cache to register the new command:

    drush cc drush
    
2
  • This installs Drush command only for one site, not globally for all users.
    – Bobík
    Nov 9, 2015 at 10:33
  • It is not advisable to manually place files inside the vendor directory, as composer will rewrite that location, e.g. on composer update. Nov 11, 2015 at 14:54
2

If you only need it for your local user on Linux, then put plugin into

~/.drush/commands

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.

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