0
votes

This seems to be happening randomly, but every once in a while my "atom ." command in order to open a directory in atom won't work.

I run into the following terminal error - "zsh: command not found: atom".

Once I open up Atom manually, I can go ahead and install shell commands and the command works. However, the shell commands don't seem to be saving.

I've tried to edit my zshrc file and uncommented line two "export PATH=$HOME/bin:/usr/local/bin:$PATH". But this issue seems to still be happening.

Any help would be greatly appreciated!

Thanks!

1
This would depend very much on where atom is installed (use which atom to find out at any time the atom command actually works). Then, make sure the containing directory is listed in your PATH setting in .zshrc. - Jan Krüger
When I run the command, which atom, my path is as follows: /usr/local/bin/atom. What do I then need to do? - Marc
In that case your export as shown in your question looks okay. You probably have something else somewhere in your config that overrides your PATH. (Or, for instance, you're running in an elevated shell using su or sudo, which may use root's shell config instead.) This is hard to troubleshoot from afar without any further information, though. - Jan Krüger
Aah gotcha. Yeah it's a pretty annoying issue. What other information would be necessary to try to troubleshoot it further? - Marc
Well that's the problem, it's basically a (possibly long) stroll through your home directory, or possibly even other directories like /etc. I'd recommend for you to try and understand what is different when the command doesn't work - i.e. what did you do before, what commands did you use in the same shell/terminal window, etc. Once you figure out a pattern, it becomes easier to try and figure out where the problem is coming from. - Jan Krüger

1 Answers

7
votes

When Atom installs it automatically creates a symlink in your /usr/local/bin. However in case it hasn't, you can create it yourself on your Mac

ln -s /Applications/Atom.app/Contents/Resources/app/atom.sh /usr/local/bin/atom

Now you can use atom folder_name to open a folder and atom file_name to open a file. Hope this helps.

If you get "File exists" and the Atom command still dose not work just delete it and type the command over again.

To delete atom simply cmd+shift+G and paste

/usr/local/bin/atom