vdy0uq
Last Updated: June 02, 2016
·
4.288K
· ochko

Open folder in iTerm

On OS X there is already an option for opening a folder in Finder with Terminal.app. But If you prefer iTerm like me, here is Automator script for opening folder in iTerm.

In Automator: Services -> folders in Finder.app -> Run Applescript, paste this script and save as Open in iTerm

on run {input, parameters}
   cd(input)
end run


on cd(dir)
    tell application "iTerm"
        activate
        set miniaturized of windows to false
        try
            set iterm to the last terminal
        on error
            set iterm to (make new terminal)
        end try
        tell iterm
            launch session "Default"
            tell the last session
                write text "cd " & (quoted form of POSIX path of (dir as string)) & " && clear && ls -l"
            end tell
        end tell
    end tell
end cd

Picture

2 Responses
Add your response

4229

I use xtrafinder (http://www.trankynam.com/xtrafinder/) to have these options :)

over 1 year ago ·
27743

If you want to open in first session of iTerm change
launch session "Default" tell the last session
to
tell the first session

over 1 year ago ·