Skip to content

Instantly share code, notes, and snippets.

@davecarter
Forked from nucliweb/gist:f984b9fc75a1c82ef1a1
Last active December 10, 2015 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davecarter/0a4fea4d6cbd08e4812f to your computer and use it in GitHub Desktop.
Save davecarter/0a4fea4d6cbd08e4812f to your computer and use it in GitHub Desktop.

Sublime Text 3 on OS X Terminal

By creating link

Linking into /usr/bin with sudo:

$ sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/bin/sbl

By creating alias

in .bash_profile file add line:

alias sbl='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl' 

reopen Terminal or relaunch by:

$ source ~/.bash_profile

To run

# to open file
$ sbl <filename>
# to open current directory
$ sbl .

To use Sublime Text as default editor

set your EDITOR environment variable:

# with -w will not exit until the file is closed
$ export EDITOR='sbl -w'

Update for MacOSX 10.11 El Capitan

In the new MacOSX version you are not allowed to write to in /usr/bin system folder. Use /usr/local/bin instead:

$ ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/sbl
@delacruz-dev
Copy link

Hey! Thanks for the tip!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment