Choose a folder for the future build, for example /Users/user/TBuild. It will be named BuildPath in the rest of this document. All commands will be launched from Terminal.
You will require api_id and api_hash to access the Telegram API servers. To learn how to obtain them click here.
Go to BuildPath and run
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install git automake cmake wget pkg-config gnu-tar
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
git clone --recursive https://github.com/telegramdesktop/tdesktop.git
./tdesktop/Telegram/build/prepare/mac.sh
Go to BuildPath/tdesktop/Telegram and run (using your api_id and api_hash)
./configure.sh -D TDESKTOP_API_ID=YOUR_API_ID -D TDESKTOP_API_HASH=YOUR_API_HASH
Then launch Xcode, open BuildPath/tdesktop/out/Telegram.xcodeproj and build for Debug / Release.