搞什么鬼,/pkg 是什么?
What the heck is /pkg?

原始链接: https://anderegg.ca/2026/10/18/what-the-heck-is-pkg

macOS 27.0 通过一个新的 `/etc/paths.d/10-pmk-global` 文件,基于长期存在的 `path_helper` 工具,静默地将 `/pkg/env/global/bin` 添加到了系统 PATH 中。随附的 `/pkg` 目录包含 `env`、`etc`、`inv` 和 `var` 子目录,它在 macOS 26.4 中出现在 Data 卷上,并在 27.0 中进入 Signed System Volume 的根目录。其用途仍不明——有人猜测它可能支持未来的官方包管理系统,但一切尚未确认,且 "pmk" 的含义也不清楚。Apple 历史上曾使用 `/etc/paths.d` 条目来提供 rvictl 和 Cryptexes 等工具,但这次新增因缺乏任何文档说明而显得突出。作者分享这些发现是为了安抚其他在看到陌生的 `/pkg` PATH 条目时可能惊慌的人。

Hacker News 上的一篇帖子讨论了 macOS 26.4(而非最初以为的 27.0)中出现的神秘新 /pkg 目录。它包含 env、etc、inv 和 var 等子目录,env/global 被软链接到 inv/envs,以及可能指向“package management kit”的 /etc/paths.d/10-pmk-global 文件。评论者推测 Apple 可能正在构建自己的包管理器或类似 brew 的东西,也有人将其与 pkgsrc(NetBSD)比较,但目录布局并不匹配。Apple 尚未明确记录 /pkg,但引用了 eclecticlight 文章和 WWDC 会话作为线索。帖子还偏离到关于系统控制和用户自由的 Linux 与 macOS 离题辩论。总体而言,/pkg 的用途仍未确认。
相关文章

原文

October 18, 2026

Recently, while troubleshooting a PATH issue, I noticed an entry for /pkg/env/global/bin. At first, I worried that something had gone horribly wrong. Turns out, this is part of macOS 27.0… though no one is sure what it’s for yet.

First, some background. Since Mac OS X 10.5 in 2007, the OS has included a path_helper utility. This reads entries from /etc/paths as well as from any files in the /etc/paths.d directory. While one could potentially take advantage of this system, I (and I’d guess most others) handle adding new PATH entries using the .zshrc file, or similar. The path_helper utility seems to be primarily used by Apple.

In macOS 10.15, an entry was added to /etc/paths.d to support the new location of the rvictl utility. In macOS 13.3, Apple added some new entries to support Cryptexes. Now in macOS 27.0, there’s a new 10-pmk-global file which adds /pkg/env/global/bin to the PATH list.

I only started looking into this when I noticed an unfamiliar entry starting with /pkg in my PATH. I assumed something had gone awry. Then I saw that there was, indeed, a /pkg directory in the root of my filesystem. After freaking out slightly, I fell down this rabbit hole.

In a post about how macOS’s boot volume structure has been updated, Howard Oakley explains that the pkg directory was added to the Data volume in macOS 26.4, but not added to the root of the Signed System Volume until 27.0. He also notes that this is sort of a big deal.

The weird thing is, as far as I can tell, no one seems to know what this new directory is for! It’s odd that Apple would update their filesystem structure, add it to everyone’s PATH, and there not be some explicable reason.

The /pkg directory contains four subdirectories: env, etc, inv, and var. Based on its name and those subdirectories, it’s possible this could be used for an upcoming first-party package management system — but this is a wild guess. Apple recently took over the Swift Package Index, but this seems unrelated. I don’t know why you’d need a root-level directory to help with project-level dependencies. It’s also not clear what the “pmk” in /etc/paths.d/10-pmk-global refers to.

Here’s hoping we get more details on this at some point. In the meantime, maybe these details will help prevent someone else from freaking out when they see this entry in their PATH.


联系我们 contact @ memedata.com