It is relatively easy to set environment variables in LLDB, via

settings set target.env-vars DEBUG=1

However, I can't seem to find a way to append to an environment variable. The following doesn't work:

(lldb) settings set target.env-vars DEBUG=1
(lldb) settings set target.env-vars DEBUG=2$DEBUG
(lldb) settings show target.env-vars DEBUG
target.env-vars (dictionary of strings) =
  • More traditionally you'd be able to set variables when invoking lldb itslef and have them inherited, but apparently on Mac system integrity protection now resets the environment when invoking lldb... Commented Sep 10, 2020 at 20:18

1 Answer 1


Referencing variables with $ only works in the shell or if the program specifically supports it. You simply have to paste or type the old value manually.

Possibly you can use Python scripting to read and write the environment variables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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