trouble getting sublime to execute with linux term

2020-08-04 10:00发布

I know a few similar questions have been asked, but none seemed to help me so here it goes. I am trying to get sublime to run when I use 'subl' in the Linux terminal but I just cannot get it to work. I tried

sudo ln -s /Applications/Sublime\ Text\ 2/sublime_text usr/bin/subl 

and that did create the file correctly so it seems, but then when I use the subl command it says 'No command 'subl' found.' Now I have rvm installed, so that may make a difference. I also tried 'usr/local/bin/subl' and the result was the same. I even used the rvmsudo afterward with the above command and it said file already created, and yet the subl command still does not work. What am I missing here? Keep in mind that I am a)new to linux b)new to sublime. Running ubuntu 12.10 if it matters

3条回答
成全新的幸福
2楼-- · 2020-08-04 10:09

Brotherman, you have to update your path. It's probably easier than mucking around with ln -s softlinks. Go into your ~/.bashrc and at the bottom somewhere add export PATH=$PATH:/path/to/your/binary.

Then all you should have to do is . ~/.bashrc and voila!

查看更多
forever°为你锁心
3楼-- · 2020-08-04 10:13

I think you had a typo. It should be

sudo ln -s /Applications/Sublime\ Text\ 2/sublime_text /usr/bin/subl 

Notice the / before usr. If you tell terminal usr/bin/subl, it'll take it as a relative path and create it in reference to the directory you were on when you executed this command.

查看更多
何必那么认真
4楼-- · 2020-08-04 10:21

I'm using Linux Mint 13, but should be similar for you. cd into /usr/bin. There should a file called sublime-text-2. Copy that file and name subl. Then subl command should be usable in the terminal.

cd /usr/bin
sudo cp sublime-text-2 subl

Just in case, here is the contents of the file:

#!/bin/bash

/usr/lib/sublime-text-2/sublime_text --class=sublime-text-2 "$@"
查看更多
登录 后发表回答