# 使用 Homebrew, apk, scoop 安装 sonar-scanner

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

## 安装

```sh
sudo av install brew:sonar-scanner
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install sonar-scanner
```

  证据: local Homebrew formula metadata

### Linux

- apk (92%):

```sh
sudo apk add sonar-scanner
```

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

### Windows

- Scoop (92%):

```sh
scoop install main/sonar-scanner
```

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

## 软件包事实

- **软件包键:** brew:sonar-scanner
- **软件包管理器:** Homebrew
- **版本:** 8.1.0.6389
- **来源摘要:** Launcher to analyze a project with SonarQube
- **主页:** <https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/>
- **仓库:** <https://github.com/SonarSource/sonar-scanner-cli>
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- sonar-scanner (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

SonarScanner CLI is SonarSource's command-line scanner for running SonarQube Server and SonarQube Cloud code analysis when there is no build-system-specific scanner. It is a CI/CD staple because it turns a checked-out source tree plus `sonar-project.properties` into an analysis uploaded to a Sonar service.

### 项目历史

The public GitHub repository is the official scanner CLI source tree, and its tags include older 2.x releases. Current SonarSource documentation presents a maintained release line from 4.x through 8.x, with the README stating that project configuration is read from `sonar-project.properties` or passed on the command line.

Notable documented release changes include the 4.3 release using the SonarScanner name in logs, the 4.4 release adding a supported Docker image, the 5.0 release embedding Java 17, the 6.0 release adding a new bootstrapping mechanism and JRE provisioning for SonarQube 10.6+ and SonarCloud, and the 8.0.1 release updating embedded JREs to Java 21.

### 采用历史

The scanner is distributed as OS-specific downloads, a Docker image, a generic JVM zip, and package-manager formulae. Homebrew analytics show tens of thousands of yearly installs, which fits its role as a common CI dependency rather than a library used inside application code.

### 使用方式

Users create `sonar-project.properties` in the project root, run `sonar-scanner`, and provide server/project credentials through scanner parameters, CI secrets, or environment configuration rather than a dedicated credentials file. SonarSource warns users to prefer dedicated Maven, Gradle, or .NET scanners for those build systems.

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

SonarScanner CLI matters to package maintainers because CI images and developer machines need a reproducible scanner binary with the right Java behavior. Changes such as embedded JRE updates, Docker distribution, and auto-provisioning affect whether a package works in minimal runners, corporate networks, and long-lived build pipelines.

### 时间线

- 2019: SonarScanner CLI 4.3 documents use of the SonarScanner name in logs.
- 2020: Version 4.4 adds a supported Docker image.
- 2023: Version 5.0 updates the embedded JRE to Java 17.
- 2024: Version 6.0 adds new bootstrapping and JRE provisioning.
- 2025: Version 7.3 adds z/OS support for scanner execution.
- 2025: Version 8.0.1 updates embedded JREs to Java 21.

### Related projects

- SonarQube Server and SonarQube Cloud receive the analysis results.
- Dedicated SonarScanners exist for Maven, Gradle, and .NET and are recommended for those ecosystems.
- The scanner is also distributed as the official `sonarsource/sonar-scanner-cli` Docker image.

### 来源

- <https://docs.sonarsource.com/sonarqube-server/analyzing-source-code/scanners/sonarscanner.md>
- <https://formulae.brew.sh/api/formula/sonar-scanner.json>
- <https://github.com/SonarSource/sonar-scanner-cli>


## 安全说明

narrow executable package without higher-risk signals.

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


## 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.


## Configuration files

- Unix: sonar-project.properties, ${scanner.home}/conf/sonar-scanner.properties
## 其他软件包管理器记录

- apk - sonar-scanner - 8.1.0.6389-r0: normalized package name match | Alpine Linux edge package indexes: sonar-scanner from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Scanner CLI for SonarQube and SonarCloud | https://github.com/SonarSource/sonar-scanner-cli
- Scoop - main/sonar-scanner: normalized package name match | Scoop official bucket manifest trees: bucket/sonar-scanner.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1


## Combined YAML source

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


## 来源

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