Choose a folder for the future build, for example **/Users/user/TBuild** There you will have two folders, **Libraries** for third-party libs and **tdesktop** (or **tdesktop-master**) for the app.
###Clone source code
By git – in Terminal go to **/Users/user/TBuild** and run
or download in ZIP and extract to **/Users/user/TBuild** rename **tdesktop-master** to **tdesktop** to have **/Users/user/TBuild/tdesktop/Telegram/Telegram.xcodeproj** project, then go to **/Users/user/TBuild/tdesktop** and run
git checkout mac32
###Prepare libraries
In your build Terminal run
MACOSX_DEPLOYMENT_TARGET=10.6
to set minimal supported OS version to 10.6 for future console builds.
or download in ZIP and extract to **/Users/user/TBuild/Libraries**, rename **openssl-xcode-master** to **openssl-xcode** to have **/Users/user/TBuild/Libraries/openssl-xcode/openssl.xcodeproj** project
Extract openssl-1.0.1h.tar.gz and copy everything from **openssl-1.0.1h** to **/Users/user/TBuild/Libraries/openssl-xcode** to have **/Users/user/TBuild/Libraries/openssl-xcode/include**
#####Building library
* Open **/Users/user/TBuild/Libraries/openssl-xcode/openssl.xcodeproj** with Xcode
or download in ZIP and extract to **/Users/user/TBuild/Libraries**, rename **libexif-0.6.20-master** to **libexif-0.6.20** to have **/Users/user/TBuild/Libraries/libexif-0.6.20/configure** script
#####Building library
In Terminal go to **/Users/user/TBuild/Libraries/libexif-0.6.20** and there run
./configure
make
sudo make install
####OpenAL Soft
Get sources by git – in Terminal go to **/Users/user/TBuild/Libraries** and run
git clone git://repo.or.cz/openal-soft.git
to have **/Users/user/TBuild/Libraries/openal-soft/CMakeLists.txt**
#####Building library
In Terminal go to **/Users/user/TBuild/Libraries/openal-soft/build** and there run
Download sources [opus-1.1.tar.gz](http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz) from http://www.opus-codec.org/downloads/, extract to **/Users/user/TBuild/Libraries** and rename to have **/Users/user/TBuild/Libraries/opus/configure**
#####Building libraries
Download [pkg-config 0.28](http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz) from http://pkg-config.freedesktop.org, extract it to **/Users/user/TBuild/Libraries**
In Terminal go to **/Users/user/TBuild/Libraries/pkg-config-0.28** and run
./configure --with-internal-glib
make
sudo make install
then go to **/Users/user/TBuild/Libraries/opus** and there run
Download [libiconv-1.14](http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz) from http://www.gnu.org/software/libiconv/#downloading, extract it to **/Users/user/TBuild/Libraries**
In Termianl go to **/Users/user/TBuild/Libraries/libiconv-1.14** and run
Extract to **/Users/user/TBuild/Libraries**, rename **qt-everywhere-opensource-src-5.3.2** to **QtStatic** to have **/Users/user/TBuild/Libraries/QtStatic/qtbase** folder
Apply patch:
* OR copy (with overwrite!) everything from **/Users/user/TBuild/tdesktop/\_qt\_5\_3\_2\_patch/** to **/Users/user/TBuild/Libraries/QtStatic/**
* OR copy **/Users/user/TBuild/tdesktop/\_qt\_5\_3\_2\_patch.diff** to **/Users/user/TBuild/Libraries/QtStatic/**, go there in Terminal and run
git apply _qt_5_3_2_patch.diff
#####Building library
In Terminal go to **/Users/user/TBuild/Libraries/QtStatic** and there run