[fix] zsh: command not found: telnet on Mac


zsh command not found: telnet fix macOS
Code2care@Mac % telnet example.com 443
zsh: command not found: telnet

If you try to run the telnet command on your Mac which is running on macOS Catalina (10.15) or higher. You will get the error "telnet command not found". This is because since Catalina, telnet command binary has been removed from Mac due to security concerns, as it transmits data in plain text, which can be intercepted and read by an attacker and they can steal sensitive data such as passwords.

The alternative is to make use of the telnet is the nc command.

% man nc

NAME
     nc – arbitrary TCP and UDP connections and listens
...
...

DESCRIPTION
     The nc (or netcat) utility is used for just about anything under the sun involving TCP or UDP.  
     It can open TCP connections, send UDP packets, listen on arbitrary TCP and UDP ports, 
     do port scanning, and deal with both IPv4 and IPv6.  Unlike telnet(1), nc scripts nicely, 
     and separates error messages onto standard error instead of sending them to standard 
     output, as telnet(1) does with some.

     Common uses include:

           •   simple TCP proxies
           •   shell-script based HTTP clients and servers
           •   network daemon testing
           •   a SOCKS or HTTP ProxyCommand for ssh(1)
           •   and much, much more

     The options are as follows:

     -4      Forces nc to use IPv4 addresses only.

     -6      Forces nc to use IPv6 addresses only.

     -A      Set SO_RECV_ANYIF on socket.
...

Example:

nc code2care.org 443

If you still want to make use of telnet, then you can download the package using homebrew.

brew install telnet

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org



















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap