16

I installed Drush using the PEAR option mentioned on the Drush project page, but I can't find the location of where it was installed.

Does anybody know the default installation location?

Specifically, I can't find the location of the drush.rc.php file to edit and add multiple sites to.

  • 1
    Have you run updatedb and done a locate drush? – mpdonadio Jan 23 '12 at 14:38
  • No - I don't know what either are those things are. – James Jan 23 '12 at 18:09

10 Answers 10

13

On Unix or OS X, you can use which drush to learn the location. On Windows, it is where drush from the command line.

5

See the file examples/example.drushrc.php for instructions on where to put your drushrc.php configuration files. $HOME/.drush is a good location.

The drush status command will show you your active drushrc.php files, but it will not help you until you have created the file for the first time.

  • I see - so I have to manually create drush.rc.php myself? I think the page you link to has everything covered, by the looks of things. Thanks. – James Jan 24 '12 at 10:20
4

I have installed drush using pear as described here http://drupal.org/project/drush

pear channel-discover pear.drush.org
pear install drush/drush

Once installed, drush is can be founded here

/usr/lib/php/pear/drush
  • Thanks! I've spent hours trying to find this path on my Mac. Nothing in the install showed that this is where the files were going. – sho May 31 '13 at 1:02
  • For me, pear installed drush at /usr/local/bin/drush , but I already had drush installed manually at /usr/local/lib/drush/drush . I had to rm the link to the original, and relink to the pear drush: sudo ln /usr/local/bin/drush /usr/bin/drush – Tom Stermitz Nov 30 '13 at 16:15
4

The drush site alias command gives more complete information about where pear has put drush files. CD to the directory of your site, and:

drush site-alias @self --full --with-optional

$aliases["pkus"] = array (
  'root' => '/Users/tstermitz/Sites/pkus',
  'uri' => 'http://Sites',
  '#name' => 'pkus',
  'path-aliases' =>
  array (
    '%drush' => '/usr/local/pear/share/pear/drush',
    '%site' => 'sites/Sites/',
  ),
  '#file' => '/Users/tstermitz/.drush/aliases.drushrc.php',
);
3

Type drush status and check for "Drush configuration" in the output. That should be the path to drush.

  • Unfortunately, nothing is shown for 'Drush configuration'. – James Jan 24 '12 at 10:18
  • this won't do anything unless it's actually available. – doublejosh May 5 '12 at 1:27
3

If you are in a Linux based system, then you can run the following command:

cat `which drush` | grep -A1 "# Build the path to drush.php." | grep "SCRIPT"

You should get something that gets like:

/usr/share/php/drush/drush.php

Your configuration files should be (in this case) in /usr/share/php/drush.

This command simply looks at the drush command currently being sourced by your path, searches the executable file for the path to the drush.php file.

This command should work regardless of how drush was installed provided drush is in your $PATH. If you don't know what a $PATH environment is, all you need to know for now is that DRUSH is in your path if you can type drush into the terminal and it will return something like:

Execute a drush command. Run `drush help [command]` to view command-specific help.
Run `drush topic` to read even more documentation...
2

I used pear to install drush and sources are located on my Unix machine in /usr/share/php/drush

which or where commands will only give you the location of the execution file?

PEAR Version: 1.9.4
Drush version: 5.7

  • The which command looks through your path variable for the first executable. – Tom Stermitz Dec 21 '13 at 14:58
1

On my MAMP setup, it is in /Applications/MAMP/bin/php/php5.3.14/lib/php/drush

I am not positive, but I probably installed it with pear.

1

I too got lost a bit after installing Drush on CentOS 6.4 via PEAR. Here was my solution:

cat `which drush` | grep SCRIPT_PATH -m1

After installation, which drush will return the path to the drush shell script, which is a readable text file. The SCRIPT_PATH variable in this shell script contains a hardcoded path to the drush.php file. In the directory where this file is located the rest of the downloaded drush library resides.

Example:

cat `which drush` | grep SCRIPT_PATH -m1
SCRIPT_PATH=/usr/share/pear/drush/drush.php
ls /usr/share/pear/drush
classes        docs               drush_logo-black.png  includes  README.txt
commands       drush.complete.sh  drush.php             lib       tests
composer.json  drush.info         examples 

This worked for drush version 6.0.

1

Pear creates the drush files in the pear/share/pear directory within your pear installation. You choose the pear install location(s) when you first install pear. Use "pear config-show" to see all these settings.

So, if you set pear to install its binaries in /Users/local/pear/bin (a pretty good choice!) then that's where running "pear install drush/drush" would put the drush directory.

A good choice might be: /Users/local/pear/bin . Then it is simple to link that directory to your preferred bin directory like so:

sudo ln -fs /Users/local/pear/bin/drush /usr/local/bin/drush

I'm on OS X using MAMP, so I also needed to add the alias in my .bash_profile:

alias drush='/Applications/MAMP/bin/php/php5.4.10/bin/php /usr/local/bin/drush/drush.php'

Now the "which drush" command works for me.

(You should probably install pear in /usr/local/pear and the pear executables in /usr/local/bin ).

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