0

I haven't updated drush in awhile and looking to update it to the latest. I'm not exactly sure how it was installed originally. But when I do a which drush, it shows it resides in /usr/bin/drush

When I do a drush dl drush - I only get the option to upgrade to 7.x only.

How can I update it to Drush 9?

Can I just do a git clone of the drush repo from: https://github.com/drush-ops/drush

Then do I just do a checkout of the drush 9 tag? But how do I make it the default drush application to run? Or do I just overwrite the file in /usr/bin/drush?

FYI: My linux server admin skills aren't up to par.

2
  • What version of PHP is on your server? CentOS 5 only supports old versions, even with the IOS repos. You may not be able to get a recent version of drush to work.
    – mpdonadio
    Apr 29, 2016 at 20:26
  • I just got the server guys to upgrade it to 5.5.23 -- would I run into any issues? Apr 29, 2016 at 20:32

1 Answer 1

3

drush dl drush downloads the obsolete version of Drush from drupal.org. Drush was never intended to be used to download Drush via the pm-download command, even when it was hosted on drupal.org; the fact that this works is more of an anomaly or coincidence than design.

To update to a newer Drush, follow the usual instructions in the Drush documentation. Since you already have Drush in usr/bin/drush, use this location instead of the location stipulated in the docs (usr/local/bin/drush).

wget http://files.drush.org/drush.phar
chmod +x drush.phar
sudo mv drush.phar /usr/bin/drush

The Drush at files.drush.org/drush.phar is always the most recent stable version of Drush. To download a specific version, visit https://github.com/drush-ops/drush/releases. There is a phar available with every release of Drush from version 8 and later. You can, of course, replace your /usr/bin/drush at any time that you need to upgrade.

11
  • what if i wanted to update it in the future? do i do the same thing? thanks greg! Apr 29, 2016 at 20:45
  • I'm actually getting a weird error after doing the upgrade like you said: prntscr.com/aygq6d --- when i run drush, it just says X-Powered-By: PHP/5.5.28 did i download the wrong one? Apr 29, 2016 at 20:50
  • Very weird, but it works when I'm not logged in as root. Any idea to why that is? Apr 29, 2016 at 21:12
  • 1
    Probably the simplest way would be to symlink /usr/bin/php-cli to ~/bin/php, and make sure that ~/bin is in your $PATH ahead of /usr/bin when you're logged in to your shell. Apr 30, 2016 at 0:38
  • 1
    Yes, good point. I have actually answered how to install Drush 8 here, missing that detail from the subject line. Drush 9 is, in fact the master branch of Drush. It was only recently forked, and is currently very similar to Drush 8 at the time of this writing. Folks will soon be in for a bumpy ride if they install it. Dev versions of Drush are generally usable (the maintainers all use HEAD of master for day-to-day work), but behavior can change without warning when you are on dev. Apr 30, 2016 at 13:43

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.