Updating Drupal Core via Drush
This documentation is outdated. Help make it current.
Before You Begin
It is recommended to use Composer for managing Drupal dependencies; see Updating Drupal Core with Composer for more. Drush 9 and later no longer support updating Drupal core—this is now Composer's role. However, you can still use Drush 8 (version 8.1.14 or later) to update Drupal 8 if you're familiar with that workflow.
See the overview of update options to compare different methods.
Always revert to a backup if you encounter a fatal error during the update process.
Updating Drupal 8 Core with Drush 8
1. Back up your site
drush archive-dump
- Creates a
.tar.gz
archive of files and database. - This command is deprecated and only available in Drush 8.x.
2. Check for available updates
drush pm-updatestatus
Alias: ups
(Not recommended for Composer-based installs.)
3. Enable maintenance mode
drush state-set system.maintenance_mode 1
4. Rebuild cache
drush cache-rebuild
Alias: cr
5. Choose an update method
Update Drupal core:
drush pm-update drupal
Update to dev branch (testing only):
drush pm-update drupal-8.5.x-dev
Update specific module:
drush pm-update module_name
Apply only security updates:
drush pm-update --security-only
6. Reapply manual changes
Manually restore edits to files like .htaccess
, composer.json
, or robots.txt
.
7. Reapply custom patches (if any)
git log --oneline --reverse core git cherry-pick 267e3ad0 git cherry-pick 718ecba5
8. (If using Composer) Update vendor directory
composer update drupal/core --with-dependencies
9. Run database updates
drush updatedb
Alias: updb
10. Validate the site
- Visit Status report in the admin panel.
- Use a browser to test key pages on your site.
11. Disable maintenance mode
drush state-set system.maintenance_mode 0
12. Rebuild cache again
drush cache-rebuild
13. Done!
You’ve successfully updated Drupal 8 using Drush 🎉
Drupal’s online documentation is © 2000-2020 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.