Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add multiple accounts in Telegram Desktop [Linux | MacOSX | Windows]

How to add multiple accounts to Telegram Desktop

‼️‼️ As of version 2.1.14 Telegram Desktop supports up to 3 multiple accounts inbuilt ‼️‼️

If you have more you can still use this method (3 accounts per instance)

This guide is for the app available here: https://desktop.telegram.org/ not the one in the Mac/Windows App Store. For the Mac App Store app this should work: https://gist.github.com/Nachtalb/ec590dc974f6ba4674972d4937b230be/#gistcomment-3611415

Introduction

ATM of writing this, there is no way inside the Telegram Client to switch accounts (event though this feature exists in the offical mobile clients and there is a long running issue here: telegramdesktop/tdesktop#4261).

The Official Telegram Desktop client however has the feature to set the working directory with a command line argument -workdir. This enables the use of multiple accounts.

In this guide I will show you a way to use this feature on MacOSX, Linux and Windows. We will be working with the -workdir argument to create multiple instances for each Telegram account.

Replace {{...}} thing with what is written in there. So eg. for me and my TG account @Nachtalb I replace {{MyUsername}} with Nachtalb.

Instructions

Linux

  • Create a folder here ~/.local/share/TelegramDesktop/{{MyUsername}}
  • Create a new .desktop file here ~/.local/share/applications/telegramdesktop-{{myusername}}.desktop.
  • Put in your data in here

⚠️ In this example the Telegram binary resides in /opt/Telegram/Telegrm. This might be different in your case. If so then you have to adjust the path to the binary on the lines TryExec and Exec. ⚠️

[Desktop Entry]
Version=1.0
Name=Telegram {{MyUsername}}
Comment=Official desktop version of Telegram messaging service
TryExec=/opt/Telegram/Telegram
Exec=/opt/Telegram/Telegram -workdir /home/{{your_user}}/.local/share/TelegramDesktop/{{MyUsername}} -- %u
Icon=telegram
Terminal=false
StartupWMClass=TelegramDesktop
Type=Application
Categories=Network;InstantMessaging;Qt;
MimeType=x-scheme-handler/tg;
Keywords=tg;chat;im;messaging;messenger;sms;tdesktop;
X-GNOME-UsesNotifications=true
X-Desktop-File-Install-Version=0.23

OSX

  • Create a folder here: ~/.local/share/TelegramDesktop/{{MyUsername}}

  • Open Automator

  • Create a new Application

    https://user-images.githubusercontent.com/9467802/56354968-6875f500-61d5-11e9-9e61-32f87ba5502c.png
  • Add an apple script by drag & drop from the left-hand side

  • Add the following text:

do shell script "Applications/Telegram.app/Contents/MacOS/Telegram -workdir '/Users/{{your_user}}/.local/share/TelegramDesktop/{{MyUsername}}'"

https://user-images.githubusercontent.com/9467802/56354966-657b0480-61d5-11e9-8341-200ee72d1cb2.png

  • Save to /Applications/Telegram {{MyUsername}}.app
  • Now lastly if you want the have the same icon for your new app, open the file info of both apps (the original telegram and yours) with CMD + I and click on the icon in the top left of the original application. Hit copy CMD + C, click on yours and hit past CMD + V.

Windows

  • Create a folder here: C:\Users\{{your_user}}\AppData\Roaming\Telegram Desktop\{{MyUsername}}
  • Rightclick on your desktop and create a new shortcut
  • Put this in the location field
"C:\Users\{{your_user}}\AppData\Roaming\Telegram Desktop\Telegram.exe" -workdir "C:\Users\{{your_user}}\AppData\Roaming\Telegram Desktop\{{MyUsername}}"
  • Click next and type in a name for the shortcut, usually something like Telegram {{MyUsername}}
  • Lastly to find the application via the start menu you have to copy the link in here
@Quiviro

This comment has been minimized.

Copy link

@Quiviro Quiviro commented Dec 13, 2019

Thank you so much! I was wondering how to get this made in Linux

@Nachtalb

This comment has been minimized.

Copy link
Owner Author

@Nachtalb Nachtalb commented Dec 13, 2019

No problem

@ReeganExE

This comment has been minimized.

Copy link

@ReeganExE ReeganExE commented Mar 1, 2020

It works.
Thank you 💯

@pavelsr

This comment has been minimized.

Copy link

@pavelsr pavelsr commented Mar 12, 2020

Not working in Cinnamon

$ cinnamon --version
Cinnamon 4.2.4

$ lsb_release -a
No LSB modules are available.
Distributor ID:	LinuxMint
Description:	Linux Mint 19.2 Tina
Release:	19.2
Codename:	tina

$ uname -r
4.15.0-54-generic

also I tried to make desktop-file-install - no effect

@Nachtalb

This comment has been minimized.

Copy link
Owner Author

@Nachtalb Nachtalb commented Mar 18, 2020

@pavelsr What exactly is not working.

@excalibur1010

This comment has been minimized.

Copy link

@excalibur1010 excalibur1010 commented Mar 24, 2020

nice thx

@klyuko

This comment has been minimized.

Copy link

@klyuko klyuko commented Apr 7, 2020

Gracias

@Nachtalb

This comment has been minimized.

Copy link
Owner Author

@Nachtalb Nachtalb commented Apr 12, 2020

@ArmanPixel82
The folder feature is not enabled on a per-country basis it is shown when you have more than 100 chats. You can also access it via this link: tg://settings/folders

As written in the update: https://telegram.org/blog/folders

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented May 8, 2020

it worked, thanks.

@ZeroFossilFuel

This comment has been minimized.

Copy link

@ZeroFossilFuel ZeroFossilFuel commented May 16, 2020

Not working in Cinnamon

$ cinnamon --version
Cinnamon 4.2.4

$ lsb_release -a
No LSB modules are available.
Distributor ID:	LinuxMint
Description:	Linux Mint 19.2 Tina
Release:	19.2
Codename:	tina

$ uname -r
4.15.0-54-generic

also I tried to make desktop-file-install - no effect

The example given is predicated on the program file being installed in /opt/Telegram. That is not always the case with different linux flavors. My Xubuntu placed it in ~/Downloads/Telegram. Best bet is to just add the 2nd working directory per the example. Drag a copy of the program launcher to your desktop. Open it in a text editor. Then just change

Exec=/your/path/to/telegram -- %u
to
Exec=/your/path/to/telegram -workdir /home/{{your_user}}/.local/share/TelegramDesktop/{{MyUsername}} -- %u

Rename the launcher to include the user name you want to associate with it. Fire up Telegram with that launcher and log in as the added user. Done.

@mahdi760

This comment has been minimized.

Copy link

@mahdi760 mahdi760 commented May 28, 2020

It was very useful. Thank you.

@tantecky69

This comment has been minimized.

Copy link

@tantecky69 tantecky69 commented May 31, 2020

Hi i don't quite get how you do it for OSX.

1.)where can you find ~/.local/share/TelegramDesktop/{{MyUsername}}
2.) what does your_user refer do? (do shell script "Applications/Telegram.app/Contents/MacOS/Telegram -workdir '/Users/{{your_user}}/.local/share/TelegramDesktop/{{MyUsername}}'")

