Search code examples
macostelnet

bash: telnet: command not found


I'm trying to connect the server using telnet, but when I enter telnet localhost 8000. It shows the error of telnet not found. I wrote my code in C and ran it on macOS terminal. Am I supposed to install something before I can use it?


Solution

  • Yes you would need to install telnet to use it on your mac. You can also try using an alternative tool, that comes pre-installed on macOS machines. It is called netcat and you can do the following:

    nc -vz localhost 8000
    

    If the command above is not good enough, you can install telnet on your mac by following the tutorial that can be found here:

    https://osxdaily.com/2018/07/18/get-telnet-macos/

    More precisely, the section titled: Installing Telnet in MacOS with Homebrew

    You will need to install homebrew (it is a package manager for MacOS, similar to yum or apt in linux).