Certain Commands are not Found in Catalina’s Zsh

catalinacommand line

This is sort of a specific question that seems like it would be better suited over on Atom's user blog, but I figured I would post this here as well as I have actually asked it there and have received no response. I've been having some issues ever since being pushed to switch to Zsh over Bash in macOS Catalina. A lot of the issues seem to be surrounding commands not being recognized under certain circumstances.

As mentioned, the issue I'm currently having has to with with Atom editor and the shell commands that can be installed with it. After downloading Atom and running the Install Shell Commands in the Atom menu, you should be able to launch Atom via the command line with the atom <file> command. My issue is that, the command is not recognized at all until I manually the launch the application once. If I try to use the command, I'm greeted with zsh: command not found: atom. After the application is launched manually (outside of the command line), Zsh no longer reports that it cannot find the command atom command, and it begins to work. This all resets as soon as I turn my computer off and on.

Does anyone know what could be causing this? This never happened pre-Catalina.

Best Answer

I am going to bypass what could be causing it, to tell you how to “cure” it.

First, find out the exact path of “atom” (not Atom.app). It is probably embedded somewhere inside of Atom.app, but it's possible the Install Shell Commands copies it to somewhere else.

If it disappears on a reboot, it might be copied to /tmp (!). If that is the case, do echo $path and copy it to one of those directories.

After you have atom in a location that won't be erased on reboot, ensure that location is in your zsh $path as discussed in How does zsh find commands?