I am just curious what the meaning is of this bizarre directory from which atom is launched to edit a function from the Fish shell. Anyone have any idea?enter image description here

up vote 2 down vote accepted

/var/folders can be thought of as macOS's modern way of doing /tmp. It's a place for apps to write temporary files, so that your data is safe/recoverable even if you haven't explicitly saved your edits/changes yet. The random-ish names avoid name collisions.

If you do a…

sudo find /var/folders | more

…you'll see that lots of apps and services write stuff there.

When you use the funced fish command it writes the function definition to a temporary file then launches your editor with the name of that file. As @Spiff points out in his answer the specifics of the temporary file name depends on the OS. It is also affected by environment variables such as $TMPDIR. The reason such "bizarre" path names are created is to avoid collisions with temporary files created by other processes.

  • Thanks. Does any of you know why when I launch atom that way, it doesn't work? The window comes up empty, and when I type into it and save, it doesn't update the function. Doing the exact same thing with nano does work... – pitosalas Jun 29 '16 at 13:43
  • Probably because atom is detaching itself from the foreground. Many graphical editors (i.e., those that run in their own window) do so. You need to run it with an option that keeps it from detaching from the foreground. For example, if you want to use Vim in GUI mode for this purpose you would use "vim -g -f". Note the "-f" to keep it in the foreground. If you don't do that fish thinks the editor exited immediately and assumes you're done editing the function. – Kurtis Rader Jun 29 '16 at 13:56

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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