zsh: command not found: atom
Asked Answered
I

3

9

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!

Implicatory answered 11/4, 2019 at 21:59 Comment(8)
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.Rafter
When I run the command, which atom, my path is as follows: /usr/local/bin/atom. What do I then need to do?Implicatory
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.Rafter
Aah gotcha. Yeah it's a pretty annoying issue. What other information would be necessary to try to troubleshoot it further?Implicatory
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.Rafter
Sounds good. I'll monitor the issue and try to go from there. Do you have other ideas in the meantime?Implicatory
Not really. It's unlikely to be something really exotic and weird, but I don't really have any more useful ideas right now. - Good luck!Rafter
Check your PATH when the problem is happening. Seeing what the value actually is gives you a place to start in looking for the code that sets it.Leda
J
15

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
Jilolo answered 17/12, 2019 at 1:51 Comment(1)
You need to be root to be able to create a symlink in /usr/local/bin or delete it.Tribe
T
15

I had this issue on my Mac, figured it out with the info below.

To install the atom and apm commands, run "Window: Install Shell Commands" from the Command Palette, which will prompt you for an administrator password.

Steps:

  1. Open Atom

  2. If you press Cmd+Shift+P while focused in an editor pane, the command palette will pop up.

  3. Type/run "Window: Install Shell Commands"

You can also simply open Atom, click "Atom" from the Menu bar, then select "Install Shell Commands"

Tredecillion answered 30/8, 2021 at 23:13 Comment(2)
Easiest and simplest way, thanks!Joanjoana
This works for me... until I restart my computer.Sunup
S
0

If you're using oh-my-zsh, just uncomment the first line of ~/.zshrc -

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

enter image description here

That worked for me !

Sprightly answered 11/2, 2022 at 15:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.