返回文章列表文章索引阅读全文
STARBLOG / 阅读手记
Mac

Multiple WeChat instances on macOS too much hassle? I used DeepSeek to write a one-click tool

Fed up with that Zhihu routine of manually changing the Bundle ID and re-signing, which you have to redo after every update? One line of `wechat-clone create 3` gets you three instances, TUI included—ten minutes to write a Go tool so you don't wreck your keyboard in the terminal.

曦远 (DealiAxy)约 16 分钟
目录8 个章节

Introduction

I previously came across a tutorial on Zhihu for running two instances of WeChat on Mac. The steps were roughly: copy WeChat.app, change the Bundle ID, re-sign it, then launch with nohup. I tried it and it actually worked—after going through the manual steps, I successfully had two instances running.

But honestly the process is pretty tedious—every time you have to open the terminal and type several sudo commands, and one slip of the finger could copy the wrong path or mess up the signing. And if WeChat updates, the clone's signature becomes invalid and you have to do it all over again.

What's even worse: if you want three or four instances, you have to change every 2 in the tutorial to 3 or 4 and go through the whole process again for each. Someone in the original Zhihu post's comments even asked "how do I change it for three instances?", and the author had to put out a dedicated follow-up post highlighting all the places to change 🤣

So I thought, could I write a command-line tool to automate these steps? One command to handle create, repair, and delete, and while I'm at it, throw in an interactive UI for friends who aren't comfortable with the command line.

So I got right to it.

Demo

First, a look at the final result.

CLI mode, one command to create 3 clones:

$ wechat-clone create 3
正在创建 3 个微信分身...

  ✓ 分身 1 创建成功: /Applications/WeChat Clone 1.app
  ✓ 分身 2 创建成功: /Applications/WeChat Clone 2.app
  ✓ 分身 3 创建成功: /Applications/WeChat Clone 3.app

完成!

List existing clones:

$ wechat-clone list
找到 3 个微信分身:

  WeChat Clone 1.app  com.tencent.xinWeChat.clone1
  WeChat Clone 2.app  com.tencent.xinWeChat.clone2
  WeChat Clone 3.app  com.tencent.xinWeChat.clone3

Environment check:

$ wechat-clone doctor
正在检查环境...

  ✓ 系统平台: macOS
  ✓ 微信应用: 已找到: /Applications/WeChat.app
  ✓ codesign: 可用
  ✓ PlistBuddy: 可用
  ✓ 写入权限: /Applications 可访问
  ✓ 磁盘空间: 请确保有足够空间(每个分身约 400MB+)
  ✓ 已有分身: 暂无分身

环境检查通过! 可以正常使用。

Don't want to type commands? Just run wechat-clone to enter the interactive TUI—arrow keys to select, Enter to confirm:

微信分身管理工具

使用 ↑↓ 键选择,Enter 确认,q 退出

▸ 创建分身
  查看分身列表
  启动分身
  修复分身
  删除分身
  环境检查

↑/↓ 移动  •  Enter 选择  •  q 退出

Installation

brew install star-plan/tap/wechat-clone

If you don't have Homebrew installed, you can also download the binary from GitHub Releases and drop it in /usr/local/bin/.

What It Does

In plain terms, it just automates the manual steps from that Zhihu tutorial. For each clone it creates, the tool runs the following in sequence:

  1. sudo cp -R copy WeChat.app
  2. sudo PlistBuddy modify CFBundleIdentifier in Info.plist
  3. codesign --force --deep --sign - ad-hoc re-sign
  4. xattr -rd com.apple.quarantine clear the quarantine attribute

Exactly the same as doing it by hand, except you don't have to type the commands yourself.

Repair (repair) is just repeating steps 2-4—run it after a WeChat update. Remove (remove) is just sudo rm -rf, with a confirmation prompt to prevent accidents.

Command Cheatsheet

