How to open Atom editor from command line in OS X?

后端 未结 18 1837
天命终不由人
天命终不由人 2020-12-02 03:44

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         


        
相关标签:
18条回答
  • 2020-12-02 04:11

    For Windows 7 x64 with default Atom installation add this to your PATH

    %USERPROFILE%\AppData\Local\atom\app-1.4.0\resources\cli
    

    and restart any running consoles

    (if you don't find Atom there - right-click Atom icon and navigate to Target)

    0 讨论(0)
  • 2020-12-02 04:11

    Open the application by name:

    open -a 'Atom' FILENAME
    
    0 讨论(0)
  • 2020-12-02 04:13

    add path(:/usr/local/bin/) in profile.

    mac: $home/.bash_profile

    export PATH=$GOPATH/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:$PATH

    0 讨论(0)
  • 2020-12-02 04: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.

    0 讨论(0)
  • 2020-12-02 04:15

    Another simple solution is to add /usr/local/bin to your PATH. I had the same issue, I installed shell commands (see shaheenery's response) the symlinks already existed and pointing to the correct destination (see thomax's response), however I would still get 'not found'. I'm using Korn Shell btw.

    Here's what I did:

    1. Open your ~/.profile using your choice of editor (in my case $ emacs ~/.kshrc)
    2. Add this line: export PATH="/usr/local/bin:${PATH}"
    3. Save and exit
    4. Restart terminal or source ~/.profile
    5. Test $ atom -h
    0 讨论(0)
  • 2020-12-02 04:17

    In addition to @sbedulin (Greeting, lovely Windows users!)

    The general path on Windows should be

    %USERPROFILE%\AppData\Local\atom\bin
    

    If you are using a bash emulator like babun. You'd better checkout the shell files, which only available in the real app folders

    /c/User/<username>/AppData/Local/atom/app-<version>/resources/cli/apm.sh # or atom.sh
    
    0 讨论(0)
提交回复
热议问题