You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac M1 Sonoma运行SPM12时MEX文件报错求助

问题:MacOS Sonoma(M1芯片)下SPM12无法启动,MEX文件不兼容报错

启动SPM12时触发以下错误:

>> spm
Error using spm_check_installation>check_basic
SPM uses a number of MEX files, which are compiled functions.
These need to be compiled for the various platforms on which SPM
is run. It seems that the compiled files for your computer platform
are missing or not compatible. See
   https://en.wikibooks.org/wiki/SPM/Installation_on_64bit_Mac_OS_(Intel)
for information about how to compile MEX files for MACA64
in MATLAB 23.2.0.2391609 (R2023b) Update 2.

Error in spm_check_installation (line 28)
        check_basic;

Error in spm (line 290)
spm_check_installation('basic');

设备环境:

  • Mac M1 + MacOS Sonoma
  • MATLAB R2023b
  • SPM12

针对M1芯片的解决方案

1. 切换MATLAB到Rosetta模式运行

SPM12对ARM架构的原生支持不完善,先让MATLAB以Intel兼容模式运行:

  • 打开「应用程序」文件夹,找到MATLAB图标
  • 右键→「显示简介」,勾选「使用Rosetta打开」
  • 重启MATLAB

2. 手动重新编译SPM的MEX文件

默认的MEX文件是针对Intel芯片编译的,需要重新适配:

  1. 在MATLAB中导航到SPM12的根目录
  2. 在命令行输入:
    spm_mex all
    
  3. 等待编译完成,若提示Xcode命令行工具缺失,先在终端执行:
    xcode-select --install
    

3. 确认SPM路径配置

确保SPM12的完整路径已添加到MATLAB路径:

addpath('/你的SPM12安装路径')
savepath

内容的提问来源于stack exchange,提问作者Ruben Krueger

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 21:12:37