Subl command not working - command not found

匿名 (未验证) 提交于 2019-12-03 02:45:02

问题:

Having loads of difficulty getting this set up. I've fixed up my .bash_profile, created the symlink using the following command from the sublime website:

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

Yet when I input that command I get:

ln: /Users/my_username/bin/subl: No such file or directory 

It appears my terminal is looking at the wrong place for the file? Why is it trying to point to a bin folder on my home directory?

回答1:

create the symlink in /usr/local/bin instead of ~/bin and make sure that /usr/local/binin in PATH.

$ ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/. $ echo $PATH 

If you don't find /usr/local/bin/, then add the following lines to your .bashrc or .zshrc

PATH=$PATH:/usr/local/bin/; export PATH 


回答2:

This solved my sublime terminal (subl) command issue after battling for a while on Yosemite here is the source

sudo su rm /usr/local/bin/subl ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl exit 


回答3:

if you are using "Sublime Text 2" try this:

$ ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl 

or, if you path is in /usr/bin/ instead /usr/local/bin

$ ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/bin/subl 


回答4:

My similar problem was solved simply by omitting the quotes. So if you're working with:

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

I instead did:

ln -s /Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl ~/bin/subl



回答5:

Launch Sublime Text from the command line on OSX

Following the directions above are what worked for me. I use Sublime Text 3 and only had to c+p the below into the cli. I did this at the root level $ cd ~

If your using Sublime Text 3 c+p this into the command line:

// Sublime Text 3 $ ln -sv "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl 

If your using Sublime Text 2 c+p this code below into the command line:

// Sublime Text 2 $ ln -sv "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl 

Now test it out to see if it works

Open a new file from the command line:

$  subl test.rb  // it should open new file test.rb in Sublime Text 

Open a project folder

$ subl dir/myProject // opens a new folder inside Sublime 

Launch Sublime app:

$ subl // launches Sublime 

To open Sublime Help for more detailed options use:

$ subl -h // Sublime help 


回答6:

At my end subl was working fine but git was unable to access it. And was displaying these errors

subl -n -w: subl: command not found error: There was a problem with the editor 'subl -n -w'. 

For Mac OS X in the file ~/.gitconfig under [core] I had to put this code to solve the issue on my end.

editor = /Applications/Sublime\\ Text.app/Contents/SharedSupport/bin/subl  -n -w 


回答7:

When I dutifully copy-pasted sarbbottam's command, my terminal reported that the file already existed. I had tried copy-pasting several stack overflow answers to this problem into my terminal, so I had symlinks called "subl" and "sublime" in my /usr/local/bin: I could see the file when I listed all files in that directory with "ls -a". So I tried to open the "subl" in a text editor, and it said that the file didn't exist!

So I deleted the "subl" symlink in /usr/local/bin, ran the command, and it worked. I think I accidentally made one for Sublime Text 2 or something, and just figured I'd be overwriting the last one which was not the case.



回答8:

There might be an issue with having multiple symbolic links to the same target. I removed my link "subl" and my link "sublime" still works.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!