1

On my debian 6 server, I used apt-get to install drush. However, it looks like it downloaded drush version 3. I want to upgrade to the latest stable release of drush (which I believe is drush 5). How can I do this?

4

The short answer is on the Drush project page under the heading Install/Update - Unix/OSX:

pear upgrade drush/drush

I first had to install PEAR, but that should not be an issue.

2

You can using Drush to upgrade itself like the following:

sudo drush dl drush --destination='/usr/share'

Then you can check which version has been installed by executing:

drush --version

  • If installed using 'apt-get drush' on Debian, Ubuntu, etc. this works perfectly. I would recommend confirming that drush is installed at '/usr/share' first though. – Citricguy May 15 '13 at 3:42
2

You can install/upgrade to the latest version using Composer.

Install/Update via Composer

  • Install Composer globally (if needed).

    • via composer installer: curl -sS https://getcomposer.org/installer | php

    • via php: php -r "readfile('https://getcomposer.org/installer');" | php

    • on OSX (via homebrew): brew install composer

  • Make sure Composer's global bin directory is on the system PATH (recommended):

    sed -i '1i export PATH="$HOME/.composer/vendor/bin:$PATH"' $HOME/.bashrc
    source $HOME/.bashrc
    
  • To install Drush 6.x (stable):

    composer global require drush/drush:6.*
    
  • To install Drush 7.x (dev) which is required for Drupal 8:

    composer global require drush/drush:dev-master
    

    with specifying folder to install:

    sudo COMPOSER_HOME=/var/lib/composer COMPOSER_BIN_DIR=/usr/local/bin COMPOSER_VENDOR_DIR=/var/lib/composer/vendor composer require drush/drush:dev-master
    
  • To update to a newer version (what you get depends on your specification in ~/.composer/composer.json):

    composer global update
    
  • Alternate commands to install some other variant of Drush:

    # Install a specific version of Drush, e.g. Drush 6.1.0
    composer global require drush/drush:6.1.0
    # Master branch as a git clone. Great for contributing back to Drush project.
    composer global require drush/drush:dev-master --prefer-source
    

Fuller explanation of the require command.

Tips:

If Drush cannot find an autoloaded class, run composer self-update. Drush often tracks composer changes closely, so you may have some problems if you are not running a recent version.

Troubleshooting:

  • Nice answer. It was helpful. – gerzenstl Sep 9 '14 at 2:00
0

Run 'drush up' in your terminal or command line interface. (Update manager has to be enabled) After checking all available updates for modules is will also check to self update.

It will end up with something like:

A newer version of drush, 7.x-5.4, is available. You are currently running drush version 5.0-rc3. The update process depends on how you installed drush. Some common update commands are: pear upgrade drush, git pull, drush dl drush --destination=[/path/to/drush]. To disable this check, put "$options['self-update'] = FALSE;" in your drushrc.php configuration file.

For more information on drush use 'drush help' or 'drush help COMMAND'.

  • Drush self-update did not exist in Drush-3, and has been removed in Drush-5 (now informs of new updates only). Using pear or drush dl as described in one of the other answers is a better solution. – greg_1_anderson Jul 12 '12 at 13:41
0

If you are using PEAR, running "pear upgrade drush" on drush 4.5 did not work for me and just told me there were no updates. But pear upgrade did work and spit out a warning that the channel has changed.

If your version is old, you may need to run this first: "pear channel-update pear.drush.org"

[root@localhost ~]# pear upgrade drush
No releases available for package "pear.php.net/drush"

[root@localhost ~]# pear upgrade
WARNING: channel "pear.drush.org" has updated its protocols, use "pear channel-update pear.drush.org" to update
0

To install drush globally (for all users), here is one-liner:

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

On OS X/Unix, use this instead:

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

Windows and other

Download release from https://github.com/drush-ops/drush/releases, then execute via php.


See: Install/Upgrade a global Drush at docs.drush.org

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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