Skip to content

Instantly share code, notes, and snippets.

@jackilyn
Last active October 1, 2015 20:37
Show Gist options
  • Save jackilyn/2053952 to your computer and use it in GitHub Desktop.
Save jackilyn/2053952 to your computer and use it in GitHub Desktop.
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text from the Mac OS X Terminal

Create a symlink called sublime: ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime

Check to see if /usr/local/bin is in your PATH: open ~/.zshrc

Make sure it says: export PATH=/usr/local/bin:/example/other/dirs/

Back in the terminal enter this to refresh the file: source ~/.zshrc

Now you can type sublime to open up Sublime Text, sublime . to open the current directory or sublime some-file.txt to open the directory/file in Sublime Text.

Now, to set Sublime Text as the default editor set the EDITOR environment variable: export EDITOR='sublime'

@pierrecholhot
Copy link

April 19th, 2013 > Sublime Text 2 version 2.0.1, Build 2217 on OSX 10.8.3

The -w doesn't seem to be needed anymore; Actually adding it now inverses the way it worked.
Adding it, makes the terminal command exit before editing the file in sublime
Removing it, will properly make the sublime command to not exit until the file is closed.

Can someone confirm this ? Tested on 3 different "new" macs. Default installations.

@tamzheartbeatz
Copy link

Totally works without -w. Thanks a ton!

@samdutton
Copy link

Thanks!

Can just use this now (with no Sublime version):

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

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