@mahdi760

This comment has been minimized.

Copy link

@mahdi760 mahdi760 commented May 31, 2020

@tanrecky69
Hello my friend.
I own a Windows computer and I don't know how to do it on your operating system.
I'm sorry. good luck.

@WellingtonFonseca

This comment has been minimized.

Copy link

@WellingtonFonseca WellingtonFonseca commented Jun 5, 2020

Working - Windows 10 Professional
Thanks

@gyunter

This comment has been minimized.

Copy link

@gyunter gyunter commented Jun 6, 2020

Works flawlessly on Windows 10

@DJayparmar

This comment has been minimized.

Copy link

@DJayparmar DJayparmar commented Jun 19, 2020

I'm using 2 accounts from last 1 year but method is little bit simple and unique...
1
Simply download telegram desktop official .exe file and install into other location not in default location.
2
Download another telegram app from Microsoft Store which creates 2nd telegram app
3 that's it u can use 2 accounts now simultaneously 😁

@Nachtalb

This comment has been minimized.

Copy link
Owner Author

@Nachtalb Nachtalb commented Jun 24, 2020

@DJayparmar

This seems more like a workaround instead of a good and solid solution. The --workdir parameter is specifically made for supporting multiple instances of Telegram with different users.
Your solution seems more like bloat. You have to install the whole thing multiple times (redundancy), always have to update each instance by its own and you'll have two "Telegram"s instead of a "Telegram Foo" and "Telegram Bar" and thus can't differentiate them in the start menu nor taskbar.

