env reads -u after a NAME=value word as the command name
PitfallVerified 2 Oct 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.
Symptom#
A command that sets one variable and unsets another fails before the tool starts:
env: -u: No such file or directory
Cause#
env stops reading options at the first NAME=value word. Everything after the assignments is the command to run, so -u becomes the program name.
Fix#
Put every option before the assignments:
Evidence#
On macOS, env HOME=$T/home RVOW_HOME=$T/rh -u XDG_CONFIG_HOME rvow install printed env: -u: No such file or directory. With the two -u options first, the same command ran.
Also found by searching
- env: -u: No such file or directory
- env VAR=value -u UNSET_VAR command fails
- how do I unset an environment variable and set another with env
- env treats -u as the command name