# 使用 Homebrew, apk, chocolatey, apt, dnf, MacPorts, Nix, pacman, zypper, scoop, winget 安装 file-formula

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

## 安装

```sh
sudo av install brew:file-formula
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install file-formula
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install file
```

  证据: MacPorts ports tree: sysutils/file/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add file
```

  证据: Alpine Linux edge package indexes: file from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install file
```

  证据: Debian stable package indexes: file from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install file
```

  证据: Fedora Rawhide package metadata: file from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#file
```

  证据: nixpkgs package indexes: file from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix

- pacman (92%):

```sh
sudo pacman -S file
```

  证据: Arch Linux sync databases: file from https://geo.mirror.pkgbuild.com/core/os/x86_64/core.db.tar.gz

- zypper (92%):

```sh
sudo zypper install file
```

  证据: openSUSE Tumbleweed package metadata: file from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

### Windows

- Chocolatey (92%):

```sh
choco install file
```

  证据: Chocolatey community package catalog: file from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='8.17','wwphone-cti'

- Scoop (92%):

```sh
scoop install main/file
```

  证据: Scoop official bucket manifest trees: bucket/file.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

- winget (92%):

```sh
winget install --id GnuWin32.File -e
```

  证据: Windows Package Manager source index: GnuWin32.File from https://cdn.winget.microsoft.com/cache/source.msix

## 软件包事实

- **软件包键:** brew:file-formula
- **软件包管理器:** Homebrew
- **版本:** 5.48
- **来源摘要:** Utility to determine file types
- **主页:** <https://darwinsys.com/file/>
- **仓库:** <https://github.com/file/file>
- **最后更新:** 2026-06-22T14:03:20-07:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- file (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

file is the widely used Unix command and libmagic library for identifying file types from contents rather than names or extensions.

### 项目历史

Ian Darwin's official page distinguishes the historical Bell Labs Unix file command from his free reimplementation. It notes that the original command shipped with Bell Labs Unix, including a Research 4th Edition man page from 1973, but was not generally available in source form before Darwin's reimplementation.

Darwin's implementation and magic file began in 1987; the page shows an RCS initial revision dated August 23, 1987. The README describes Release 5.x as Ian Darwin's implementation of the Unix file command and says it knows the magic numbers of several thousand file types.

Maintenance later broadened. The README credits Guy Harris as the prime contributor to Release 3.8, Christos Zoulas as the prime contributor to Release 3.0, and Mans Rullgard as the prime contributor to 4.0, where the code was refactored into libmagic and the file command was rewritten on top of that library.

### 采用历史

The official README states that this version is the standard file command for Linux, BSD, and other systems. Darwin's page adds that it ships with most free operating systems, has been ported to systems including DOS, Microsoft Windows, and OS/2, and that OpenBSD uses the project's configuration files even though it maintains its own code.

The supplied package metadata reflects that platform reach, listing packages across Homebrew, Alpine, Debian, Ubuntu, Fedora, MacPorts, Nix, Arch, Scoop, Chocolatey, winget, and openSUSE.

### 使用方式

The command-line use is simple: pass paths to file and receive textual guesses about their data type. The important behavior is that it examines file contents, including filesystem data, magic rules, and hardwired text/encoding checks, rather than relying on filename extensions.

The libmagic split made the same detection engine reusable by other programs without spawning the file command. The README and homepage call out libmagic as a library interface for third-party file-type detection.

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

file is one of the core Unix plumbing commands package maintainers take for granted until it is missing, stale, or misdetecting a format. It underpins configure scripts, build systems, MIME/type detection, archive inspection, and debugging sessions.

Its magic database is also culturally important: maintaining file means maintaining a compact, portable folk taxonomy of binary formats, text encodings, archives, executable formats, and application data.

### 时间线

- 1973: A Research 4th Edition Unix file man page documents the earlier Bell Labs command.
- 1987: Ian Darwin's RCS history records the initial revision of his free implementation.
- Release 3.0: Christos Zoulas contributes major code changes.
- Release 3.8: Guy Harris contributes byte-order independence and other large changes.
- Release 4.0: The code is refactored into libmagic plus a command-line frontend.
- Release 5.x: The README identifies it as the standard file command for Linux, BSD, and other systems.

### Related projects

- file is related to libmagic consumers, MIME detection systems, Unix magic(5) databases, package build tooling, and operating-system file managers that need content-based type detection.

### 来源

- <https://darwinsys.com/file>
- <https://github.com/file/file#readme>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals

## 其他软件包管理器记录

- MacPorts - file: installed executable or alias match | MacPorts ports tree: sysutils/file/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Debian apt - file - 1:5.46-5: installed executable or alias match | Debian stable package indexes: file from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Recognize the type of data in a file using "magic" numbers | https://www.darwinsys.com/file/
- Debian apt - libmagic-dev - 1:5.46-5: installed executable or alias match | Debian stable package indexes: libmagic-dev from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Recognize the type of data in a file using "magic" numbers - development | https://www.darwinsys.com/file/
- Debian apt - libmagic-mgc - 1:5.46-5: installed executable or alias match | Debian stable package indexes: libmagic-mgc from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | File type determination library using "magic" numbers (compiled magic file) | https://www.darwinsys.com/file/
- Debian apt - libmagic1t64 - 1:5.46-5: installed executable or alias match | Debian stable package indexes: libmagic1t64 from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Recognize the type of data in a file using "magic" numbers - library | https://www.darwinsys.com/file/
- Nix - file: installed executable or alias match | nixpkgs package indexes: file from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix
- Ubuntu apt - file - 1:5.45-3build1: installed executable or alias match | Ubuntu 24.04 LTS package indexes: file from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | Recognize the type of data in a file using "magic" numbers | https://www.darwinsys.com/file/
- Ubuntu apt - libmagic-dev - 1:5.45-3build1: installed executable or alias match | Ubuntu 24.04 LTS package indexes: libmagic-dev from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | Recognize the type of data in a file using "magic" numbers - development | https://www.darwinsys.com/file/
- Ubuntu apt - libmagic-mgc - 1:5.45-3build1: installed executable or alias match | Ubuntu 24.04 LTS package indexes: libmagic-mgc from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | File type determination library using "magic" numbers (compiled magic file) | https://www.darwinsys.com/file/
- Ubuntu apt - libmagic1t64 - 1:5.45-3build1: installed executable or alias match | Ubuntu 24.04 LTS package indexes: libmagic1t64 from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | Recognize the type of data in a file using "magic" numbers - library | https://www.darwinsys.com/file/
- apk - file - 5.47-r2: installed executable or alias match | Alpine Linux edge package indexes: file from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | File type identification utility | https://www.darwinsys.com/file/
- apk - file-dev - 5.47-r2: installed executable or alias match | Alpine Linux edge package indexes: file-dev from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | File type identification utility (development files) | https://www.darwinsys.com/file/
- apk - file-doc - 5.47-r2: installed executable or alias match | Alpine Linux edge package indexes: file-doc from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | File type identification utility (documentation) | https://www.darwinsys.com/file/
- apk - libmagic - 5.47-r2: installed executable or alias match | Alpine Linux edge package indexes: libmagic from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | File type identification library | https://www.darwinsys.com/file/
- apk - libmagic-static - 5.47-r2: installed executable or alias match | Alpine Linux edge package indexes: libmagic-static from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | File type identification utility (static library) | https://www.darwinsys.com/file/
- dnf - file - 5.47-3.fc45: installed executable or alias match | Fedora Rawhide package metadata: file from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Utility for determining file types | https://www.darwinsys.com/file/


## Combined YAML source

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


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
