Installing Sublime Text's command line tool 'subl' in terminal, permission denied?

后端 未结 3 799
孤街浪徒
孤街浪徒 2020-12-22 16:47

I\'m tryng to use Sublime Text from the terminal, for example by typing subl.

I\'m following the steps from Sublime Text\'s website:

3条回答
  •  生来不讨喜
    2020-12-22 17:35

    I am assuming that you don't have the bin directory. You can do the following:

    cd 
    mkdir bin
    sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
    

    ln -s will create a alias of the subl file in your bin directory and you will be able to run the command.

    If this still doesn't work you will have to edit your .bash_profile. You can do it by following commands: (NOTE: For this to work you need to have done the above steps already.)

    1. Open your .bash_profile:

      cd                  // this will get you back to home directory
      vim .bash_profile   // this will open your .bash_profile file
      
    2. Edit .bash_profile: press I to get into "insert" mode and add following:

      export PATH=$PATH:~/bin
      
    3. Save and exit. Press Esc to get into command mode:

      :wq   // saves and close file
      exit  // exits terminal
      
    4. Reopen the terminal:

      subl --help
      

    That should bring up the help for Sublime Text.

提交回复
热议问题