A new open repository for the Telegram macOS client has been launched: TelegramMessenger/telegram-macos under the GPL-2.0 license. The previous repository, overtake/TelegramSwift, had not received commits since July 29, 2025, making it impossible to build an up-to-date client from it. Alongside it, the MTProto network engine, written in Rust, has been open-sourced. Its code resides in a separate repository, while a comparison with the old engine and an audit are available in the client's documentation. Telegram is preparing this engine to replace the previous library for both iOS and macOS. This primarily concerns third-party client developers and those on the macOS beta channel: the engine can already be manually enabled in the beta.

What's in the Repository

The repository link was posted in the client's beta testers chat on October 23 at 07:18 UTC. The repository itself was created on October 9 under a different address, macosswift/telegram; GitHub now redirects from there to the new one, and the README still links to the old address. The "Initial commit" is dated October 20, and the last README update was on October 22. The repository contains a total of 8,605 files, with almost the entire interface organized into 156 Swift packages in the packages/ folder.

The build number in Telegram-Mac/Info.plist is 283305. This is beta 13.0.283305 from October 9, meaning the open-source code is two weeks behind the beta, which reached 13.1.0.283366 by the evening of October 23. The HTMLBubbles module, which has been rendering HTML and JavaScript messages in the beta since October 8, is not present in the open-source code.

The build instructions require Xcode 16 or newer and a Rust toolchain. Code shared with iOS (TelegramCore, Postbox) is included as a submodules/telegram-ios submodule. Its .gitmodules entry points to a GitLab address, but the required commit 5bb60920e2 from October 9 is also available in the public Telegram-iOS repository. The rules for forks remain the same: obtain your own API ID, do not name the fork Telegram, do not use the proprietary logo, and publish the code as required by the GPL.

Repository Designed for AI Agents

At the root of the repository is AGENTS.md, a guide "for agents writing code in this repository." It describes coding rules, a module map, and the beta release process: a build starts when changes are pushed to the beta branch and the CFBundleVersion is incremented. Code comments are prohibited, except for utility tags like //TODOLANG. CLAUDE.md consists of a single line linking to AGENTS.md, and the .claude/commands folder contains two ready-made commands for Claude Code: creating a screen and working with localization strings.

Rust MTProto Engine

MTProto is the protocol Telegram clients use to communicate with servers, handling encryption, sessions, and data center connections. In iOS and macOS, this has historically been managed by MtProtoKit, an Objective-C library. To replace it, mtproto-engine has been written. The first commit was made on October 2, the last on October 13, with a total of 16 commits. The code is almost entirely in Rust, under the GPL-2.0 license.

According to the README, the engine connects to TelegramCore via a NetworkEngine layer and works on both iOS and macOS. MtProtoKit remains the default engine. The new engine can be selected in developer settings under "Network Engine" and becomes active after a restart. Both engines write to the same saved state, so switching does not log out the account. In the public Telegram-iOS, the engine is included as a third-party/mtproto-engine submodule, pointing to the latest commit da4b217021 of the repository.

The main difference lies in threading. MtProtoKit executes all sessions for all accounts, all parsing, and all encryption in a single shared queue. Consequently, downloading a large file can delay the delivery of updates in the main session. The new engine maintains two to four worker threads: main sessions are assigned to the first, downloads and CDN traffic are distributed among the others, and decrypting 512 KB file chunks does not slow down the main session.

The engine appeared in the macOS beta before the code was open-sourced. The string "Rust (restart required)" is present in build 12.10.283246 from October 2. The next build introduced the string "Engine switch to rust refused, the server disabled it," indicating that the Telegram server can prohibit the switch. The repository documentation refers to this mechanism as a "live kill switch" and attributes its first version to betas 283247 and 283248.

Performance Measurements

A comparison of the engines is available in the macOS repository, in the file mtproto-rust-vs-mtprotokit.md. Its final version is dated October 2. Measurements were run through a real TelegramCore stack against a simulated Telegram cluster behind a network simulator, with some figures taken on real servers. These are the team's own numbers and have not been independently verified.

TestRustMtProtoKit
Large file, 100 ms delay, 200 Mbps22.3 MB/s6.7 MB/s
Large file via CDN, same network13.7 MB/s6.8 MB/s
Normal response wait on 6 s network outage72 ms4.3 s
First response after outage ends0.07 s1.11 s
10,000 small requests, CPU time0.20 s1.05 s

A separate set of 47 scenarios tests the engines against a hostile server that sends garbage, repeats responses, and drops connections. Rust passed all 47 scenarios and never executed a request twice. MtProtoKit completed 18 cleanly. In 11 scenarios, it froze; in two, it entered an infinite loop with high CPU load; and in 24, it re-executed requests, totaling 49,395 times.

Audit and Wallet

The docs/security-audit folder contains a report on the macOS network stack audit from October 2. According to it, MtProtoKit still performs every authorization key exchange in the application, while the new engine operates with the generate_key = 0 parameter, meaning it does not create keys itself. The report describes two high-severity vulnerabilities in MtProtoKit, shared with Telegram for iOS: client crashes and freezes before server authenticity is verified. On the same day, commit c371b688c7 with a fix for MtProtoKit key exchange was merged into the public Telegram-iOS.

The TON wallet on Mac also relies on Rust. The manual port of the wallet from packages/Wallet has been removed, and macOS now uses shared wallet code from telegram-ios and the wallet-engine library, written in Rust under the Apache-2.0 license. It connects via the UniFFI binding generator, and its utility strings have been present in the macOS beta since build 12.10.283234 from September 25.

In the same TelegramMessenger organization, a fork of the QuickJS-ng JavaScript engine appeared on October 11. Its commits were made under the same macosswift account as in mtproto-engine. These commits accelerate the interpreter and memory allocation. The open-source code does not yet show where this fork is being used.