Skip to content

Instantly share code, notes, and snippets.

@rwilcox
Created September 21, 2011 20:26
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save rwilcox/1233190 to your computer and use it in GitHub Desktop.
Save rwilcox/1233190 to your computer and use it in GitHub Desktop.
How to create a new gist from OS X Service

How to create a Public Gist Service:

Step 0: Open Automator, New Service.

Step 1: Drag out Run Shell Script action. Pass Input to STDIN

Step 2: This code:

open `gist`

This assumes you have the gist command line client installed (gem install gist), and your Github username and token set up in git config

My blog entry on the topic

@stinkymatt
Copy link

Thanks for posting this. I have been neglecting Services as a useful tool, but this seemed simple enough to follow. Anyway, I'm commenting because this didn't exactly work for me. For whatever reason, the bash environment that gets called from this doesn't have my Ruby environment set up, maybe because I'm using RVM. Anyhow, the following seems to work for me:

cat | pbcopy
source $HOME/.bash_profile
pbpaste | gist -o -

@rwilcox
Copy link
Author

rwilcox commented Feb 6, 2012

stinkymatt,

Agreed - something changed in the gist command line parsing since I wrote this original gist. However, I've also since moved to using QuickHub (from the Mac App Store) to manage my Github/Gists on the desktop and that includes a really good "Create Gist From Selection" service.

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