CommandDescription
wechat-cloneEnter the interactive TUI
wechat-clone doctorCheck whether the environment meets the requirements
wechat-clone create 3Create 3 clones
wechat-clone create 3 --forceOverwrite existing clones
wechat-clone listList all clones
wechat-clone openShow clone paths and guide you to launch them in Finder
wechat-clone repairRepair signatures for all clones
wechat-clone repair 2Repair a specific clone
wechat-clone remove 2Delete a specific clone (with confirmation)
wechat-clone remove all --forceForce-delete all clones

Tech Stack

ComponentChoiceReason
LanguageGoSingle-binary distribution, no runtime dependencies
CLI frameworkcobraThe standard choice for Go CLIs, with a clear command structure
TUI frameworkbubbletea + lipglossThe Charm family, a modern terminal UI solution
Build/releaseGoReleaserAutomatically builds for multiple architectures + pushes the Homebrew Formula

The project structure is reasonably clean too:

wechat-clone/
├── main.go
├── internal/
│   ├── app/       # 业务逻辑(CLI 和 TUI 共享)
│   ├── cli/       # Cobra 命令定义
│   ├── macos/     # macOS 系统操作封装
│   └── tui/       # Bubble Tea 交互界面

The benefit of the layered design is that the CLI and TUI reuse the same business logic, so you don't have to write it twice. internal/macos/ wraps all the macOS-specific operations (PlistBuddy, codesign, xattr), and the upper layers just call them.

A Few Details

Launch method: After creating clones, the tool won't automatically open WeChat for you; instead it shows the path and guides you to launch it manually in Finder. The main reason is that automatic launching (nohup invoking the binary or the open command) behaves inconsistently across different macOS versions, so launching manually is actually more reliable. Just double-click the .app, or drag it to the Dock to pin it.

Numbering: If you delete clone 2 and then create a new one, the new clone will be numbered 4 rather than filling the gap at 2. Simple and reliable, no numbering conflicts.

sudo privileges: Copying and modifying files under /Applications requires sudo. The tool will request it automatically when needed, and the terminal will prompt you for your password.

Data isolation: Each clone has its own Bundle ID, so WeChat creates a separate data directory for each clone. They don't interfere with each other. Multiple clones can be logged into different accounts at the same time.

Wrapping Up

At its core this is just a small project that packages 5 terminal commands into a tool—no black magic. But it really does save a lot of hassle—especially when you need multiple instances or have to re-sign after a WeChat update.

The source is on GitHub, Apache 2.0 license. Issues and PRs welcome.

That's it 👋

_EOF_

Multiple WeChat instances on macOS too much hassle? I used DeepSeek to write a one-click tool

本文作者:
程序设计实验室
版权声明:
本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!

相关文章

解决Mac刘海屏菜单栏图标显示不全,两款工具实测(含开源免费方案)

本文分享了MacBook Air M4用户遇到的菜单栏图标过多导致显示不全的问题,并提供了两种解决方案:收费软件Bartender 4(15美元)和开源免费工具Ice。作者详细介绍了Ice的安装方法(通过brew或手动下载)及使用体验,展示了其灵活的图标折叠、扩展菜单和自定义设置功能,认为其效果与收费版相当。文章旨在帮助用户优化MacOS菜单栏空间管理。

2025-08-26 · Mac · 约 1 分钟

StarBlog博客开发笔记(1):项目介绍

前言 OK,我也来造轮子了 博客系统从一开始用WordPress,再到后来用hexo、hugo之类的静态博客生成放github托管,一直在折腾 折腾是为了更好解决问题,最终还是打算自己花时间搞一个好了 本系列文章将记录博客的开发过程~ 后端基于最新的.Net6和Asp.Net Core框架,遵循RESTFul接口规范,前端基于Vue+ElementUI开发,可作为 .Net Core 入门项目学习

2022-04-05 · StarBlog博客开发笔记 · 约 1 分钟

讨论

共 0 条

良言一句三冬暖,恶语伤人六月寒。

加载评论中…