Also from the approaches I listed, I think that the windows one is the easiest and most robust of them all. (IMHO The one for Apple devices could be better but didn't find another good way to do it)

@Nachtalb

This comment has been minimized.

Copy link
Owner Author

@Nachtalb Nachtalb commented Jun 28, 2020

@pavelsr another user wrote to me with a similar problem. In his case the problem was just that the Telegram binary resided in another location. I have added a little notice to the instructions above for that.

⚠️ In this example the Telegram binary resides in /opt/Telegram/Telegrm. This might be different in your case. If so then you have to adjust the path to the binary on the lines TryExec and Exec. ⚠️

Maybe it was the same problem in your case.

@dev117uday

This comment has been minimized.

Copy link

@dev117uday dev117uday commented Jul 16, 2020

For linux, no need to go through all these hassle, Install the telegram desktop app on linux via apt-get and then simply use another package manager like snap or flathub to download another telegram app.

@Nachtalb

This comment has been minimized.

Copy link
Owner Author

@Nachtalb Nachtalb commented Jul 17, 2020

@dev117uday as said here already. --workdir is an official solution provided by the app. Whereas installing multiple versions of Telegram is IMHO just bloat. Eg. when you install it with apt, flat and snap you have to update each by its own instead of just once, you need 3 times the disk space, all 3 apps have the same name in the start menu instead of own ones like Telegram Foo and Telegram Bar and more.

But now since the last versions we have multi-account support up to 3 accounts anyway 🤷. But if you need more than 3 accounts I'd still go the --workdir way.

@leoblum

This comment has been minimized.

Copy link

@leoblum leoblum commented Nov 10, 2020

Any one try to modify TG client from sources to allow more than 3 account in same client?

I looking for macos telegram source code and find two lines which are responsible for it. But I never wrote on swift language. So I dont know how to check that.

@Nachtalb

This comment has been minimized.

Copy link
Owner Author

@Nachtalb Nachtalb commented Nov 11, 2020

@totalleo the Telegram Desktop app I am talking about above is not written in Swift but in C++: https://github.com/telegramdesktop/tdesktop

The line defining the max accounts per instance is defined here: https://github.com/telegramdesktop/tdesktop/blob/5cc7c2b6c6ecdce1ab4067549c4e7acd299dd5d5/Telegram/SourceFiles/main/main_domain.h#L33

You can find the build instructions for this client at the bottom of its readme: https://github.com/telegramdesktop/tdesktop#build-instructions

The Telegram app written in Swift would be this one https://github.com/overtake/TelegramSwift. I don't know if it supports more than 3 accounts as I have never used it.

@andrewkmin

This comment has been minimized.

Copy link

@andrewkmin andrewkmin commented Jan 3, 2021

While this might go without saying, for anyone simply looking to create two separate windows of the Telegram Mac client, you can simply duplicate the app (via Applications --> rightclick/secondary click Telegram --> duplicate --> open duplicate and log into desired account

@Nachtalb

This comment has been minimized.

Copy link
Owner Author

@Nachtalb Nachtalb commented Jan 27, 2021

@andrewkmin wouldn't this then create the profiles at the same place and thus override each other?

@leoblum

This comment has been minimized.

Copy link

@leoblum leoblum commented Jan 28, 2021

@totalleo the Telegram Desktop app I am talking about above is not written in Swift but in C++: https://github.com/telegramdesktop/tdesktop

The line defining the max accounts per instance is defined here: https://github.com/telegramdesktop/tdesktop/blob/5cc7c2b6c6ecdce1ab4067549c4e7acd299dd5d5/Telegram/SourceFiles/main/main_domain.h#L33

You can find the build instructions for this client at the bottom of its readme: https://github.com/telegramdesktop/tdesktop#build-instructions

The Telegram app written in Swift would be this one https://github.com/overtake/TelegramSwift. I don't know if it supports more than 3 accounts as I have never used it.

Thank for you comment.

I asked developers of Swift version how to use more than three accounts in one application instance. And it is possible!

To add more than three accounts, you need to click five times on the user pic, it will open a secret developer's menu through which you can add as many accounts as you want.

The same works for the iOS version. Enjoy =)

@andrewkmin

This comment has been minimized.

Copy link

@andrewkmin andrewkmin commented Jan 29, 2021

@andrewkmin wouldn't this then create the profiles at the same place and thus override each other?

Nope, I've used two simultaneously. The caveat is that if one closes, you have to re-login to them

@Nachtalb

This comment has been minimized.

Copy link
Owner Author

@Nachtalb Nachtalb commented Feb 3, 2021

@andrewkmin wouldn't this then create the profiles at the same place and thus override each other?

Nope, I've used two simultaneously. The caveat is that if one closes, you have to re-login to them

This sounds like they do override each other, but it works as long as they are running because the app runs in RAM. I have the feeling that could lead to problems...

@Nachtalb

This comment has been minimized.

Copy link
Owner Author

@Nachtalb Nachtalb commented Feb 3, 2021

@totalleo

Thanks for the clarification, I referred to your comment at the start of the guide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment