Integrate iTerm2 v.3 with Your Mac’s Finder
2 min readOct 11, 2018
As a person who writes a lot of code, I spend a great deal of time working from the command line. When browsing directories in the Mac’s Finder, it saves a lot of time to have a button that will open a terminal window into whatever directory is selected in the Finder.
A little AppleScript can makes this happen, so I’ve put together a script to integrate iTerm2 with the Finder. The code for the script is:
iTermHere.scpt
Steps to Create the App
- Open Script Editor
- Paste in the code above for iTermHere.scpt
- Save the script somewhere. The location doesn’t matter, but I usually use ~/Library/Scripts.
- In Script Editor, select “File > Export…”. In the export dialog window, make sure you set the “File Format” to “Application”. Also, if you’re on Mojave, you can avoid nagging security dialogs by signing your applications … if you have a developer account and configured a signing certificate you can select a singing identity next to “Code Sign”.
Steps to Integrate with Finder
- To add it to the Finder, open a Finder window and right click on the toolbar and select “Customize Toolbar”. Then drag the iTermHere app (not the scpt file) to the toolbar and click “Done”
- You can change the icon to something prettier by locating the iTermHere app in the Finder, selecting it and hit ⌘+i. This will display information about the app. Find the iTerm2 app and do the same thing so it’s information is displayed. In the upper left corner of the info window for iTerm2, select the icon and copy it (⌘+c). Select the icon for iTermHere in it’s info window and paste the iTerm icon there (⌘ + v).
- Apple has added a lot of app protections to Mojave. This can be annoying in that iTermHere can ask for permission to use iTerm every time it’s clicked. To avoid this open System Preferences, select “Security & Privacy”, then click “Accessibility” and add “iTermHere” to the “Allow apps below to control your computer” list.
Enjoy!
p.s. This code was originally published on my old blog.