macOS 15.0 Sequoia下STM32CubeIDE调试器失效问题及解决
在M2芯片Mac(macOS 15.0 Sequoia)上解决STM32CubeIDE调试器启动失败问题
问题现象
- M2芯片Mac运行macOS 15.0 Sequoia,启动STM32CubeIDE v1.16.1调试器时,报错:
ST-Link Server is required to launch the debug session. Please download it on www.st.com.
- 卸载重装IDE后问题未解决;STM社区建议用
sudo启动IDE,但出于安全考虑不愿以root权限运行这款3GB的非应用商店应用。
排查过程
- 核心原因:通过图标启动IDE时,进程的环境变量PATH仅包含
/usr/bin:/bin:/usr/sbin:/sbin,未包含stlink-server所在的/usr/local/bin,即使IDE的info.plist已配置PATH也不生效。 - 尝试直接从终端启动IDE(终端自身PATH包含
/usr/local/bin),又出现新错误:No ST-LINK detected! Please connect ST-LINK and restart the debug session.
解决方案
编写启动脚本强制注入包含/usr/local/bin的PATH,步骤如下:
- 创建名为
launchstm的脚本,内容如下:
#!/bin/bash # 配置包含stlink-server的环境变量PATH export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" # 启动STM32CubeIDE主程序 /Applications/STM32CubeIDE.app/Contents/MacOS/STM32CubeIDE &
- 给脚本添加执行权限:
chmod +x launchstm
将脚本移动到系统PATH包含的目录(例如
~/bin,需确保该目录已加入系统PATH)。在终端输入
launchstm启动IDE,调试功能即可正常使用。
内容的提问来源于stack exchange,提问作者emrys57
相关产品推荐
相关产品推荐

