UPDATE: See Three Ways to Get Drush on OS X for a newer guide.
We're big fans of Drush. It's installed on all of our servers and it's a great way to perform maintenance tasks, download core and modules, and much much more. I'm not a big fan of installing from zip files though, so let's use git to easily keep our Drush install up to date.
Before the git transition, I would use Subversion to check out the latest drush release somewhere, like /usr/local/drush (on my Mac), using the CVS clone Subversible. Today, however, I noticed that the latest tagged release Subversible has is 4.2, and the Drush project page has 4.4 ready to download. I figured now would be a good time to start using git for this and stop relying on a third-party to provide the code for Subversion.
The commands below will walk through cloning the Drush git repository and then switching to the latest release. I realize the drush self-update will soon make this irrelevant, but this method works today and is a great exercise in learning how Drupal is using git, especially important coming from Subversion.
Clone the repository. It will create the subfolder "drush" from your current working directory:$ git clone --branch master http://git.drupal.org/project/drush.git $ cd drush
$ pear download Console_Table && tar zxvf `ls Console_Table-*.tgz` `ls Console_Table-*.tgz | sed -e 's/\.[a-z]\{3\}$//'`/Table.php && mv `ls Console_Table-*.tgz | sed -e 's/\.[a-z]\{3\}$//'`/Table.php includes/table.inc && chmod 0644 includes/table.inc && rm -fr Console_Table-*
$ git tag 5.x-1.0 5.x-1.0-beta1 5.x-1.0-beta2 ... snip ... 7.x-4.2 7.x-4.3 7.x-4.4 debian/4.3-1 debian/4.4-1
$ git checkout 7.x-4.4 Previous HEAD position was 1532d0c... #1079434 by msonnabaum. Add .gitignore for includes/table.inc HEAD is now at a808ff0... Updating drush version
$ drush --version drush version 4.4
$ git pull
View the list of tags:
$ git tag 5.x-1.0 5.x-1.0-beta1 5.x-1.0-beta2 ... snip ... 7.x-4.3 7.x-4.4 7.x-4.5 debian/4.3-1 debian/4.4-1 debian/4.5-1
$ git checkout 7.x-4.5
Repeat for future releases, and enjoy! Of course, once drush self-update begins working, that will be the preferred method, but this will work today. Please questions or comments below.