Drupal Console installation

Submitted by admin on Thu, 03/30/2017 - 08:03

There are two ways for installing the Drupal Console. In both of them, there are two steps. These comments are for Linux or Mac machines.

a) Using composer 

Run this command

$ composer global require drupal/console:@stable --prefer-dist

or this command if you want to keep the commands "drupal site:mode dev" and  "drupal site:mode dev" that were removed in newer releases

$ composer global require drupal/console:0.11.3 --prefer-dist

This command will install the Drupal Console in a hidden folder inside your personal folder. 
For example, if your personal folder is /home/username then composer will install the Drupal Console inside

Then, run this command in your terminal to make the Drupal Console available anywhere

$ echo "PATH=$PATH:~/.config/.composer/vendor/bin" >> ~/.bash_profile
$ source /.bash_profile

That is all, you can start to use the Drupal Console by typing

$ drupal

b) By using the launcher

You have to download the Drupal Console inside /usr/local/bin. 

$ cd /usr/local/bin
$ curl https://drupalconsole.com/installer -L -o drupal.phar
$ chmod +x /usr/local/bin/drupal

In addition, you have to add the Drupal Console each time you work over a Drupal installation

$ composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader


$ composer require drupal/console:0.11.3 --prefer-dist --optimize-autoloader

if you want to keep "drupal site:mode" commands

Additional commands

To remove 

$ composer global remove drupal/console

To reconfigure the version of a specific library

$ composer -v require symfony/yaml:2.8.1

To show the list of composer packages already globally installed

$ composer global show




composer global require drupal/console:~1.0 --prefer-dist --optimize-autoloader