While importing a PostgreSQL database in OS X 10.10, I got a error like "invalid locale name: en_US.utf8". I went to /usr/share/locale and copied the folder en_US.UTF-8 as en_US.utf8. Ok, problem solved.

But I know this solution will not work in OS X 10.11 due to that "rootless mode". I'll not be able to modify /usr/share/locale.

Is there any way to load this folder from /usr/local/share/locale? I tried to copy en_US.utf8 to that directory and it didn't work.

  • Did you disable SiP (rootless) Commented Sep 20, 2015 at 3:25
  • 1
    No, and I prefer not doing it unless there is no other way around. System Integrity Protection is nice overall.
    – Jan K. S.
    Commented Sep 20, 2015 at 22:29
  • you can disable, then do your stuff, then re-enable it. Commented Sep 21, 2015 at 0:41
  • 1
    I would use that as last resort. I'm not sure if Apple will be resetting /usr/share/locale in the next updates, forcing me to repeat the process.
    – Jan K. S.
    Commented Oct 5, 2015 at 0:38

2 Answers 2


This worked for me (macos 10.14):

sudo localedef -i /usr/share/locale/en_US.UTF-8 /usr/local/share/locale/en_US.utf8
sudo cp /usr/share/locale/en_US.UTF-8/LC_COLLATE /usr/local/share/locale/en_US.utf8/

My solution now is to simply replace the string "en_US.utf8" with "en_US.UTF-8" in the dump file. Since that file is compressed in my case (hence binary format), it was necessary to keep the same number of characters in the original line. So I remove a couple of white-spaces, transforming

(...) LC_COLLATE = 'en_US.utf8' LC_CTYPE = 'en_US.utf8' (...)


(...) LC_COLLATE= 'en_US.UTF-8' LC_CTYPE= 'en_US.UTF-8' (...)

A perl command to do that in my importing script was

perl -pi -e "s/LC_COLLATE = 'en_US.utf8'/LC_COLLATE= 'en_US.UTF-8'/g" myDumpFilePath
perl -pi -e "s/LC_CTYPE = 'en_US.utf8'/LC_CTYPE= 'en_US.UTF-8'/g" myDumpFilePath
  • #taketheblowonthehead similar problem, but I was trying to restore a 47GB PG_DATA directory Commented Dec 23, 2015 at 13:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .