π A comprehensive and reliable installation script for TdLib (Telegram Database Library) across all major platforms
This script automatically downloads, compiles, and installs TdLib with zero configuration required. Designed to work seamlessly on Linux, macOS, and Windows platforms with intelligent platform detection and automatic dependency management.
- π Automatic Platform Detection: Supports Ubuntu/Debian, CentOS/RHEL, Arch Linux, macOS, and Windows
- π¦ Dependency Management: Automatically installs all required build tools and libraries
- π§ Platform-Specific Fixes: Resolves known issues like macOS atomic operations automatically
- β Installation Verification: Validates successful compilation and library creation
- π¨ Rich Output: Colored logging with clear progress indicators
- β‘ Parallel Compilation: Utilizes all available CPU cores for faster builds
- π‘οΈ Error Handling: Comprehensive error detection and recovery mechanisms
curl -fsSL https://raw.githubusercontent.com/DeepPythonist/TDLIB-installer/main/install.sh | bashgit clone https://github.com/DeepPythonist/TDLIB-installer.git
cd TDLIB-installer
chmod +x install.sh
./install.sh# Standard installation
./install.sh
# Force clean reinstallation
./install.sh --force
# Skip dependency installation (if already installed)
./install.sh --skip-deps
# Verify existing installation only
./install.sh --verify-only
# Show help
./install.sh --helpbuild-essential,cmake,git,libssl-dev,zlib1g-dev- Automatically installed by the script
- Development Tools,
cmake,git,openssl-devel,zlib-devel - Automatically installed by the script
- Xcode Command Line Tools (automatically installed)
- Homebrew (automatically installed if needed)
- Visual Studio 2019+ with C++ support
- CMake and Git
- Recommended: Use WSL (Windows Subsystem for Linux)
After successful installation, integrate TdLib into your Python projects:
import os
import ctypes
import json
# Load TdLib
tdjson_path = os.path.abspath('td/build/libtdjson.dylib') # macOS
# tdjson_path = os.path.abspath('td/build/libtdjson.so') # Linux
tdjson = ctypes.CDLL(tdjson_path)
# Configure function signatures
tdjson.td_json_client_create.restype = ctypes.c_void_p
tdjson.td_json_client_send.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
tdjson.td_json_client_receive.argtypes = [ctypes.c_void_p, ctypes.c_double]
tdjson.td_json_client_receive.restype = ctypes.c_char_p
# Create client and start using TdLib
client = tdjson.td_json_client_create()After successful installation, you'll find:
td/
βββ build/
β βββ libtdjson.dylib # macOS dynamic library
β βββ libtdjson.so # Linux dynamic library
β βββ libtdjson.a # Static library (all platforms)
βββ ...
The script automatically handles common macOS compilation issues:
- Atomic Operations: Automatically patched for Apple Clang compatibility
- Command Line Tools: Auto-installation and updates
- SDK Path: Automatic detection and configuration
- Missing Dependencies: Automatically detected and installed
- Compiler Compatibility: Supports GCC and Clang
- Architecture Support: x86_64, ARM64, and ARM32
# Verify installation
./install.sh --verify-only
# Clean reinstall
./install.sh --force
# Check logs for detailed error information| Platform | Status | Notes |
|---|---|---|
| Ubuntu 18.04+ | β | Fully supported |
| Debian 10+ | β | Fully supported |
| CentOS 7+ | β | Fully supported |
| RHEL 7+ | β | Fully supported |
| Arch Linux | β | Fully supported |
| macOS 10.15+ | β | With automatic fixes |
| Windows 10+ | Recommended: WSL |
We welcome contributions! Please feel free to submit issues, feature requests, or pull requests.
git clone https://github.com/DeepPythonist/TDLIB-installer.git
cd TDLIB-installer
# Make your changes
./install.sh --verify-only # Test your changesThis project is licensed under the MIT License - see the LICENSE file for details.
- TdLib Team for creating the excellent Telegram Database Library
- Community contributors for testing and feedback across different platforms
Made with β€οΈ for the developer community
For support, please open an issue on GitHub or check our troubleshooting guide above.