I have the Atom editor and was wondering how you can open a file or folder from the terminal in Atom. I am using a Mac. I am looking for a way to do this:
at
Roll your own with @Clockworks solution, or in Atom, choose the menu option Atom > Install Shell Commands. This creates two symlinks in /usr/local/bin
apm -> /Applications/Atom.app/Contents/Resources/app/apm/node_modules/.bin/apm
atom -> /Applications/Atom.app/Contents/Resources/app/atom.sh
The atom
command lets you do exactly what you're asking. apm
is the command line package manager.
On macOS you can add it to your ~/.bash_profile
as
alias atom='open -a "Atom"'
and from terminal just call
atom filename.whatever
Upgrading Atom appears to break command line functionality on the occasion. Looks like in my case it created two versions of the application instead of overwriting them. Occurs because the new file structure doesn't match file paths created by "Atom -> Install Shell Commands". In order fix the issue you'll need to do the following.
After that everything should work just like it did before. Hopefully this saves someone 30 minutes of poking around.
Make sure to put (move) the atom into Application directory.
With the Atom editor open, in the menu bar:
Click Atom >> Install Shell Commands
You should expect to see:
Potentially restart your terminal. (I did just out of habit, not sure if you need to)
I had the same issue which I resolved by first moving Atom.app from downloads to Applications. Then under Atom's menu options, I selected "Install Shell Commands".