How to install a module from an archive file with drush? To install a module available on drupal.org, I do drush dl modulename &amp;&amp; drush en modulename. However, when I have module available as an archive file on my local disk instead (.zip or .tar.gz), how can I still use drush to install it?

The archive file could come from downloading a sandbox project snapshot, from a self-developed "custom made" module or similar.

I know I could unpack the module into sites/all/modules/, then enable it with drush en modulename. But I'm looking for nice scriptable commands to do both these steps with drush. (Bit silly, but I like to keep a drush workflow.)
You can use drush make to unpack a module named your_module from an archive file, as follows:


Create a modulename.make file containing:

core = 7.x
api = 2
; Install from local module archive file.
projects[your_module][type] = "module"
projects[your_module][download][type] = "file"
projects[your_module][download][url] = "file:///dir/your_module.tar.gz"

While in the Drupal root directory of your site, execute the Makefile and enable your module:

drush make --no-core -y your_module.make &amp;&amp; drush en -y your_module



Alternatively, you can script this into one set of commands, using a temporary file instead of a separate Makefile. Again, to be executed while in the Drupal root directory:

#!/bin/bash
module="your_module"
makefile=$(mktemp)
echo "Created temp file $makefile"
cat &lt;&lt; end-of-makefile &gt;$makefile
  core = 7.x
  api = 2
  projects[$module][type] = "module"
  projects[$module][download][type] = "file"
  projects[$module][download][url] = "file:///dir/file.tar.gz"
end-of-makefile
drush make --no-core -y --verbose $makefile
drush en -y $module


(Bash named pipes or bash process substitution via &lt;(echo …) cannot be used here to avoid a temp file. They create streams, which are non-seekable files that drush make fails to read from.)