enable dd() for drush - temporary://debug_drupal.txt call fails If I included calls to dd() from code I run with drush, I see messages like this:

WD php: Warning: file_put_contents(temporary://drupal_debug.txt):      [warning]
failed to open stream: "DrupalTemporaryStreamWrapper::stream_open"
call failed in drupal_debug() (line 1624 of
/home/planetary/April/sites/all/modules/devel/devel.module).


How to make it so that dd('...') actually prints stuff to the drupal_debug.txt file?
As of a recent change to Drush (March 30, 2013), Drush is aware the  environment variables TMP and TEMP.  So the solution (on Ubuntu) is:

export TMP="/tmp/"


and 

sudo chmod g+w /tmp/drupal_debug.txt
sudo usermod -a -G www-data DrushUser