hschmidt/EnvPane

Restart required for deleted variables

dwinfield opened this issue · 2 comments

Although changes to the variables are picked up when an app using that variable is restarted, if a variable is deleted, a restart of the computer is required.

I can reproduce this.

This happens on 10.10 and newer where a reimplementation of launchd breaks the unsetenv functionality. The corresponding API still exists in the reimplementation, and I assume attempts to emulate the legacy implementation; but evidently it is broken. Interestingly, launchctl unsetenv works because it isn't using the emulated legacy API but the new XPC-based API. To fix we need to reverse-engineer the new API—it is undocumented—and use it instead of relying on the emulation.