Skip to content

Instantly share code, notes, and snippets.

@Tattoo
Created August 1, 2018 05:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Tattoo/5f0097f9c422f7b7c3491ec464d73fff to your computer and use it in GitHub Desktop.
Save Tattoo/5f0097f9c422f7b7c3491ec464d73fff to your computer and use it in GitHub Desktop.
"Open iTerm here" context menu for Finder in OS X
# Step 1
# Open Automator
#
# Step 2
# File - New - Service
#
# Set the top dropdown boxes to Service receives selected files or folders in Finder.app
# Double click or drag Run Shell Script from the left panel, and enter the following:
if [[ -d $1 ]]; then
open -a iTerm $1
elif [[ -f $1 ]]; then
parentdir="$(dirname "$1")"
open -a iTerm $parentdir
fi
# Step 3
# File - Save - Save service as Open iTerm Here
#
# It is stored in ~/Library/Services, in case it needs to be changed later.
#
# That’s it! Now you can see the Open iTerm Here context menu option by right click on a file or folder in Finder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment