Skip to content

Instantly share code, notes, and snippets.

@nucliweb
Last active June 29, 2022 09:26
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save nucliweb/f984b9fc75a1c82ef1a1 to your computer and use it in GitHub Desktop.
Save nucliweb/f984b9fc75a1c82ef1a1 to your computer and use it in GitHub Desktop.
Sublime Text 3 on OS X Terminal

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'
@davecarter
Copy link

Astonishing! 👯
Thanks for sharing!

@davecarter
Copy link

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

@lintojohny
Copy link

it works

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