# 使用 Homebrew 安装 hf

查看 hf 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:hf
```

## 代理安全回答

hf controls Hugging Face model, dataset, and Space workflows.

- **凭据访问:** Reads Hugging Face tokens, cache files, repository credentials, and environment variables.
- **远程变更:** Can upload, delete, and change models, datasets, and Spaces.
- **发布/制品风险:** Publishes ML artifacts, datasets, and app spaces.
- **推荐控制:** Gate upload, delete, login, repo, and token commands.
- **代理使用指南:** Allow public model inspection; require approval for uploads, deletes, private repo access, and token use.

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install hf
```

  证据: local Homebrew formula metadata

## 软件包事实

- **软件包键:** brew:hf
- **软件包管理器:** Homebrew
- **版本:** 1.26.0
- **来源摘要:** Client library for huggingface.co hub
- **主页:** <https://huggingface.co/docs/huggingface_hub/guides/cli>
- **仓库:** <https://github.com/huggingface/huggingface_hub>
- **最后更新:** 2026-07-31T15:59:57Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- hf (别名)
- huggingface-cli (别名)
- tiny-agents (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 1.26.0
## 项目历史与用法

`hf` is the command-line interface distributed with Hugging Face's Hub client tooling. It gives terminal users and scripts direct access to authentication, downloads, uploads, repository management, cache management, Jobs, Spaces, datasets, models, buckets, and related Hub operations.

### 项目历史

The command comes from the `huggingface_hub` project, Hugging Face's official Python client for the Hub. The library grew with the Hub itself: first as a Python API and `huggingface-cli` utility for interacting with models, datasets, and repositories, then as a broader developer tool for HTTP uploads, cache management, inference clients, Jobs, and agent workflows.

In July 2025 Hugging Face announced the rename from `huggingface-cli` to `hf`. The stated reason was both ergonomics and command organization: the old executable name was long, and the command surface had grown enough that the project adopted a clearer resource-action pattern such as `hf auth login`, `hf download`, `hf upload`, and `hf repo`.

The v1.0 Hugging Face Hub announcement described this CLI evolution as part of a five-year effort to make `huggingface_hub` the foundation layer for open machine learning. In that framing, the CLI moved from a simple command-line helper into a comprehensive ML operations interface, while legacy patterns such as the Git-based `Repository` class and older token helpers were removed in favor of newer HTTP-first APIs.

### 采用历史

The CLI followed Hugging Face's rise as a central exchange for open ML artifacts. It is documented as part of `huggingface_hub`, installable through the core Python package, a standalone installer, `uvx hf`, and Homebrew. The Homebrew formula gives non-Python-first users a conventional package-manager route while still delivering the Hub CLI.

The executable list in the input records both `hf` and `huggingface-cli`, reflecting the transition period where existing automation may still call the legacy command name. Hugging Face's own blog post positioned the shorter command as the path for future CLI organization.

### 使用方式

`hf auth login` stores credentials for Hub operations; the environment-variable documentation says the token path defaults to `$HF_HOME/token`, which is normally `~/.cache/huggingface/token`. Other common commands download and upload files, create and manage repositories, inspect or remove local cache entries, run Jobs, work with Spaces, and interact with models, datasets, collections, endpoints, buckets, and webhooks.

For package users, `hf` is the terminal complement to the Python API. It is used in CI pipelines, model publishing scripts, cache cleanup, large-folder uploads, private-repository downloads, and agent/tooling workflows that need a stable command-line interface to the Hub.

### 为什么软件包爱好者会关心

`hf` is significant because it packages a cloud ML platform into a single Unix-style command with predictable subcommands. It is also a snapshot of the Python packaging-to-system-packaging boundary: the same tool can arrive through pip, a standalone installer, uvx, or Homebrew, and its credential/cache conventions must behave consistently across those routes.

The rename from `huggingface-cli` to `hf` is package-nerd notable because it created the usual compatibility question around executable names, aliases, formula names, shell completion, and scripts written before the CLI redesign.

### 时间线

- 2020s: `huggingface_hub` developed as Hugging Face's Python client for Hub models, datasets, Spaces, and repository operations.
- 2025-07-25: Hugging Face announced that the CLI had been renamed from `huggingface-cli` to `hf`.
- 2025: The CLI used a resource-action command pattern for auth, download, upload, repo, cache, and Jobs workflows.
- 2025: Hugging Face described the Hub client v1.0 as the result of five years of building the foundation of open machine learning.
- Package-manager era: Homebrew packages the CLI as `hf`, while the input still records the legacy `huggingface-cli` executable for compatibility.

### Related projects

- `hf` is related to `huggingface_hub`, the Hugging Face Hub, HfApi, HfFileSystem, Hugging Face Jobs, Spaces, Storage Buckets, Inference Endpoints, Tiny Agents, and the legacy `huggingface-cli` command.

### 来源

- <https://formulae.brew.sh/formula/hf>
- <https://github.com/huggingface/huggingface_hub>
- <https://huggingface.co/blog/hf-cli>
- <https://huggingface.co/blog/huggingface-hub-v1>
- <https://huggingface.co/docs/huggingface_hub/guides/cli>
- <https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables>


## 安全说明

没有找到 hf 的匹配本地密钥处理 manifest。Nucleus 软件包元数据仍在此发布，以便未来覆盖拥有稳定的软件包 URL。



## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Credential files

- Unix: ~/.cache/huggingface/token

## Combined YAML source

View the package source record on GitHub. [combined/hf.yml](https://github.com/mxcl/pkgdb/blob/main/combined/hf.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- cross-ecosystem install command graph
- curated agent safety answer
