0

I use the Atom editor and I like to open it from the command line. For that purpose I execute the following line:

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

The problem is that if I restart the computer, the link stops working, so I have to delete the file

rm /usr/local/bin/atom

and execute the first line to create the link again. I don't understand why this happens.

  • 1
    What does less /usr/local/bin/atom show after a reboot? And ls -l /usr/local/bin/atom /Applications/Atom.app/Contents/Resources/app/atom.sh? – nohillside Jul 12 '17 at 15:52
2

I tried it myself and it worked perfectly, even after a reboot. Do you have multiple disks/partitions in you set up?

Anyway, to settle things once and for all, I suggest you to follow the steps pointed out here. Below is a copy&paste.

With the Atom editor open, in the menu bar:

Click Atom >> Install Shell Commands

enter image description here

You should expect to see:

enter image description here

You do not need to restart the terminal.

If this solution didn't work, my last suggestion is to create an alias in your ~/.bash_profile. To do this, simply open ~/.bash_profile with a text editor and add somewhere the line:

alias atom='open -a Atom'

This should do the trick.

EDIT

I noticed that after a reboot, you must start Atom at least once before the atom command works - otherwise it won't be recognized as a command. I didn't notice it before because, while testing if the ln -s ... solution worked, I already opened Atom once. I honestly don't have a clue why this happens, but the last suggestion about adding an alias definitely solves this issue.

  • sorry, it did not really worked. When I restart the computer it does not work anymore and I have the same behaviour as before – agusgambina Jul 17 '17 at 18:36
  • Did you try the "alias" solution? – Alessandro Jul 17 '17 at 22:20
  • sorry I didn't realize the alias solution, it worked. However, I will try to understand why the ln -s is not working. Thank you very much – agusgambina Jul 18 '17 at 12:47
  • Thank you!! 👆This answer is the best for this issue. I Google searched for days, and before this, all I found was either variations of that Stack Overflow answer or sassy devs arguing with each other. 😑 So thank you again! – Austin Ratcliff May 15 '18 at 3:07
1

You might want to make sure Atom app is actually executing from the Applications folder and then install the Shell Commands utility. I was executing Atom from my Downloads folder and every time I rebooted the atom commands weren't recognized.

You must log in to answer this question.

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