---
name: "environ"
section: "7"
platform: "macos"
package: "Libc"
version: "1752.120.2"
release: "macOS 26.5"
platforms: ["linux", "freebsd", "openbsd", "macos"]
url: "https://new.carta.tech/environ/7"
---

# environ(7)

user environment

## NAME

**environ** – user environment

## SYNOPSIS

*extern* *char* *\*\*environ*;

## DESCRIPTION

An array of strings called the *environment* is made available by [execve(2)](/execve/2.md) when a process begins. By convention these strings have the form “*name=value*”. The following names are used by various commands:

- BLOCKSIZE

  The size of the block units used by several commands, most notably [df(1)](/df/1.md), [du(1)](/du/1.md) and [ls(1)](/ls/1.md). This variable is processed by the [getbsize(3)](/getbsize/3.md) function.

- COLUMNS

  The user's preferred width in column positions for the terminal. Utilities such as [ls(1)](/ls/1.md) and [who(1)](/who/1.md) use this to format output into columns. If unset or empty, utilities will use an [ioctl(2)](/ioctl/2.md) call to ask the terminal driver for the width.

- EDITOR

  Default editor name.

- EXINIT

  A startup list of commands read by [ex(1)](/ex/1.md) and [vi(1)](/vi/1.md).

- HOME

  A user's login directory, set by [login(1)](/login/1.md) from the password file [passwd(5)](/passwd/5.md).

- LANG

  This variable configures all programs which use [setlocale(3)](/setlocale/3.md) to use the specified locale unless the LC\_\* variables are set.

- LC\_ALL

  Overrides the values of LC\_COLLATE, LC\_CTYPE, LC\_MESSAGES, LC\_MONETARY, LC\_NUMERIC, LC\_TIME and LANG.

- LC\_COLLATE

  Locale to be used for ordering of characters. Note that this may also affect character ranges in [regex(3)](/regex/3.md), e.g., “\[A-Z\]” may include characters that “\[\[:upper:\]\]” would not, depending on how the specified locale orders characters.

- LC\_CTYPE

  Locale to be used for character classification (letter, space, digit, etc.) and for interpreting byte sequences as multibyte characters.

- LC\_MESSAGES

  Locale to be used for diagnostic messages.

- LC\_MONETARY

  Locale to be used for interpreting monetary input and formatting output.

- LC\_NUMERIC

  Locale to be used for interpreting numeric input and formatting output.

- LC\_TIME

  Locale to be used for interpreting dates input and for formatting output.

- MAIL

  The location of the user's mailbox instead of the default in /var/mail, used by [mail(1)](/mail/1.md), [sh(1)](/sh/1.md), and many other mail clients.

- NLSPATH

  List of directories to be searched for the message catalog referred to by LC\_MESSAGES. See [catopen(3)](/catopen/3.md).

- PAGER

  Default paginator program. The program specified by this variable is used by [mail(1)](/mail/1.md), [man(1)](/man/1.md), [ftp(1)](/ftp/1.md), etc, to display information which is longer than the current display.

- PATH

  The sequence of directories, separated by colons, searched by [csh(1)](/csh/1.md), [sh(1)](/sh/1.md), [system(3)](/system/3.md), [execvp(3)](/execvp/3.md), etc, when looking for an executable file. PATH is set to \`\`/usr/bin:/bin'' initially by [login(1)](/login/1.md).

- PRINTER

  The name of the default printer to be used by [lpr(1)](/lpr/1.md), [lpq(1)](/lpq/1.md), and [lprm(1)](/lprm/1.md).

- PWD

  The current directory pathname.

- SHELL

  The full pathname of the user's login shell.

- TERM

  The kind of terminal for which output is to be prepared. This information is used by commands, such as [nroff(1)](/nroff/1.md) or [plot(1)](/plot/1.md) which may exploit special terminal capabilities. See */usr/share/misc/termcap* ([termcap(5)](/termcap/5.md)) for a list of terminal types.

- TERMCAP

  The string describing the terminal in TERM, or, if it begins with a '/', the name of the termcap file. See TERMPATH below, and [termcap(5)](/termcap/5.md).

- TERMPATH

  A sequence of pathnames of termcap files, separated by colons or spaces, which are searched for terminal descriptions in the order listed. Having no TERMPATH is equivalent to a TERMPATH of “*$HOME/.termcap:/etc/termcap*”. TERMPATH is ignored if TERMCAP contains a full pathname.

- TMPDIR

  The directory in which to store temporary files. Most applications use either “/tmp” or “/var/tmp”. Setting this variable will make them use another directory.

- TZ

  The timezone to use when displaying dates. The normal format is a pathname relative to “*/usr/share/zoneinfo*”. For example, the command “env TZ=America/Los\_Angeles date” displays the current time in California. See [tzset(3)](/tzset/3.md) for more information.

- USER

  The login name of the user.

Further names may be placed in the environment by the **export** command and *name=value* arguments in [sh(1)](/sh/1.md), or by the **setenv** command if you use [csh(1)](/csh/1.md). It is unwise to change certain [sh(1)](/sh/1.md) variables that are frequently exported by *.profile* files, such as MAIL, PS1, PS2, and IFS, unless you know what you are doing.

The current environment variables can be printed with [env(1)](/env/1.md), [set(1)](/set/1.md) or [printenv(1)](/printenv/1.md) in [sh(1)](/sh/1.md) and [env(1)](/env/1.md), [printenv(1)](/printenv/1.md) or the **printenv** built-in command in [csh(1)](/csh/1.md).

## PROGRAMMING

Programs can query and modify the environment, using the environment routines [getenv(3)](/getenv/3.md), [putenv(3)](/putenv/3.md), [setenv(3)](/setenv/3.md) and [unsetenv(3)](/unsetenv/3.md). Direct access can be made through the global variable *environ*, though it is recommended that changes to the enviroment still be made through the environment routines.

Shared libraries and bundles don't have direct access to *environ*, which is only available to the loader [ld(1)](/ld/1.md) when a complete program is being linked. The environment routines can still be used, but if direct access to *environ* is needed, the **\_NSGetEnviron**() routine, defined in ⟨crt\_externs.h⟩, can be used to retrieve the address of *environ* at runtime.

## SEE ALSO

[cd(1)](/cd/1.md), [csh(1)](/csh/1.md), [env(1)](/env/1.md), [ex(1)](/ex/1.md), [login(1)](/login/1.md), [printenv(1)](/printenv/1.md), [sh(1)](/sh/1.md), [execve(2)](/execve/2.md), [execle(3)](/execle/3.md), [getenv(3)](/getenv/3.md), [putenv(3)](/putenv/3.md), [setenv(3)](/setenv/3.md), [unsetenv(3)](/unsetenv/3.md), [setlocale(3)](/setlocale/3.md), [system(3)](/system/3.md), [termcap(3)](/termcap/3.md), [termcap(5)](/termcap/5.md)

## HISTORY

The **environ** manual page appeared in 4.2BSD.
