telnet: command not found on Mac? How to use Telnet on macOS

Apple removed the telnet command in macOS High Sierra, so zsh: command not found: telnet is normal. To check whether a port is open, use the built-in nc -vz host port. For a real Telnet session with a switch or router, install it with brew install telnet.

Updated . Run on macOS 27: telnet is absent from /usr/bin, nc -vz tested against a local listener and a closed port, brew info telnet and brew info inetutils checked (telnet 308, inetutils 2.8).

Why telnet is missing

zsh: command not found: telnet

Apple removed telnet, along with ftp, in macOS High Sierra (10.13). Nothing is broken on your Mac and there is no setting to turn it back on. You have two options, and the right one depends on what you were going to do with it.

  • Check whether a port is open, for a web server, a mail server or SSH: use nc, already on the Mac.
  • Log in to a device that speaks Telnet, such as a switch, a router or a console server: install the Telnet client.

Test a port with nc

Most people type telnet host 443 only to see whether a port answers. nc does that better, because it tells you clearly and exits:

nc -vz example.com 443
Connection to example.com port 443 [tcp/https] succeeded!

A closed port gives Connection refused, and a port blocked by a firewall gives no answer until the timeout. Add -G 5 to give up after 5 seconds. Both cases have their own guides: connection refused and connection timed out.

To type into a text protocol, as with SMTP on port 25, leave out -z. -c sends CR and LF at the end of each line, which many servers expect:

nc -c mail.example.com 25

For a device that negotiates Telnet options, add -t so nc answers them. It works for a quick look, but a real client handles echo and the terminal size properly.

Install telnet with Homebrew

With Homebrew installed:

brew install telnet

This is the client Apple used to ship. The inetutils package also contains a telnet, but it conflicts with this one, so pick only one. Then connect with the address and, if it is not 23, the port:

telnet 192.0.2.10 23
Trying 192.0.2.10...
Connected to 192.0.2.10.
Escape character is '^]'.

To leave, press Ctrl-], type quit and press Enter. Ctrl-C usually does not work, because it is sent to the device.

When you still need Telnet

Telnet sends everything as plain text, passwords included. Anyone on the network path can read it. It still has real uses:

  • Switches, routers, printers and power units that have no SSH, or have it turned off from the factory.
  • Console servers that expose each serial port as a Telnet port, such as 2001, 2002 and so on.
  • Lab equipment, network simulators and old industrial systems.
  • Text services such as bulletin boards and MUD games.

Use it on a network you trust, such as a management VLAN or a direct cable, and never across the internet.

Move a device from Telnet to SSH

If the device can do SSH, turn it on and switch Telnet off. On Cisco IOS, for example, after you create a local user:

configure terminal
ip domain-name example.com
crypto key generate rsa modulus 2048
ip ssh version 2
line vty 0 4
 login local
 transport input ssh
end
write memory

Test SSH from a second window before you close the Telnet session. For Linux machines that still run a Telnet server, see how to enable SSH on Ubuntu and then remove the telnet server package.

Common problems

  • Connection refused. The device does not accept Telnet on that port. It may be turned off, or allowed only from a management network.
  • Connected, then nothing. Press Enter. Some devices print the login prompt only after a key press.
  • Odd characters or broken menus. The device uses another character set, such as ISO-8859-1, or expects another terminal type. See unknown terminal type.
  • Backspace prints ^?. The device expects Ctrl-H as the erase key. Press Ctrl-H instead, or set the erase key on the device.

Questions

Why is telnet not on my Mac?

Apple removed telnet and ftp from macOS starting with High Sierra (10.13) in 2017, because both send everything unencrypted. The command is not hidden: it is gone.

How do I install telnet on a Mac?

Install Homebrew, then run brew install telnet. The inetutils package also has a telnet command, but the two conflict, so install only one.

What can I use instead of telnet to test a port on a Mac?

nc, which is built in. nc -vz example.com 443 prints succeeded if the port accepts connections and Connection refused if nothing listens there.

How do I exit telnet?

Press Ctrl-], which is the escape character, then type quit and press Enter.

Sources

More in SSH on each system

All guides