hschmidt / EnvPane

EnvPane - An OS X preference pane for environment variables
Other
734 stars 52 forks source link

Restart required for deleted variables #11

Closed dwinfield closed 7 years ago

dwinfield commented 9 years ago

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.

hschmidt commented 7 years ago

I can reproduce this.

hschmidt commented 7 years ago

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.