New in Transmit 5, you can quickly open your current local or remote SFTP directory in your terminal emulator of choice using Open in Terminal.
- If your Site uses password-based authentication, you’ll need to enter the password into the terminal when prompted in order to connect.
- Alternately, if your Site uses key-based authentication add the key to your
~/.ssh/configfile and it will be used for the terminal session as well. More information about how to set up your config file can be found here.
Please note: At this time the Open In Terminal feature is not compatible with keys stored in Transmit or Panic Sync.
Under the Hood
By default, Transmit launches macOS’s built-in emulator Terminal.app by running the following AppleScript:
on openTerminal(location, remoteHost, serverPort) tell application "Terminal" activate set targetTab to "" set sshCommand to "" if ((count of remoteHost) is greater than 0) then set cdCommand to " 'cd \"" & location & "\"; eval \"$SHELL -il\"'" set sshCommand to "ssh -t " & "'" & remoteHost & "'" else set cdCommand to "cd \"" & location & "\"" end if if (serverPort is greater than 0) then set sshCommand to sshCommand & " -p " & serverPort end if if ((count of location) is greater than 0) then set sshCommand to sshCommand & cdCommand end if if (window 1 exists) and (window 1 is visible) and not (selected tab of window 1 is busy) then set targetTab to selected tab of window 1 if ((count of sshCommand) is greater than 0) then do script sshCommand in targetTab end if else if ((count of sshCommand) is greater than 0) then set targetTab to do script sshCommand end if end if end tell end openTerminal
If you would like to customize Transmit’s Open in Terminal behavior — for example, use a different terminal emulator or run a different command on connection — you can.
First, create a new file somewhere on your Mac. For example:
$ touch ~/Scripts/TransmitOpenTerminal.txt
Next, copy and paste the default script from above into that file, and make any necessary modifications to meet your needs.
Finally, run the following command to set the path to your custom script:
$ defaults write com.panic.Transmit OpenTerminalScriptPath ~/Scripts/TransmitOpenTerminal.txt
When you click the Open in Terminal toolbar button or select the Go > Open in Terminal menu item, Transmit will now run your custom script instead.