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

Apple M1芯片Mac安装R包GLM3r失败,寻求解决方法

解决Mac Pro M1(12.6系统)安装GLM3r包时的硬编码临时路径错误

问题详情

在Mac Pro M1(系统版本12.6)上执行以下代码安装GLM3r包:

devtools::install_github("GLEON/GLM3r", ref = "GLMv.3.1.0a3")

出现安装失败,错误信息如下:

Downloading GitHub repo GLEON/GLM3r@GLMv.3.1.0a3
── R CMD build
✔ checking for file ‘/private/var/folders/8p/db7_6hmd27b8x9mzg6qh_5k00000gn/T/Rtmp3as7Dn/remotes45c6c103ec1/GLEON-GLM3r-a3c1fa0/DESCRIPTION’ ...
─ preparing ‘GLM3r’:
✔ checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘GLM3r_3.1.2.tar.gz’

installing source package ‘GLM3r’ ...
** using staged installation
** R
** exec
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
ERROR: some hard-coded temporary paths could not be fixed

removing ‘/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/GLM3r’
Warning message:
In i.p(...) :
installation of package ‘/var/folders/8p/db7_6hmd27b8x9mzg6qh_5k00000gn/T//Rtmp3as7Dn/file45c1e882854/GLM3r_3.1.2.tar.gz’ had non-zero exit status

解决方法

1. 禁用分阶段安装

错误根源大概率是R的分阶段安装机制和包内硬编码路径冲突,直接关闭该选项再尝试安装:

devtools::install_github("GLEON/GLM3r", ref = "GLMv.3.1.0a3", INSTALL_opts = "--no-staged-install")

2. 手动克隆编译安装

如果上述方法无效,手动处理源码:

  • 用git克隆指定分支到本地:
git clone --branch GLMv.3.1.0a3 https://github.com/GLEON/GLM3r.git
  • 在R中指定本地路径安装,同样禁用分阶段安装:
install.packages("/本地路径/GLM3r", repos = NULL, type = "source", INSTALL_opts = "--no-staged-install")

(注意替换成你实际的克隆路径)

3. 检查Xcode命令行工具

确保已安装编译所需的Xcode命令行工具,在终端执行:

xcode-select --install

如果提示已安装则跳过,否则按指引完成安装。

4. 用Rosetta 2运行R

M1的arm架构可能存在兼容性问题,尝试切换到Rosetta模式:

  • 找到应用程序中的R图标,右键选择「显示简介」,勾选「使用Rosetta打开」
  • 重启R后再执行安装命令

内容的提问来源于stack exchange,提问作者Faranak Omidi

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.17 17:43:09