Server Fault is a question and answer site for system and network administrators. 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

Whenever I use the sudo command, none of my environment variables appear to be preserved.

I've tried modifying the sudoers file, by removing the env_reset specification.

#Defaults   env_reset

I've also tried adding the env variable that I want using env_keep.

Defaults   env_keep += "DYLD_LIBRARY_PATH"

I'm using Mac Snow Leopard.

Is there something that I am missing?

share|improve this question

DYLD_LIBRARY_PATH seems to be excluded from the Defaults env_keep += "Defaults env_keep += "DYLD_LIBRARY_PATH" "

If you try any other variable it works for example Defaults env_keep += "VAR"

You can probably get over this by providing DYLD_LIBRARY_PATH on the commandline for example (where cmd is the command you want to pass DYLD_LIBRARY_PATH)


Hope this helps

share|improve this answer

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.