# MacOS 利用Mdx 制作一个MacOS上系统自带词典 AppleDict

**URL:** <https://forum.freemdict.com/t/topic/42295>\
**Category:** 技术交流与词典编修\
**Tags:** 词典软件制作, macos, mac, 技术\
**Created:** [2025 年12 月 5 日 10:31 UTC](https://forum.freemdict.com/t/topic/42295 "2025-12-05T10:31:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![asuka214](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/a/6f9a4e/32.png) [@asuka214](https://forum.freemdict.com/u/asuka214)\
**Post date:** [2025 年12 月 5 日 10:31 UTC](https://forum.freemdict.com/t/topic/42295/1 "2025-12-05T10:31:00Z")

</div>

# macOS 原生词典制作与导入教程 (AppleDict)

* * *

## 1. 为什么选择原生词典？

macOS 的原生词典系统和系统高度融合，特别是配合触控板的 **三指轻点** 取词功能，能够提供极其便利的查词体验。

然而，macOS 自带的词典库虽然质量上乘，但毕竟数量和种类有限，难以满足专业或特定语言学习的需求。所以，我们可以通过工具将第三方词典（如 `.mdx` 格式）转换为 macOS 原生支持的格式，以满足个性化要求。

 ![1](https://forumcdn.freemdict.com/uploads/default/original/3X/1/4/14b02fd5bc8efff2b32fe2e54c105099feb2c80e.jpeg)

* * *

## 2. 环境部署与前期准备

本教程主要依赖命令行工具，请确保你对终端（Terminal）有基本的操作认知。  
_参考项目：[pyglossary](https://github.com/ilius/pyglossary/blob/master/doc/apple.md)_

### 2.1 安装 Homebrew

如果您尚未安装 Homebrew，请先在终端执行以下命令进行安装（如果已安装请跳过）：

```shell
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

```

### 2.2 搭建 Python 与 Git 环境

我们需要安装 Python 3 和 Git，并安装转换所需的 Python 库。

1. **安装基础工具** ：

2. **下载 Pyglossary 及依赖** ：  
建议在 `Downloads` 目录下进行操作，方便管理。

### 2.3 获取 Apple Dictionary Development Kit

制作词典还需要苹果提供的开发工具包。

- **方法一（推荐）** ：直接从 GitHub 克隆整理好的工具包。

- **方法二** ：从 Apple 官方下载 [Additional Tools for Xcode](https://developer.apple.com/download/all/?q=Command%20Line%20Tools)。下载后解压，找到 `Utilities/Dictionary Development Kit` 并将其放置在便于访问的路径（如 `/Applications/Utilities`）。

* * *

## 3. 准备词典源文件

本教程以常见的 **.mdx** 格式为例。其他格式的支持情况可参考 Pyglossary 文档。

**词典资源推荐：**

- [FreeMdict Forum](https://freemdict.com/)
- [FreeMdict Search](https://search.freemdict.com/)

* * *

## 4. 制作与安装步骤

我下载了一本 `牛津高階英漢雙解詞典8th.mdx` 的词典文件，本文将以此为例。

### 4.1 转换词典格式

首先创建一个工作文件夹，将你的 `.mdx` 文件放入其中。然后在终端中运行 `pyglossary` 进行转换：

```shell
# 语法说明：python3 <pyglossary路径> --write-format=AppleDict "<源文件>" "<输出名称>"
# 假设你在 Downloads 目录下：
python3 ~/Downloads/pyglossary/main.py --write-format=AppleDict "牛津高階英漢雙解詞典8th.mdx" "牛津高階英漢雙解詞典8th"

```

执行成功后，会在当前目录下生成一个名为 `牛津高階英漢雙解詞典8th` 的文件夹，其结构如下：

 ![2](https://forumcdn.freemdict.com/uploads/default/original/3X/5/e/5e4bc1af6348633216a73b1d9f3ce49ee8d871cf.jpeg)

### 4.2 配置构建环境 (Makefile)

进入生成的词典文件夹，找到 `Makefile` 文件并打开编辑。  
我们需要修改 `DICT_BUILD_TOOL_DIR` 变量，将其指向我们在 **2.3 节** 中下载的 Dictionary Development Kit 的路径。

_例如，如果你使用的是 GitHub 克隆的工具包，路径可能是 `/Users/你的用户名/Downloads/Dictionary-Development-Kit`。_

 ![3](https://forumcdn.freemdict.com/uploads/default/original/3X/0/c/0ca748b02039d16f73d1e26a2bee9bef3cae5130.jpeg)

### 4.3 编译词典

在终端中进入该词典文件夹，并执行 `make` 命令：

```shell
cd "牛津高階英漢雙解詞典8th"
make

```

编译完成后，你会在 `objects` 子文件夹中找到生成的 `.dictionary` 文件。

 ![4](https://forumcdn.freemdict.com/uploads/default/original/3X/f/6/f6b25c4c64e7c549591567e8c21ae06328552824.jpeg)

### 4.4 安装与启用

1. **安装** ：将生成的 `.dictionary` 文件移动到 macOS 的词典存放目录：

2. **启用** ：

 ![5](https://forumcdn.freemdict.com/uploads/default/original/3X/9/4/94854ae81f7f515d7b38960d80d05ef87682fff7.jpeg)

* * *

## 5. 最终效果

现在可以使用三指轻点或在词典应用中直接查询单词。

下面是我制作的日文词典效果。

 ![６](https://forumcdn.freemdict.com/uploads/default/original/3X/c/5/c5d29184874f62995a596d49f6672f5fb959b387.png)

---

<div class="post-metadata">

**Author:** ![home123](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/h/d9b06d/32.png) [@home123](https://forum.freemdict.com/u/home123)\
**Post date:** [2026 年1 月 18 日 14:17 UTC](https://forum.freemdict.com/t/topic/42295/2 "2026-01-18T14:17:30Z")

</div>

这里步骤 2.2 装 PyGlossary 可能还要兼顾 python 环境问题，比较麻烦，有更方便的方法， **直接下载图形客户端** 。

打开网址 [https://github.com/ilius/pyglossary，从](https://github.com/ilius/pyglossary%EF%BC%8C%E4%BB%8E) releases 里面下载图形工具 PyGlossaryTk-5.2.1-macos-15.dmg。解压安装到 applications 文件夹。再加权避免苹果阻止运行。

```auto
/usr/bin/xattr -d com.apple.quarantine /Applications/PyGlossaryTk.app

```

运行软件，即可可视化转换文件。

---

<div class="post-metadata">

**Author:** ![chokouu](https://forumcdn.freemdict.com/user_avatar/forum.freemdict.com/chokouu/32/78326_2.png) [@chokouu](https://forum.freemdict.com/u/chokouu)\
**Post date:** [2026 年4 月 14 日 14:07 UTC](https://forum.freemdict.com/t/topic/42295/3 "2026-04-14T14:07:58Z")

</div>

真心谢谢大佬的分享 🥰

---

<div class="post-metadata">

**Author:** ![lunabs](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/l/cab0a1/32.png) [@lunabs](https://forum.freemdict.com/u/lunabs)\
**Post date:** [2026 年4 月 18 日 13:58 UTC](https://forum.freemdict.com/t/topic/42295/4 "2026-04-18T13:58:53Z")

</div>

感谢分享~~~
