There are many questions and commentary about using launchctl setenv PATH /path/to/include in order to have GUI apps inherit user-specified paths. I did this about four years ago, and the changes I added have persisted to 10.11.6 (current OS). Unfortunately for me, I have long forgotten these settings until recently...

None of the man pages or commentary indicates how to revert these changes to factory defaults. For instance, running launchctl getenv PATH yields:


Running launchctl setenv PATH [blank] is evidently an error, demanding a non-blank value. I'm also hesitant to experiment with this much because I don't know whether there is a macOS default setting for this key-value pair.

Can someone please tell me how I can flush the current contents of launchctl getenv PATH or to return its content to what would appear in a fresh install? I would rather not replace what's currently there with the default paths from /etc/profile and the like, unless those are the self-same values that appear when running launchctl getenv PATH on a fresh installation.


Running launchctl unsetenv PATH did clear out the variable, but it did not persist after reboot - i.e., the same path values returned after a restart.

1 Answer 1


What ended up working to restore to default "factory presets" for me was to run:

sudo launchctl config user path /usr/bin:/bin:/usr/sbin:/sbin

This is not unlike the advice seen here (Set PATH variable so that it is detected in all applications, even outside terminal. (El Captain)). But some lingering questions remain:

  1. Does this procedure restore what was already in the key-value pair of user path, or does it enact a new setting that would otherwise be empty?
  2. Where, i.e., in what file or database, is this key-value stored?
  • You can set the same value as the default would be, however, you will mask the real default after the launchctl config user path call (this will be a problem after the default changes). - FYI: If you have ran the launchctl config user path you can revert changes by the defaults delete /private/var/db/com.apple.xpc.launchd/config/user.plist PathEnvironmentVariable command.
    – andras.tim
    Jun 9 at 4:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .