Assuming you have installed Homebrew already, otherwise, you can go to the official website of home brew and install it first, after that, use the following commands will help you install telnet
1. Do the update first
brew update
2. Install Telnet
brew install telnet
3. Verify it
telnet google.com 80
You should see something like below if telnet is installed and work correctly
Trying 172.217.25.14... Connected to google.com. Escape character is '^]'. ^]