Skip to content

Instantly share code, notes, and snippets.

Created September 25, 2013 18:03
Show Gist options
  • Save vincentmac/6703537 to your computer and use it in GitHub Desktop.
Save vincentmac/6703537 to your computer and use it in GitHub Desktop.
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


Copy link

alexya commented May 27, 2016

It can't work to me.
When I right click a .py file from Finder or Desktop, there is no menu/sub-menus named like "Open in Sublime Text".
I don't know what I missed.

Copy link

frgooall commented Jul 7, 2016

Worked for me..thanks!

Copy link


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