# How do I create a Zen's sub-theme using Drush?

I am trying to install Zen theme and create a new sub-theme from STARTERKIT. I am using the following Drush commands.

drush dl zen
drush cc all
drush zen "Name" machine_name --description="Description." --without-rtl


The first two commands work; the third one throws an error:

The drush command 'Name machine_name' could not be found

Does anyone know how to do this?

EDIT

My mistake must be that I'm running Drush from my local machine. I downloaded Drush for Windows from the Drush site. I should be running it on my server where my Drupal site is right?

• "drush zen command 'Name machine_name'" doesn't install Zen theme, it creates a new subtheme. Is that what you are trying to do? – schnippy Aug 11 '13 at 0:01
• Yes, sorry, I'm trying to create a new sub-theme. – 24ma13wg Aug 11 '13 at 12:03
• I have installed Drush for Windows. My command prompt is C:\ProgramData\Drush >. But I want Zen and my sub-theme to be created on my server in my site's folder structure, not in C:\ProgramData\Drush. I've must have missed a vital step? – 24ma13wg Aug 11 '13 at 13:19

Reading How to build your own sub-theme (7.x-5.x) using Drush, I get that the commands should be the following ones.

drush dl zen
drush en zen
drush cc all
drush zen "Name" machine_name --description="Description." --without-rtl


In order, the commands:

• Enable it
• Clear the cache
• Create the sub-theme The reason of the second command is explained in the linked page.

### Ensure drush knows about the zen command

After you have downloaded Zen and placed it in your sites/all/themes directory, you need to enable the Zen theme and clear Drupal's (and Drush's) cache so that it will notice the Zen drush command. Type drush en zen followed by drush cc all.

As for running Drush on the remote server or in the local server, see this answer from one of the Drush maintainers for How to use Drush in remote server?

It is possible to use Drush with a Drupal site that is running on a remote server that does not have Drush installed. This is possible because the Drush commands drush rsync and drush sql-sync work by composing ssh commands; if you set up your site alias configuration carefully, then you can copy your site to a local machine to operate on it.

In order for sql-sync to work without Drush on the remote system, you must define the 'databases' and '%dump-dir' variables in your site alias. Otherwise, Drush will try to use Drush on the remote system to look up these values. See example.aliases.drushrc.php for more information.

Note that it is really useful to be able to at least run drush updatedb on the remote server, so that you can update your database after you rsync new code over. Of course you can do this through the GUI too, but Drush is faster. The Resources page on drush.org lists some hosting providers that are Drush-friendly.

Keep in mind that you could create the theme on your local site, and then copy the files over the remote site, or in a git repository that you then use when deploying your server.

• Thanks. I think my error is more basic. I don't think I should be running Drush on my local machine. Not sure how I should have set Drush up. But is seems logical that it should be running on my server where my sites/all/themes folder is located? – 24ma13wg Aug 11 '13 at 13:42
• @user1919784 Yes Drush needs to be invoked on the Drupal environment itself; but you can do that remotely by setting up aliases. There's a good write-up here – Clive Aug 11 '13 at 15:30
• Just FYI for those who are recently doing this and finding trouble, make sure you are installing the --HEAD version of drush because version 6.3 was not working for me for some reason. Also if you are using MAMP, you need to create a symlink. Here is a great guide. – aug Jun 27 '14 at 8:44

This was the solution I chose (although I ticked the answer that directly answered my question):

As Clive commented Drush needs to invoked in the Drupal environment itself. Seems obvious now, but it didn't occur to me initially. Instead of carrying on developing in my server space I decided to start developing my sites on my local machine. I downloaded and installed the Acquia Dev Desktop on my Windows PC. To get the Drush command line you can use the Drush Windows Installer. Now you're ready to go.

Start the Drush command line. Choose the directory where you want to install Zen, for example:

C:\ProgramData\Drush> cd c:\users\sites\mysite\sites\all\themes


I had to create the 'themes' folder (the Acquia install didn't create it for me). These are the commands I used to install Zen, create a sub-theme and enable the sub-theme (see kiamlaluno's answer for more info):

C:\Users\Sites\mysite\sites\all\themes> drush dl zen
C:\Users\Sites\mysite\sites\all\themes> drush cc all
C:\Users\Sites\mysite\sites\all\themes> drush zen "mysubtheme" --without-rtl
C:\Users\Sites\mysite\sites\all\themes> drush en mysubtheme


There is no command for setting the theme as default as far as I know, but everything else seems to be done. Much quicker than doing it manually!