【教程】MacOS绕过Apple Develop ID获取麦克风权限

转载请注明出处:小锋学长生活大爆炸xfxuezhagn.cn

如果本文帮助到了你,欢迎***点赞、收藏、关注***哦~

以这个电脑音频频谱显示工具为例:https://github.com/1061700625/SpectraTray

使用Swift

不需要Apple Develop ID,推荐!

原理是通过swift来做一个启动器。

0、准备干净的环境。

bash 复制代码
python -m venv tray
source tray/bin/activate
pip install -i https://pypi.org/simple pystray pillow numpy SoundCard pyobjc

1、创建原生启动器 App。

bash 复制代码
mkdir -p SpectraTray.app/Contents/{MacOS,Resources}
mkdir -p SpectraTray.app/Contents/Resources/pysrc
cp app.py SpectraTray.app/Contents/Resources/pysrc/
cp -R tray SpectraTray.app/Contents/Resources/tray
cp SpectraTray.ico SpectraTray.app/Contents/Resources/

2、写 Swift 启动器。

bash 复制代码
cat > main.swift <<'SWIFT'
import Foundation
import AVFoundation

func runPython() {
    let bundleURL = Bundle.main.bundleURL
    let py = bundleURL.appendingPathComponent("Contents/Resources/tray/bin/python3").path
    let script = bundleURL.appendingPathComponent("Contents/Resources/pysrc/app.py").path

    let task = Process()
    task.executableURL = URL(fileURLWithPath: py)
    task.arguments = [script]

    // 完全后台(不弹终端)
    task.standardOutput = FileHandle.nullDevice
    task.standardError  = FileHandle.nullDevice

    do { try task.run() } catch { }

    exit(0)
}

// 先触发一次麦克风权限(允许后 python 才能录到 BlackHole)
AVCaptureDevice.requestAccess(for: .audio) { _ in
    runPython()
}

RunLoop.main.run()
SWIFT

swiftc main.swift -o SpectraTray.app/Contents/MacOS/SpectraTray

3、写 Info.plist。

bash 复制代码
cat > SpectraTray.app/Contents/Info.plist <<'PLIST'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>CFBundleName</key><string>SpectraTray</string>
  <key>CFBundleDisplayName</key><string>SpectraTray</string>
  <key>CFBundleIdentifier</key><string>local.spectratray</string>
  <key>CFBundleExecutable</key><string>SpectraTray</string>
  <key>CFBundlePackageType</key><string>APPL</string>
  <key>CFBundleShortVersionString</key><string>0.0.2</string>
  <key>CFBundleVersion</key><string>1</string>
  <key>CFBundleIconFile</key><string>SpectraTray.ico</string>
  <key>LSBackgroundOnly</key><true/>
  <key>NSMicrophoneUsageDescription</key><string>用于捕获系统音频(如 BlackHole)并显示实时频谱</string>
  <key>LSApplicationCategoryType</key><string>public.app-category.utilities</string>
</dict>
</plist>
PLIST

4、去掉 quarantine。

bash 复制代码
xattr -dr com.apple.quarantine SpectraTray.app

5、刷新图标。

bash 复制代码
touch SpectraTray.app

6、启动 SpectraTray.app

相关推荐
大熊猫侯佩4 小时前
WWDC26:把 SwiftUI Toolbar 真正握在手心里
swiftui·swift·apple
coding4u6 小时前
Mac 外接显示器完全指南:从插上线到调好每个参数
macos·计算机外设·文件管理·显示器·策略模式·quick look扩展
zhyf1196 小时前
(Mac)Homebrew部署Obsidian+Claudian+Excalidraw
macos
chuan.bai6 小时前
Java RAG 实战(第 3 篇):从交互式聊天到多轮上下文
java·人工智能·macos·ai
Chennn__7 小时前
开源项目:Recorder — 本地离线 macOS 录音转文字(通用/课堂/雅思,可选 Ollama)
macos
AUV11078 小时前
录系统声音用什么 Mac 录屏软件:双音源到成片的五层验收
macos
大熊猫侯佩9 小时前
WWDC 26 全新 ResultsObserver:终于能在 View 外面盯着 SwiftData 了
swiftui·swift·apple
大熊猫侯佩9 小时前
别再把大模型供在云端了,WWDC26 CoreAI 大模型下凡实战
ai编程·swift·wwdc
chuan.bai9 小时前
Java RAG 实战专栏导读:从零跑通 Ollama + Qdrant + Spring Boot 知识库
java·人工智能·macos·ai
向阳是我10 小时前
两台 Mac 远程共享屏幕最佳方案:Tailscale + macOS 原生屏幕共享
macos