Skip to content

Instantly share code, notes, and snippets.

Created September 25, 2013 18:03
  • Star 45 You must be signed in to star a gist
  • Fork 12 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Sublime Text OSX Context Menu

Add Sublime Text to OS X Context Menu

  • Open Automator
  • Create a new Service
  • Add a Run Shell Script action
  • Set input to Service receives selected files or folders in any application
  • Set the script action to /Applications/Sublime\ -n $@
  • Set Pass input to as arguments
  • Save as Open in Sublime Text
Copy link

cleydyr commented Aug 2, 2016

Worked for me as well. Thanks, man!

Copy link

Thank you!

Copy link

ismnoiet commented Nov 8, 2016

@vincentmac what if i want "Open in Sublime Text" to appear at the top level context menu and not under the "services" item,
thanks in advance.

Copy link


Copy link

mi-lee commented Aug 19, 2017

you can also do this if you want to open the parent directory of the selected file:

FOLDER="$(dirname "$@")"
/Applications/Sublime\ -n $FOLDER

Copy link

roblav96 commented Dec 15, 2018

Requirement -> /bin/bash

Originally tried /usr/bin/zsh but that threw errors.

Copy link

leoblum commented Jan 22, 2021

For my environment, I needed to wrap $@ in quotes

/Applications/Sublime\ -n "$@"

or else it opened up a bunch of nonsense when the path contained whitespace.

Thank you 👍

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