# 使用 Homebrew, apk, Nix, scoop, winget 安装 magika

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

## 安装

```sh
sudo av install brew:magika
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install magika
```

  证据: local Homebrew formula metadata

### Linux

- apk (92%):

```sh
sudo apk add magika
```

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

- Nix (92%):

```sh
nix profile install nixpkgs#magika
```

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

### Windows

- Scoop (92%):

```sh
scoop install main/magika
```

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

- winget (92%):

```sh
winget install --id Google.Magika -e
```

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

## 软件包事实

- **软件包键:** brew:magika
- **软件包管理器:** Homebrew
- **版本:** 1.0.2
- **来源摘要:** Fast and accurate AI powered file content types detection
- **主页:** <https://securityresearch.google/magika/>
- **仓库:** <https://github.com/google/magika>
- **最后更新:** 2026-07-15T14:17:07+09:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- magika (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

Magika is Google's AI-powered file content type detection tool. It ships as a Rust CLI plus Python, Rust, JavaScript/TypeScript, and emerging Go bindings, using a compact deep-learning model to classify binary and text files quickly on CPU.

### 项目历史

Google created the public repository in August 2023 and announced the open-source release in February 2024. Official docs describe a model trained and evaluated on roughly 100 million samples across more than 200 content types, with about 99 percent average precision and recall on Google's test set.

The project moved beyond a Python package into a multi-language toolchain. The README documents a Rust command-line tool, Python API, JavaScript package, Rust bindings, web demo, and additional bindings, with release tags split by CLI, Python, JavaScript, and Go components.

### 采用历史

Magika had unusually fast visibility because Google said it was already used at scale inside Gmail, Drive, and Safe Browsing routing, processing hundreds of billions of samples weekly. Official docs also note integrations with VirusTotal and abuse.ch.

The open-source package spread into package managers quickly: the README documents Homebrew, pipx, pip, cargo, npm, and installer scripts, while the supplied Homebrew input also lists apk, Nix, and winget packages. The GitHub repository has tens of thousands of stars and more than a thousand forks, reflecting broad interest from security and developer-tooling users.

### 使用方式

The CLI scans files or directories and can emit descriptions, labels, MIME types, scores, JSON, or JSONL. Typical package-manager usage is `magika PATH`, often recursively, as a faster and ML-backed complement to extension- or magic-number-based detection.

Library users embed Magika to classify uploads, repositories, malware samples, or large file corpora. The docs emphasize near-constant inference time because the model uses a limited subset of file content.

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

Magika is package-nerd interesting because it packages an ML model as a normal fast CLI. It belongs in the same mental drawer as `file` and libmagic, but with model assets, language bindings, and security-scanning use cases layered on top.

Its multi-artifact release style matters to maintainers: Homebrew ships the CLI, Python users install `magika`, Rust users can install `magika-cli`, JavaScript users have npm bindings, and downstreams need to track model/data changes as part of versioning.

### 时间线

- 2023: Public GitHub repository created.
- 2024: Google open-sourced Magika and announced it on the Google Open Source Blog.
- 2024: CLI, Python, Rust, and JavaScript packaging paths documented.
- 2025: Research paper published at ICSE according to official docs.
- 2026: CLI and binding release tags continue in the public repository.

### Related projects

- libmagic and the Unix `file` command are the traditional content-type detection tools Magika is commonly compared with.
- VirusTotal and abuse.ch are named by Google as integrations.
- Gmail, Drive, and Safe Browsing are named by Google as internal-scale consumers.

### 来源

- <https://github.com/google/magika>
- <https://github.com/google/magika/releases>
- <https://opensource.googleblog.com/2024/02/magika-ai-powered-fast-and-efficient-file-type-identification.html>
- <https://securityresearch.google/magika/introduction/overview/>
- source_facts.package-manager
- source_facts.repo


## 安全说明

narrow executable package without higher-risk signals.

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

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

- Nix - magika: normalized package name match | nixpkgs package indexes: magika from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix
- apk - magika - 1.1.0-r0: normalized package name match | Alpine Linux edge package indexes: magika from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | Detect file content types with deep learning | https://github.com/google/magika
- Scoop - main/magika: normalized package name match | Scoop official bucket manifest trees: bucket/magika.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1
- winget - Google.Magika: normalized package name match | Windows Package Manager source index: Google.Magika from https://cdn.winget.microsoft.com/cache/source.msix


## Combined YAML source

View the package source record on GitHub. [combined/magika.yml](https://github.com/mxcl/pkgdb/blob/main/combined/magika.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
