Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to force "lpstat" utility to show output messages in English under localized Mac OS X (version 10.6)?


lpstat -v

Shows in Dutch:

apparaat voor Samsung_SCX_4300_Series: usb://.....

I need to force it to show the message in English in order to be able to parse the output by the application using regexp ("device for" prefix):

device for Samsung_SCX_4300_Series: usb://

I have tried running it with "LANG=en_US.UTF-8" prefix, "LC_MESSAGES=C" prefix, etc. but none of those appear to have any effect under Mac. English language is listed under system preferences on the second position.

share|improve this question
up vote 3 down vote accepted

Apple made some modifications to the locale detection in the version of CUPS that it ships.

Looking through the Apple-modified version of cups/language.c (specifically, 10.6.8’s language.c), I found that you should be able to override the language by setting LANG to your preferred language as long as you also set SOFTWARE (any value, even the empty string).

If you do not have both SOFTWARE and LANG set, then it will default to reading the preferred (first) language in the “Language” tab of the “Language & Text” pane of System Preferences.

The following shell command should yield the default/English messages:

SOFTWARE= LANG=C lpstat -v

Adjust the environment accordingly if you are not invoking lpstat through a shell (e.g. not via system(3) or similar).

share|improve this answer
That did the trick! – dimitri Mar 9 '12 at 10:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.