kuangre123

Claude Mac Env Audit — Security skill for Claude Code

Security community

macOS Claude Code environment audit and fixer with Chinese guidance.

How to install Claude Mac Env Audit

This entry records only its repository, not the path inside it, so there is no exact command to give. Open kuangre123/claude-mac-env-audit and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Mac Env Audit does

macOS Claude Code environment audit and fixer with Chinese guidance.

Alternatives in Security

  • Dotclaude — A comprehensive development environment with specialized AI agents for code review, security analysis, and tec 435 ★
  • Pareto Mac — by ParetoSecurity - Serves as development guide for Mac security audit tool with build instructions, contribut 431 ★
  • AWS MCP Server — by alexei-led - Features multiple Python environment setup options with detailed code style guidelines, compre 182 ★

README

Claude Env Audit

Claude Code 环境检测与修复工具,用于排查常见的代理、时区、DNS、hosts、包管理器代理、Claude / Claude Code Router 配置残留等问题,并给出中文建议。仓库同时提供 macOS 与 Windows 两个版本,按同一套思路工作:检测 → 分级 → 备份 → 确认 → 修复 → 报告。

两个版本互相独立,可以按需下载其中一个。

选择版本

版本 适用系统 下载 运行方式
macOS 版 macOS claude_mac_env_audit.sh(单个脚本) 命令行,按需申请 sudo
Windows 版 Windows 10 / 11 claude-win-env-audit.zip(含脚本与图形界面) 图形界面或命令行,按需管理员权限

macOS 版下载并运行:

curl -fsSLO https://raw.githubusercontent.com/kuangre123/claude-mac-env-audit/main/claude_mac_env_audit.sh
chmod +x claude_mac_env_audit.sh
./claude_mac_env_audit.sh --dry-run

Windows 版下载 zip 并解压后,双击 `启动审计界面.vbs` 打开图形界面,或在解压目录运行 `claude_win_env_audit.ps1` 使用命令行。完整说明见 [windows/README.md](windows/README.md)。

macOS 版

面向 macOS 的 Claude Code 环境检测与修复脚本。

脚本默认会自动修复可安全处理的本地配置项。涉及第三方 API 痕迹时会先询问确认,避免误删你仍在使用的自定义服务配置。

涉及系统设置修改的项目会按需申请 `sudo` 权限,例如修改系统时区、关闭系统代理、编辑 `/etc/hosts`。只检测模式不会申请 `sudo`。

功能

  • 检测 macOS 系统版本、架构、claude 和 node 环境。
  • 检查系统时区;默认只有明确传入目标时区时才自动修改,--aggressive 可为中国大陆时区选择迁移目标;不会把新加坡等境外时区单独判为风险。
  • 检查并可关闭 macOS 系统 HTTP/HTTPS/SOCKS/PAC 代理。
  • 检查当前 shell、launchctl、常见 shell 启动文件中的代理和基础 URL 环境变量。
  • 清理 npm/yarn/pnpm/git 中的代理残留。
  • 检查 Claude / Claude Code Router 配置中的代理、自定义端点、第三方 API 痕迹。
  • 检查 /etc/hosts 中的 Claude/Anthropic 覆盖项。
  • 检查当前出口 IP、IPv4/IPv6 出口国家、DNS 和 api.anthropic.com 连通性;默认接受中国大陆以外的国家,也可指定目标国家。
  • 每次运行会生成报告;修改文件前会生成备份。

出口国家检测是一次运行时快照,只能说明当前请求的出口位置,不能单凭一次结果证明线路长期固定。需要固定国家时,请使用 `--target-country` 并在不同时间重复运行。

使用

预览将要执行的修复,不修改系统或用户配置:

./claude_mac_env_audit.sh --dry-run

`--dry-run` 仍会在 `~/.claude-mac-env-audit/` 生成权限受限的本地报告。

只检测,不显示拟执行的修复动作:

./claude_mac_env_audit.sh --check-only

执行检测并自动修复可安全处理的项目:

./claude_mac_env_audit.sh

运行过程中如果需要修改系统级配置,脚本会提示输入 mac