Information for: DEVELOPERS   PARTNERS

About Drush on Acquia Cloud

This page is for Drupal 8 only. For information about Drush and Drupal 7, see Drush and Drupal 7 on Acquia Cloud.

Drush is a command-line shell for Drupal, which you can require as part of your Composer-built Drupal website. With Drush, you can perform many administrative and application maintenance tasks from the command line instead of Drupal’s administrative interface.

Local development best practices

Acquia recommends you develop your codebase locally, using Composer to build your codebase, and Acquia Dev Desktop to sync your code between your local environment and Acquia Cloud, rather than attempting to manage code or modules remotely on Acquia Cloud.

You can change your application’s code, use Drush locally to install or update modules, and then send the changes to Acquia Cloud using version control or Acquia Dev Desktop.

Note

Drush commands should generally be run from your website’s docroot.

Using Drush on Acquia Cloud

Although multiple versions of Drush (Drush 6 to Drush 9) are pre-installed on Acquia Cloud, Acquia recommends you require a site-local Drush as part of your codebase, and run your commands with a specific major version of Drush. Running the globally-installed version of Drush is dangerous because the behavior of your cron jobs, Cloud Hooks, or other automated scripts may change unexpectedly when a new version of Drush becomes the default.

Drush commands not specifying a version of Drush will default to Drush 8.

You can use Drush with your applications after you enable SSH access to connect to Acquia Cloud using SSH.

Drush versions and Drupal 8

  • Drupal 8.4 requires Drush 8.1.12 and greater.
  • Although Drush 9 is available for use, Acquia does not recommend its use with Drupal releases prior to Drupal 8.5. Drush 8 is the only fully supported version of Drush for Acquia Cloud for Drupal releases prior to Drupal 8.5.
  • Drush 9 must be installed as a project dependency (using Composer), because it no longer includes a global install command.

Specifying a version of Drush in commands

To run a specific version of Drush, specify the major version in the drush command. For example, to run Drush 7, use the command drush7.

If you want to change your personal default Drush version, you can set an alias for drush in a .bashrc file. For example, to make the drush command run Drush 7 on interactive bash commands, add this to your ~/.bashrc file:

alias drush=drush7

This alias will have no effect during cron jobs or Cloud Hooks. To use a specific version of Drush in a cron command, you must call it directly, as in the following example:

/usr/local/bin/drush7

When you run Drush on your local machine and use a remote Drush alias for your Acquia Cloud application (such as those described in Using Drush aliases), the remote Drush command cannot check for a site-local version of Drush, and will instead run the default version of Drush on Acquia Cloud.

Acquia recommends you run Drush commands by specifying the docroot, replacing [site] with your sitename and [env] with your environment, as in the following example:

drush --root=/var/www/html/[site].[env]/docroot

To run a specific version of Drush on Acquia Cloud when you use a remote alias, edit the alias file in the $HOME/.drush folder on your local machine to specify the version you want. For example:

$aliases['dev'] = array(
  'path-aliases' => array(
    '%drush-script' => 'drush7',
  ),
  // ... other alias settings here
);

Finding help for Drush

To access help for Drush online, go to Drush Commands.

To view command-line help, enter the command appropriate to your version of Drush on the command line while signed in to your Acquia Cloud server:

  • Drush 8drush8 help
  • Drush 9drush9 list for a list of commands, or drush9 help [command name] for help for a specific command