From d51f0f4ba11219bcae81b657da4a39044d26764a Mon Sep 17 00:00:00 2001
From: Mrered Cio <34948506+Mrered@users.noreply.github.com>
Date: Fri, 3 May 2024 03:47:31 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20macOS=20=E4=B8=8A=20Homebr?=
=?UTF-8?q?ew=20=E6=9C=8D=E5=8A=A1=E5=AE=89=E8=A3=85=E6=96=B9=E5=BC=8F=20(?=
=?UTF-8?q?#66)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/en_US/guide/agent.md | 52 +++++++++++++++++++++++++++++++++++++++
docs/guide/agent.md | 52 +++++++++++++++++++++++++++++++++++++++
2 files changed, 104 insertions(+)
diff --git a/docs/en_US/guide/agent.md b/docs/en_US/guide/agent.md
index 4f0b070e..57c31cf4 100644
--- a/docs/en_US/guide/agent.md
+++ b/docs/en_US/guide/agent.md
@@ -243,6 +243,58 @@ launchctl remove nezha_agent
```
+Using Homebrew to install the Agent on macOS
+
+The content of this section is adapted from [🐿️松鼠收集🌰](https://blog.mre.red/archives/install_nezha_monitoring_agent_service_with_homebrew), with the permission of the original author.
+
+* Adding the Homebrew third-party repository
+
+As the package has not yet been submitted to the official Homebrew Core repository, it is currently available in the third-party Homebrew repository maintained by the author of the blog mentioned above.
+
+```sh
+brew tap brewforge/chinese
+```
+
+* Installing the Nezha Agent
+
+```sh
+brew install nezha-agent
+```
+
+* Adding environment variables
+
+```sh
+echo 'export HOMEBREW_NEZHA_AGENT_PASSWORD="your key, obtained from your service page"' >> ~/.zshrc
+echo 'export HOMEBREW_NEZHA_AGENT_SERVER="your server and port, in the format your.domain:5555"' >> ~/.zshrc
+source ~/.zshrc
+```
+
+* Starting the Nezha Agent service through Homebrew
+
+```sh
+brew services start nezha-agent
+```
+
+* Checking the service status
+
+```sh
+brew services info nezha-agent
+```
+
+* Stopping the service
+
+```sh
+brew services stop nezha-agent
+```
+
+* Uninstalling the Nezha Agent
+
+```sh
+brew rm nezha-agent
+```
+
+
+
### Installing Agent on OpenWRT
**How to solve various problems during the installation process in one step**
- Please refer to the project:
diff --git a/docs/guide/agent.md b/docs/guide/agent.md
index 404dfa94..a445c06d 100644
--- a/docs/guide/agent.md
+++ b/docs/guide/agent.md
@@ -279,6 +279,58 @@ launchctl remove nezha_agent
+### 在 macOS 中使用 Homebrew 安装 Agent
+
+***本节内容改编自 [🐿️松鼠收集🌰](https://blog.mre.red/archives/install_nezha_monitoring_agent_service_with_homebrew),改编已获得原作者授权***
+
+* 添加 Homebrew 第三方仓库
+
+***由于暂未提交到 Homebrew Core 官方库,暂时放在上述博客作者参与维护的第三方 Homebrew 仓库中***
+
+```sh
+brew tap brewforge/chinese
+```
+
+* 安装 Nezha Agent
+
+```sh
+brew install nezha-agent
+```
+
+* 添加环境变量
+
+```sh
+echo 'export HOMEBREW_NEZHA_AGENT_PASSWORD="你的密钥,在你的服务页面获取"' >> ~/.zshrc
+echo 'export HOMEBREW_NEZHA_AGENT_SERVER="你的服务器和端口,格式 your.domain:5555 "' >> ~/.zshrc
+source ~/.zshrc
+```
+
+* 通过 Homebrew 启动 Nezha Agent 服务
+
+```sh
+brew services start nezha-agent
+```
+
+* 检查服务状态
+
+```sh
+brew services info nezha-agent
+```
+
+* 停止服务
+
+```sh
+brew services stop nezha-agent
+```
+
+* 卸载 Nezha Agent
+
+```sh
+brew rm nezha-agent
+```
+
+
+
### 在 OpenWRT 中安装 Agent
**如何 一步到位,解决安装过程疑难杂症**