Wednesday, December 05, 2012


I'm a very happy Alfred and iTerm2 user on OSX.

I spent 30mins last night writing an Applescript Alfred extension to help me launch new tabs directly into iTerm and execute the ssh command directly. This means if you have ssh keys setup then it means a simple Alfred command can launch a new ssh session in a new tab in iTerm.

Applescript for the extension :

-- change this to ssh you want to run
set myCommand to  "ssh -i /Users/goul/keys/myspecialkey.pem"

-- this will send it to iTerm
tell application "iTerm"
set myterm to (current terminal)
-- talk to the new terminal
tell myterm
set mysession to (make new session at the end of sessions)
-- talk to the session
tell mysession
-- set some attributes
exec command myCommand
end tell
end tell
end tell