Install brew if you don't have it.
$ cd ~ && mkdir .telegram-cli && cd .telegram-cli && git clone --recursive https://github.com/vysheng/tg.git && cd tg
Then.
$ export CPPFLAGS="-I/usr/local/opt/openssl/include"
$ export LDFLAGS="-L/usr/local/opt/openssl/lib"