STM32CubeIDE macOS版下载失败原因及完整解决方案
STM32CubeIDE macOS版在 Safari 或 Chrome 中点击下载链接后无响应、进度条卡死、或提示‘文件已损坏’‘无法打开,因为 Apple 无法检查其是否包含恶意软件’,终端执行 ./STM32CubeIDE.app/Contents/MacOS/stm32cubeide 报错 dyld: Library not loaded: @rpath/libswt-cocoa-4965r12.jnilib。复现条件:macOS 12 Monterey / macOS 13 Ventura / macOS 14 Sonoma 系统;使用官网最新版(v1.15.0 或 v1.16.0)下载包;未禁用 Gatekeeper 或未手动授权开发者;Safari 默认阻止未签名应用;系统语言为简体中文时部分重定向链接异常。
解答
根本原因是 STM32CubeIDE macOS 版为 Java+SWT 构建的跨平台应用,其原生库(libswt-cocoa-*.jnilib)需匹配 macOS 版本和 JDK 架构,且官方分发包未通过 Apple Developer ID 签名,触发 Gatekeeper 强制拦截。同时,ST 官网下载页存在 CDN 缓存失效、User-Agent 识别错误导致跳转至 Windows 专用页面等问题。
[*]访问 ST 官方下载页 https://www.st.com/en/development-tools/stm32cubeide.html,右键「复制链接地址」,粘贴到文本编辑器中,确认 URL 含有 /stm32cubeide-macos/ 字样;若为 /stm32cubeide-windows/,说明浏览器被错误识别,此时应改用 Chrome 并在地址栏输入 chrome://settings/privacy → 关闭「发送浏览数据以改进网站兼容性」,再刷新重试。
[*]下载完成后,在 Finder 中定位 .dmg 文件 → 右键「显示简介」→ 勾选「锁定」防止误删 → 双击挂载 → 拖拽 STM32CubeIDE.app 到 Applications 文件夹(勿直接运行挂载镜像中的 app)。
[*]首次启动前,先在「系统设置 → 隐私与安全性」中找到「已阻止使用…STM32CubeIDE.app」提示,点击「仍要打开」;若无此提示,打开终端执行 sudo xattr -rd com.apple.quarantine /Applications/STM32CubeIDE.app。
[*]确保已安装 JDK 17(非 JDK 21),推荐 Adoptium Temurin 17.0.10+11 (x64) 或 Azul Zulu 17.42.19-ca-jdk17.0.10-macosx_x64;验证命令:java -version && java -XshowSettings:properties -version | grep 'os.arch\|java.home'。
[*]若仍报 libswt-cocoa 错误,在终端执行 cd /Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/org.eclipse.swt.cocoa.macosx.x86_64_*/ && ls -l libswt-cocoa*,确认存在 .jnilib 文件;若缺失或版本不匹配(如 4965r12 但系统需要 4965r13),需从 Eclipse 官网下载对应 SWT 二进制包(https://download.eclipse.org/eclipse/downloads/drops4/R4_29_0_I20230912-1800/),解压后替换插件目录下同名文件。
页:
[1]