I want to use C.UTF-8
locale in MacOS(10.15.3) that doesn't exist by default.
And there is no locale-gen
command in Mac.
How can I create a locale in MacOS?
I only use the locale for Postgresql DB.
I want to use C.UTF-8
locale in MacOS(10.15.3) that doesn't exist by default.
And there is no locale-gen
command in Mac.
How can I create a locale in MacOS?
I only use the locale for Postgresql DB.
You aren't using Debian Linux. locale-gen
is a Debian tool, a shell script that wraps around the actual standard tool for creating locales. This tool is localedef
, as described in the Single Unix Specification and as available on MacOS.
It takes a locale source file and a character map file as input. The SUS specifies the formats for both, and according to the Apache C++ manual for its own localedef
it used to be the case (but apparently no longer) that one could download locale source files from The Open Group.
Note that one reported way to configure C.UTF-8
on MacOS is to use the C locale and overlay the UTF-8 locale, that MacOS has, just for character typing, i.e.
export LANG=C LC_CTYPE=UTF-8
This is reportedly what MacOS terminal emulators set up in their child process environments. It used to be how things worked on FreeBSD, too. (Setting a *.UTF-8 locale for LANG
effecively did the same thing, thanks to the LC_CTYPE
locale file being a symbolic link to ../UTF-8/LC_CTYPE
in those locales.)
Note that the 4.4BSD mklocale
tool is not for creating locales. It is for specifically creating the character type portions of locales.
man localedef
localedef
. The Open Group Base Specifications. IEEE Std 1003.1-2017.localedef
. Apache C++ Standard Library Reference Guide. apache.org.