By far the simplest option is for Mac users to install Telnet through Homebrew. If you haven’t done so, go through these steps first:
Next, from a termina window, run this command.
brew install telnet
- Hit Return and let Homebrew download and install Telnet to the Mac
- When installation has complete, you can run Telnet as usual:
One simple way to test that Telnet is working properly after installation is to connect to the goofy Star Wars telnet server, which plays Star Wars in ASCII art:
You’ll know Telnet is working when you are greeted by Star Wars rendered in ASCII characters (and yes seriously, it’s the full movie).
Installing Telnet in MacOS Mojave & High Sierra via Older MacOS Versions or Backups
If you happen to have access to a Mac that is running a prior version of MacOS (Sierra or prior), or you happen to have an older MacOS system software backup laying around from Time Machine or otherwise, you can actually just copy the old binaries from that computer or backup to your modern MacOS installation, and telnet will work just fine.
With Mac OS and Mac OS X versions that include telnet, you will find Telnet at the following location (thus serving as a reference for where to find the binary in the backups:
The telnet binary is tiny weighing in at only 114 kb, so this is a quick simple task.
Copying that telnet binary into the following location in modern macOS releases, including MacOS Mojave 10.14 and MacOS High Sierra 10.13.x, will allow telnet to run on the new system software releases:
At that point you can run the ‘telnet’ command as usual.
Another option which requires more caution is to request the telnet binary from a trusted coworker or trusted friend who is running MacOS Sierra or prior. All they need to do is zip up and send you their /usr/bin/telnet binary file. Do not try and find a random telnet binary zip file from the internet since it could be compromised or otherwise untrustworthy. It’d be a good idea to use md5 hash or sha1 checksum on the original telnet binary if you’re going this route.
By the way, if you’re relying on binaries of telnet from Sierra or earlier, you might also be interested in grabbing ftp as well, which is also removed from modern macOS releases, but is located at the following location in prior MacOS builds:
Again you’d place the ftp binary into /usr/local/bin/ on new versions of system software.
For those wondering, while Telnet (and ftp) has been removed from Mojave, High Sierra, and presumably anything moving forward, MacOS Sierra remains the last version of system software to include Telnet by default, while any MacOS / Mac OS X release prior to Sierra also includes Telnet and ftp, including El Capitan, Snow Leopard, Yosemite, Mountain Lion, Mavericks, Tiger, Cheetah, etc.
Telnet Alternatives for Mac: SSH, Netcat
Of course there are some alternatives for Telnet, depending on what you need to use telnet for in the first place.
For remote connections, ssh is the new standard as it is secured, and both the ssh server and ssh client are available by default in all modern versions of MacOS system software. Simply, connecting to a remote IP with ssh would look as follows:
For simple testing of network connectivity, or for testing of an open / listening port, netcat can often fulfill the same needs that telnet provides. For example, you can confirm that the connection to the aforementioned ASCII Star Wars server and port 80 works with the following netcat command string:
nc -vz towel.blinkenlights.nl 80
Remember that netcat for this purpose requires specifying a valid TCP or UDP port number of whatever the host protocol is.
Restoring Telnet to MacOS Mojave & High Sierra by Compiling Telnet from Source
If you don’t want to use Homebrew for whatever reason, you can also compile Telnet yourself from inetutils source. As a prerequisite you’ll still need to install the Mac OS command line tools to be able to accomplish this, however.
First you’d download the latest inetutils package from gnu.org:
curl -o http://ftp.gnu.org/gnu/inetutils/inetutils-1.9.4.tar.gz
Next you’d decompress the tarsal:
tar xvzf inetutils-1.9.4.tar.gz
Now change into the appropriate directory:
Issue the configure command to begin:
When configure is complete, make from source:
And finally, use make install to complete the installation of inetutils and telnet:
sudo make install
Personally I think using Homebrew is easier, plus there are many other great and useful Homebrew packages available. If you’re familiar with compiling from source and you are this far, you’ll almost certainly appreciate having Homebrew anyway.