0

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

2
  • rvm lets you control multiple ruby/rails versions. It should not impact your sublime install. Commented Feb 13, 2013 at 21:49
  • Also, Applications/Sublime Text 2 is not the right folder for linux, I think that command is for Macs. On my computer sublime was installed at /usr/lib. Commented Feb 13, 2013 at 22:00

3 Answers 3

1

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 "$@" 
Sign up to request clarification or add additional context in comments.

3 Comments

Alright I looked in usr/bin and it had 2 files sublime_text and sublime_text~ so as instructed, I executed the commands cd /usr/bin sudo cp sublime_text subl Then it told me this: cp: not writing through dangling symlink 'subl' So does that mean I need to go back and delete those files I initially created with the sudo ln -s command?
Yes. The symlink is broken because it is not pointing to anything.
so then I would do rm usr/bin/subl? Edit: Bingo! Thanks so much this finally worked!
0

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!

3 Comments

Alright so I added export PATH=$PATH:/usr/bin/subl to the .bashrc file. Is that what you meant? And then I typed . ~/.bashrc into the terminal, hit enter, and restarted the terminal. But subl was still not recognized as a command. I guess I'm not even sure what you mean by a path to the binary. Is that similar to the .exe of a program in windows? I literally started using Linux for the first time yesterday.
path is a list of directories in which the OS searches for binaries. If you echo $PATH you should see the correct path to your binary.
So this is what I get when I type in echo $PATH: /home/aaron/.rvm/gems/ruby-1.9.3-p385@railstutorial/bin:/home/aaron/.rvm/gems/ruby-1.9.3-p385@global/bin:/home/aaron/.rvm/rubies/ruby-1.9.3-p385/bin:/home/aaron/.rvm/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games Now, with that information, what EXACTLY am I supposed to do?
0

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.

7 Comments

When I typed that in, it said it failed to create symbolic link because the file exists so that must have been what I typed in the first place, just not in this question. In fact, I probably did it both ways just to try to get something to work.
Ok. But it's really an obvious typo. Couldn't help pointing it out. :)
You could try ls -al /usr/bin and see if subl is there and where it's linked to.
it says subl -> /home/aaron/Applications/Sublime Text 2/sublime_text By the way, wtf is up with file structure browsing in Linux? If I go to the home folder, there is no folder named aaron. Also, if it matters, right below that first entry, it says sublime_text and then sublime_text~ if that matters
Your "Home" folder is located at /home/username/. Irregardless, the symlink is not pointing to the right location.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.