2

I have tried to install Drush on OSX 10.9 but it doesn’t seem to have worked. In terminal ‘drush status’ gives

-bash: drush: command not found

I have followed the instructions on http://whaaat.com/installing-drush-7-using-composer

Composer’s directory seems to be correct as my .bash_profile contains:

export PATH="$Trotter/.composer/vendor/bin:$PATH" 

Drush exists in the vendor folder of composer

Directory structure to Drush

When I tried to install Drush via composer the feedback seemed to suggest it had worked:

Pauls-iMac:~ Trotter$ composer self-update
Updating to version 8e9659bd8317ad3f623c4d17940380443cf8772c.
    Downloading: 100%         
Use composer self-update --rollback to return to version 1.0.0-alpha9
Pauls-iMac:~ Trotter$ composer global require drush/drush:7.*
Changed current directory to /Users/Trotter/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing pear/console_table (1.2.1)
    Loading from cache

  - Installing symfony/var-dumper (v2.7.1)
    Downloading: 100%         

  - Installing symfony/yaml (v2.7.1)
    Downloading: 100%         

  - Installing d11wtq/boris (v1.0.8)
    Loading from cache

  - Removing drush/drush (6.5.0)
  - Installing drush/drush (7.0.0)
    Downloading: 100%         

pear/console_table suggests installing pear/Console_Color2 (>=0.1.2)
symfony/var-dumper suggests installing ext-symfony_debug ()
d11wtq/boris suggests installing ext-pcntl (*)
Writing lock file
Generating autoload files
Pauls-iMac:~ Trotter$ drush status
-bash: drush: command not found

(Note I had previously tried to install Drush 6 but hadn't got this to work either)

I would appreciate any advice on what is going wrong here.

6
  • Is $Trotter set above that line in the bash script? Any reason not to use the standard ~? Have you re-sourced the bash profile since changing it? I think your question just comes down to "why isn't composer's global path in my session's global path", which should hopefully be easy to figure out (and isn't really related to Drupal/Drush as such, in case you're trying to find a solution from either of those systems' points of view)
    – Clive
    Jun 16, 2015 at 10:45
  • @Paul What php version are you running ? Jun 16, 2015 at 14:07
  • @Clive my basic command prompt when opening terminal is: Pauls-iMac:~ Trotter$ Jun 16, 2015 at 16:30
  • @darol I am running PHP version 5.5.11 Jun 16, 2015 at 16:35
  • Try changing that to export PATH="~/.composer/vendor/bin:$PATH" (assuming you run Drush under that user account), or export PATH="/Users/<username>/.composer/vendor/bin:$PATH". Make sure you source ~/.bash_profile after making changes unless you start a new terminal session
    – Clive
    Jun 16, 2015 at 17:12

5 Answers 5

5

Changing the .bash_profile to the following worked:

export PATH="~/.composer/vendor/bin:$PATH" 

Now drush status gives good feedback on the Drush version etc. Thanks to Clive for suggesting this.

4
  • It helped me too, but I am too new, and too noob in Ubuntu to know why... Can someone please explain the mechanism behind it to me and further readers? Thanks,
    – user16289
    Jan 6, 2016 at 9:16
  • Type "path in bash profile" into Google @benos. If you don't know what a bash profile, search for "bash profile" instead. These concepts aren't going to be explained on a site for questions about Drupal, they're unrelated
    – Clive
    Jan 6, 2016 at 9:20
  • Sure I will look for it right now --- That suggestion by itself helps me very much, thank you,
    – user16289
    Jan 6, 2016 at 9:23
  • @Clive, after I've closed the terminal via "exit" command I needed to run this again... Is there a way to change it permanently ? I didn't have time to dive to it from yesterday; I just need a way to change the bash profile permanently so I wouldn't need to run it time and again...
    – user16289
    Jan 7, 2016 at 3:40
2

The linked manual may be outdated. Please follow the steps below.

Installing drush

via Phar binary

Download latest stable release using the command below:

OS X/Unix:

sudo wget -O /usr/local/bin/drush http://files.drush.org/drush.phar
sudo chmod +x /usr/local/bin/drush

Linux:

sudo install <(curl http://files.drush.org/drush.phar) /usr/local/bin/drush

Windows and other

Download manually at https://github.com/drush-ops/drush/releases

via Composer

If you'd like to install drush globally (for all users) and /usr/local/bin is already in your PATH, try installing using the following syntax:

sudo COMPOSER_HOME=/opt/drush COMPOSER_BIN_DIR=/usr/local/bin COMPOSER_VENDOR_DIR=/opt/drush/7 composer require drush/drush:7

or:

sudo COMPOSER_HOME=/var/lib/composer COMPOSER_BIN_DIR=/usr/local/bin COMPOSER_VENDOR_DIR=/var/lib/composer/vendor composer require drush/drush:7

Change drush/drush:7 into drush/drush:dev-master for the latest development version.

via Homebrew (OS X)

Run:

brew install drush

See: Install/Upgrade a global Drush

0

My .bash_profile contains exactly

export PATH="$PATH:$HOME/.composer/vendor/bin"

and my drush lies here (Acquia DevDesktop)

export PATH="$PATH:/Applications/DevDesktop/drush"
0

This article for installation of Composer with Drush included can be useful:

https://www.pcextreme.nl/community/d/138-drush-installation-for-drupal-shared-hosting

0
0

I have found the simplest way is to install it with Homebrew

Once brew is installed and working simple type brew install drush.

1
  • But you can't install the latest drush using homebrew. Jun 16, 2015 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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