Sublime Text 3 and Terminal for OS X Mavericks?

I am trying to configure Sublime Text 3 on OS X Mavericks and get levels of frustration.

I followed all the usual suspects regarding installation and configuration, i.e. Google on Sublime Text and Stack Overflow. Inevitably, this is something secondary that I miss, but it causes me the main heartburn.

What i have done so far:

The problems begin here. I know that the symbolic link provided in this link uses ST2, but I want to use " sublime " instead of " subl " (personal preference). I searched and found what I need to insert into the terminal for ST3:

 ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/usr/local/bin/sublime 
  • There was already a file ~ / .bash_profile: export PATH=/usr/local/bin:$PATH . However, when I echo $PATH , I get:

     /usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin 

    Does this look right?

  • Now when I enter sublime in the terminal, I get command not found

What am I missing. It drives me crazy when I fell that I followed all the steps, but ST3 still doesn't work for me.

+55
command-line terminal sublimetext3 macos
Oct 23 '13 at 13:53 on
source share
7 answers

Must be:

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

Notice that I deleted the tilde ( ~ ). Unix's tilde ( ~ ) refers to your user's home directory, so your source was right, but the second argument put the link in / Users / [your username] / usr / local / bin /, which is not included in $ PATH.

In your note, you said you tried to remove quotes from the original argument. If you remove quotes, you should definitely avoid the space character as follows:

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

That should work too.

+126
Oct 23 '13 at 15:48
source share
— -

Mavericks does not ship with the ~ / bin directory, but found that I had difficulty trying to install the subl command in any of the low-level bin bin directories. I found that the following solution works neatly:

Create the ~ / bin directory for your user:

 mkdir ~/bin 

Add subl command as per Sublime Text documentation:

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

Open / etc / paths in your (second) favorite text editor:

 sudo vi /etc/paths 

Add the active user ~ / bin folder. Here, as my courted, as I added ~ / bin:

 ~/bin /usr/bin /bin /usr/sbin /sbin /usr/local/bin 
+14
Nov 22
source share

Instead of having bulky sudo links to configure, I prefer to use the simple bash function and use the native Mac open command:

 #somewhere in your .bashrc or .zshrc sublime () { open -a "Sublime Text" $@ } 

Now all you have to do is sublime . whenever you want to open a sublime from a given folder. Obviously, you can simply rename it subl .

Note The name for the entry in the -a parameter is the name of the application, which is stored in the /Applications folder:

enter image description here

+10
Apr 13 '15 at 10:00
source share

After days of dealing with the problem, this worked for me.

Make sure ~/usr/bin set to $PATH

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

If you are denied permission:

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

Enter your password.

+8
Dec 02 '13 at 20:41
source share

This works for me too:

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

What you can write simply:

 st filename.file extension 

It should work. I tried so many things, but at first it worked.

+1
Mar 02 '17 at 14:52
source share

The answers that have already been given are all right, but what about making your life easier and relying on good tools;)

  • Install 'Oh My ZSh' (imho: should be) https://github.com/robbyrussell/oh-my-zsh
  • Open the configuration file: ~ / .zshrc
  • Add elevated plugins: plugins = (elevated) (other recommendations: brew color git osx)
  • Open a terminal on steroids and type: st foo.txt
  • Kidnapping in bliss and reading other interesting things “Oh My ZSh” can do for you!
0
May 22 '15 at 11:27
source share

If you want to run Sublime from the terminal, add the following to your ~/.bash_profile file ( ~/.zshrc if you use zsh ).

 subl () { open -n -b "com.sublimetext.3" --args $* ;} 

Now you can just enter subl . to any folder to start editing files in this folder.

0
Jul 14 '15 at 21:05
source share



All Articles