Skip to content

Instantly share code, notes, and snippets.

Embed
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\ Text.app/Contents/SharedSupport/bin/subl -n $@
  • Set Pass input to as arguments
  • Save as Open in Sublime Text
@kakulukia

This comment has been minimized.

Copy link

kakulukia commented Oct 22, 2014

awesome!

@larschinkel

This comment has been minimized.

Copy link

larschinkel commented Dec 19, 2014

Thanks :)

@vsatyanaveen

This comment has been minimized.

Copy link

vsatyanaveen commented Jan 13, 2015

Thanks a lot

@willcharlton

This comment has been minimized.

Copy link

willcharlton commented Jan 20, 2015

Awesome. Thanks!

@willcharlton

This comment has been minimized.

Copy link

willcharlton commented Jan 20, 2015

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

/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n "$@"

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

@mobbSF

This comment has been minimized.

Copy link

mobbSF commented Feb 14, 2015

Great, much appreciated!

@pierreprinetti

This comment has been minimized.

Copy link

pierreprinetti commented Aug 6, 2015

👍

@alexya

This comment has been minimized.

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.

@frgooall

This comment has been minimized.

Copy link

frgooall commented Jul 7, 2016

Worked for me..thanks!

@JoeDorseyJr

This comment has been minimized.

Copy link

JoeDorseyJr commented Jul 31, 2016

Thanks!

@cleydyr

This comment has been minimized.

Copy link

cleydyr commented Aug 2, 2016

Worked for me as well. Thanks, man!

@sumeetadur

This comment has been minimized.

Copy link

sumeetadur commented Aug 29, 2016

Thank you!

@ismnoiet

This comment has been minimized.

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.

@suvradip

This comment has been minimized.

Copy link

suvradip commented Mar 12, 2017

great

@mi-lee

This comment has been minimized.

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\ Text.app/Contents/SharedSupport/bin/subl -n $FOLDER
@roblav96

This comment has been minimized.

Copy link

roblav96 commented Dec 15, 2018

Requirement -> /bin/bash

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.