Tera Term Mac command line

Tera Term Mac can be started with a command line. Start it from Terminal.app or a script in one of these ways:

open -a "Tera Term Mac" --args [ <host>[[:]<TCP port#>] | telnet://<host>[:<TCP port#>][/] | ssh://... ]
         [/B] [/BAUD=<speed>] [/C=<serial port#>|<device>]
         [/KR=<kanji code (receive)>] [/KT=<kanji code (transmit)>]
         [/M=<macro file>] [/P=<TCP port#>] [/SPEED=<speed>] [/T=<telnet flag>]
         [/SHELL] [;<comment>]

"/Applications/Tera Term Mac.app/Contents/MacOS/TeraMac" [same options]

Options

<host>
Host name or IP address
Enclose an IPv6 address in square brackets (see RFC3986 / RFC5952).
When neither SSH nor Telnet is specified, port 22 or no port means SSH, and any other port (such as 23) means Telnet.
<host>:<TCP port#>
<host> with TCP port number
":" is placed between <host> and <TCP port#>.
<host> <TCP port#>
<host> with TCP port number
One or more spaces are placed between <host> and <TCP port#>.
A number just after <host> is regarded as the TCP port number.
telnet://<host>[:<TCP port#>][/]
URL format
The TCP port number and the trailing / can be omitted.
When the TCP port number is omitted, 23 is used.
Works as a command line argument. Tera Term Mac is not registered as the handler of telnet:// URLs.
/B
Telnet binary option
/BAUD=<speed>
Specifies the speed of the serial port. Same as /SPEED=. Whether the value is really used depends on the chip and driver of the serial port.
/C=<serial port#>
Serial port
Specify it as follows:
  • /C=/dev/cu.usbserial-XXXX specifies the device directly
  • /C=1 the first serial port found (/dev/cu.*, in name order)
  • /C=2 the second one
  • :
When the number is out of range, the first serial port is used.
/CDATABIT=<value>
Data bits of the serial port
  • /CDATABIT=7 7bit
  • /CDATABIT=8 8bit
/CPARITY=<value>
Parity of the serial port
  • /CPARITY=none none
  • /CPARITY=odd odd
  • /CPARITY=even even
  • /CPARITY=mark mark
  • /CPARITY=space space
/CSTOPBIT=<value>
Stop bits of the serial port
  • /CSTOPBIT=1 1bit
  • /CSTOPBIT=2 2bit
Any value other than 1 means 2 bits.
/CFLOWCTRL=<value>
Flow control of the serial port
  • /CFLOWCTRL=x Xon/Xoff
  • /CFLOWCTRL=hard RTS/CTS
  • /CFLOWCTRL=rtscts RTS/CTS
  • /CFLOWCTRL=none none
  • /CFLOWCTRL=dsrdtr DSR/DTR
/FD=<file transfer directory>
File transfer directory
Not used on the startup command line. It works with the connect macro command.
/KR=<kanji code (receive)>
Kanji code (receive)
For the available codes, see the character encoding page.
/KT=<kanji code (transmit)>
Kanji code (transmit)
For the available codes, see the character encoding page.
/M=<macro file>
Run a macro at startup
Give an absolute path (a path starting with ~ also works). When a host or other connection options are also given, the macro runs after the connection is started.
/P=<TCP port#>
TCP port number
/SPEED=<speed>
Specifies the speed of the serial port. Same as /BAUD=. Whether the value is really used depends on the chip and driver of the serial port.
/T=<telnet flag>
  • /T=1 Use the Telnet protocol
  • /T=0 Do not use the Telnet protocol (plain TCP)
Neither uses SSH. When no port is given, 23 is used.
/TIMEOUT=<connecting timeout value>
Time (in seconds) until a connection attempt is cancelled
Not used on the startup command line. It works with the connect macro command.
/W=<window title>
Window title
Not used on the startup command line. It works with the connect macro command.
/SHELL
Connect to a local shell. Same as [File]-[Local Shell Connection].
;<comment>
Comment. It must be placed at the end of the command line.
From a shell, quote the ; so that the shell does not interpret it.

Examples

open -a "Tera Term Mac"
open -a "Tera Term Mac" --args myhost.example.com
open -a "Tera Term Mac" --args myhost.example.com:23
open -a "Tera Term Mac" --args myhost.example.com 23
open -a "Tera Term Mac" --args 192.0.2.1
open -a "Tera Term Mac" --args "[2001:db8:1:2:8401:2ff:fe03:405]"
open -a "Tera Term Mac" --args telnet://myhost.example.com
open -a "Tera Term Mac" --args /C=1
open -a "Tera Term Mac" --args /C=/dev/cu.usbserial-XXXX /SPEED=115200

open -a "Tera Term Mac" --args myhost.example.com /T=0 /P=7
open -a "Tera Term Mac" --args myhost /B /KR=UTF8 /KT=UTF8
open -a "Tera Term Mac" --args /M=~/macro/login.ttl
open -a "Tera Term Mac" ~/macro/login.ttl
"/Applications/Tera Term Mac.app/Contents/MacOS/TeraMac" myhost.example.com /telnet

Default values

The default values are the settings of the setup dialogs (saved in the preferences). Serial port items that are not given are 9600 bps, 8 bits, no parity, 1 stop bit and no flow control.

Notes

[1] Only when <telnet flag> is 1 and <TCP port#> is 23 does Tera Term start the telnet option negotiation by itself. In other cases Tera Term can still answer telnet commands sent from the host.

[2] To include spaces or `"' in a parameter value, enclose the whole value in `"'.
To include " in a value, write two `"' characters ("").
When starting from a shell, also take the shell's quoting rules into account. One argument that contains spaces is treated as one value.

open -a "Tera Term Mac" --args '/M=/Users/user/My Macros/login.ttl'

Reference

Telnet port number / terminal settings for non-telnet connections