Skip to content

Instantly share code, notes, and snippets.

@madeagency
Created April 23, 2015 08:16
Show Gist options
  • Save madeagency/79dc86e8aa09aa512af5 to your computer and use it in GitHub Desktop.
Save madeagency/79dc86e8aa09aa512af5 to your computer and use it in GitHub Desktop.
OSX Terminal Fix - perl: warning: Setting locale failed.
When running certain commands like ssh or git within Terminal on OSX you may get notices like the one below, which can be annoying.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
The fix is simple:
Adding the following lines to ~/.bash_profile on my your local machine, the warning should go away:
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
Hope this helps someone rid themselves of annoyances.
@sshine
Copy link

sshine commented Jun 8, 2020

On macOS Catalina (10.15.4) using iTerm2, I made this work by export LC_ALL=en_US.UTF-8 only.

If I also set LANG=en_US.UTF-8, those messages start coming back.

This appears to work for both zsh and bash.

On Linux I might have run locale-gen to fill the missing locale files out, but that command doesn't seem to be available. Alternatively, export LC_ALL=C works, but because unicode symbols appear throughout my terminal use (my prompt, filenames, brew command-line output), this is a big compromise.

@savalo
Copy link

savalo commented Jul 10, 2020

@sshine thanks a lot! (on 10.15.5 works too)

@OfirYaron
Copy link

Thanks, It was exactly what I was looking for. solved the issue

@chimpy
Copy link

chimpy commented Jan 18, 2021

Thank you so much

@arslanimt123
Copy link

It is not working for me.
Screen Shot 2021-06-05 at 5 04 39 PM

Screen Shot 2021-06-05 at 5 03 29 PM

@khoimm92
Copy link

khoimm92 commented Apr 6, 2022

My quick way to disable that message:
Open Terminal -> Preferences -> Advanced tab -> uncheck to Set locale environment variables on startup

@tahirafridi
Copy link

export LC_ALL=en_US.UTF-8

Thanks @khoimm92

@viotti
Copy link

viotti commented Oct 11, 2022

My quick way to disable that message: Open Terminal -> Preferences -> Advanced tab -> uncheck to Set locale environment variables on startup

Nice tip. Thanks.

@chuangtc
Copy link

On macOS Catalina (10.15.4) using iTerm2, I made this work by export LC_ALL=en_US.UTF-8 only.

Thanks @sshine

On macOS Sonoma (14.1) using iTerm2 , zsh , I made this work by appending export LC_ALL=en_US.UTF-8 only in ~/.zshrc .

@matteocarnelos
Copy link

On iTerm:
Settings... > Profiles > Terminal > Uncheck Set locale variables automatically

@JacksonYao287
Copy link

you rock , this made my day

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