Skip to content

Instantly share code, notes, and snippets.

@fightbulc
Last active August 29, 2015 13:58
Show Gist options
  • Save fightbulc/10365814 to your computer and use it in GitHub Desktop.
Save fightbulc/10365814 to your computer and use it in GitHub Desktop.

Fix locale bug on unix

I always got the following bug:

locale: Cannot set LC_CTYPE to default locale: No such file or directory

The following steps fix this bug specifically for Gentoo systems. I didn't test any other systems yet.

Step 1

Add to vi /etc/env.d/02locale with LC_ALL="nonsense":

LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="C"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LANG="en_US.UTF-8"
LANGUAGE="en_US:de:en_US:en"
LC_ALL="nonesense"

Step 2

Run the following:

env-update && source /etc/profile

Step 3

Open vi /etc/env.d/02locale again and change now LC_ALL="nonsense" to the following:

LC_ALL=""

Step 4

Re-run the following:

env-update && source /etc/profile

Step 5

Happy locale error free time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment