Drush can be installed manually or automatically, depending on your operating system and preferences. These are explained in this chapter through step by step instructions. You should evaluate them and, whichever you follow, make sure that you end up with Drush 4.5 or higher installed on your system.
Drush is designed for working on Unix-based systems such as Linux and Mac OS X. However, a lot of effort has been put into making some of its commands available in Windows systems.
Windows users can install Ubuntu within VirtualBox to use Drush within a Unix-based environment. See http://www.ubuntu.com and https://www.virtualbox.org for more details.
Linux and Mac users need to verify that they can run PHP on the command line and its version is 5.2 or higher. If you are using Windows, you can jump to the next section as the Drush installer configures PHP automatically for your terminal. The easiest way to check whether you have PHP-CLI installed and configured, is by opening a terminal and executing the following command:
$ php -v
PHP 5.3.5-1ubuntu7.4 with Suhosin-Patch (cli) (built: Dec 13 2011 18:25:14)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
If you got an output similar as the previous one, you can jump to the next section. If not, here are some tips to get PHP-CLI installed on your system.
Debian and Ubuntu users can easily install php-cli
with the following command:
$ sudo apt-get install php5-cli
Once the installation completes, verify the installed version with php -v
.
Mac users have php-cli installed by default but need to make it available from anywhere in the terminal. The whereis
command helps to find where a command is located. The following command shows how the whereis
command is used to find where a command is located, if we have the PHP binary in our system:
$ whereis -b php
php: /usr/bin/php /usr/share/php /usr/share/man/man1/php.1.gz
If the command has found any results, as in the previous example, try executing them appending -v
to see if the version is 5.2 or higher. If you have found it, create a symbolic link that points to any of the paths listed within your PATH
environment variable. Now, in the future you can just type php
instead of the full path where it's located. We will first print the available paths and then create a symbolic link to one of them:
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin: /usr/games:/home/juampy/local/bin:/opt/android-sdk-linux_x86/tools
$ sudo ln -s /path/to/php/executable /usr/local/bin/php
After that, you should be able to run php -v
without errors.
You can find further information about requirements at the Drush README.txt
(http://drupalcode.org/project/drush.git/blob/HEAD:/README.txt).
18.221.165.246