Skip to main content

Drush: How to install manually an older version of drush (7.x) for Mac OS X

After switching to drupal 8, few OS updates later and using drush (vendor/bin/drush) as part of each drupal 8-9 daily project routine. I realized that (global) drush was broken when i had to run some all time classic drush up and drush rr all and drush updb commands to a few drupal 7 websites that needed some major updates.  So long story short: I removed my old veteran drush installation and this is how i reinstalled drush 7 for my good old drupal 7 projects.

In order to follow this example you need to have composer already installed. Last but not least you do not want to install the latest drush master version of course. So for installing drush7 go to https://github.com/drush-ops/drush/tree/7.x and get the download link URL from the Code button (https://github.com/drush-ops/drush/archive/refs/heads/7.x.zip)

# Create a bin directory for your user account and add to system path
mkdir $HOME/bin
echo "PATH=$HOME/bin:$PATH" >> ~/.bashrc
source ~/.bashrc

# Download and unzip the Drush software
wget -O $HOME/bin/drush.zip https://github.com/drush-ops/drush/archive/refs/heads/7.x.zip
unzip -d $HOME/bin $HOME/bin/drush.zip

# Install Drush dependencies with Composer (assumes `composer` is on system PATH)
cd $HOME/bin/drush-7.x
composer install

# Create a symbolic link
ln -s $HOME/bin/drush-7/drush $HOME/bin/drush

That's it.

shell

Latest Articles

Using drupal/core-composer-scaffold to prevent rewriting .htaccess or robots.txt file admin_pixelthi… Sun, 12/01/2024 - 16:49 Using drupal/core-composer-scaffold to prevent rewriting .htaccess or robots.txt file

Using drupal/core-composer-scaffold to prevent rewriting .htaccess or robots.txt file

composer
Controlling ckeditor styling options with hook_editor_js_settings_alter admin_pixelthi… Thu, 05/16/2024 - 10:49 Controlling ckeditor styling options with hook_editor_js_settings_alter

Controlling ckeditor styling options with hook_editor_js_settings_alter

php hook hook_editor_js_settings_alter hook_field_widget_single_[WIDGET_TYPE]_form_alter
Upgrading Drupal 9 Modules for Drupal 10: A Simple Guide admin_pixelthi… Tue, 09/05/2023 - 14:18 Upgrading Drupal 9 Modules for Drupal 10: A Simple Guide

Upgrading Drupal 9 Modules for Drupal 10: A Simple Guide

composer drupal9 drupal10