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
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.
-
-
/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
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:
- Drupal site folder (e.g. sites/{default|example.com}/drushrc.php).
- Drupal sites/all/drush folder.
- In any location, as specified by the --config (-c) option.
- User's .drush folder (i.e. ~/.drush/drushrc.php).
- System wide configuration folder (e.g. /etc/drush/drushrc.php).
More useful informations can be found in example.drushrc.php.
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:
Go to the installation directory for
drush
commands:cd [drupal-site-docroot]/vendor/drush/drush/commands
This assumes the default case where
composer
installeddrush
for each of your Drupal sites separately (it can also install it once per user, or system-wide – I prefer the latter).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;
Clear the commandfile cache to register the new command:
drush cc drush
-
This installs Drush command only for one site, not globally for all users.– BobíkNov 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
If you only need it for your local user on Linux, then put plugin into
~/.drush/commands