I'm trying to download Drupal 7 using Drush 8.1.2, without success. It was working perfectly for months; now, I am getting the following error message on all modules and core downloads when I'm running:

drush dl drupal-7

copy(/tmp/drush_tmp_1468772300_578bafccc15f2/tar: Failed to set default locale): failed to open stream: No such file or directory filesystem.inc:267
Project drupal (7.50) could not be downloaded to /Applications/MAMP/htdocs/drupal-7.50

I haven't changed any tmp permissions. What can I do?

I am using PHP 5.6.10 and Drush temporary directory is /tmp.


2 Answers 2


The error:

Failed to set default locale

sounds like tar command invoked by Drush has some problem detecting your system locale.

Try setting it to UTF-8 by the following command:

defaults write org.R-project.R force.LANG en_US.UTF-8

Source: How to fix 'tar: Failed to set default locale' error?

  • 1
    Kenorb, Thank you so much for pointing me in the right direction! Indeed I have changed my system language a couple of days ago. Instead of using the command above I have found a easy solution. Open System Preferences > Language & Region > Advanced > General > Change the Format language back to the previous language.
    – user32010
    Jul 17, 2016 at 20:28

On MacOS I found a solution!

I has this problem only in the PHPStorm terminal, not in my default MacOS terminal.

Solution: use gnu-tar instead of the default one. https://medium.com/@fullsour/installing-gnu-tar-on-mac-827a494b1c1

First how to debug:

  1. Not working yet:

    $ drush dl devel-7.x --destination=modules/ -vvv

    Outputs a line with "Failed to set default locale"

  2. Install gnu-tar and add the path to ~/.bash_profile or ~/.profile like this:

    export PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"

  3. Re-open the terminal in PHPStorm and it should work:

    $ drush dl devel-7.x --destination=modules/ -vvv

    Outputs a line with "[success]"

Your Answer

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