I'm attempting to create a drush command for use outside of a Drupal install. It's basically a script to make a copy of a distribution starter kit and do some string replacing. I'm following the sandwich example.

I'm running into two issues...

1) I created mycommandfile.drush.inc in a new folder. If I try to run the command it says the drush command cannot be found. So I copied the file to my /.drush folder and it finds the command. Any idea why that would be the case?

2) The second issue is that with the file in the /.drush folder it is telling me that I need a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command. In my command declaration I have 'bootstrap' => DRUSH_BOOTSTRAP_DRUSH.

1 Answer 1


1) Drush only searches certain folders for Drush commandfiles. Run with --include=/path/to/your/drushcommands, or set $options['include'][] = '/path/to/your/drushcommands'; in your drushrc.php if you'd like to use a directory other than $HOME/.drush.

2) If you have in fact set your bootstrap to DRUSH_BOOTSTRAP_DRUSH, then you should not be getting that message. Maybe there is something wrong with your commandfile definition; can't guess what it might be from the information provided, though.

For a quick start on writing a new Drush command, see the drushify project. It will create a template for you very quickly. Perhaps you could compare the template drushify creates with the commandfile you put together.

  • Thanks Greg! That did it. Once I added the --include option then it executed.
    – Craig
    Jan 1, 2014 at 3:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.