由于 macOS 10.12.3 和 10.12.5 上缺少 zlib,R 无法安装 devtools 或 git2r

R can't install devtools or git2r due to lack of zlib on macOS 10.12.3 and 10.12.5

我正在尝试在 R (3.3.2) 中安装两个包:devtoolsgit2r。它们取决于 zlib 的存在。这与 macOS Sierra (10.12.3) 一起提供,默认情况下为 1.2.8 版。 当我尝试安装这些软件包时,出现以下错误。

我已经尝试了很多东西。

我注意到有人在 GitHub 上发布了类似的问题:https://github.com/ropensci/git2r/issues。目前还没有解决方案。

这里有人有想法吗?

谢谢!

桑德

错误信息如下

configure error in "/private/tmp/RtmpP6HZFx/R.INSTALLe73412909267/git2r"

configure error


The zlib library that is required to build git2r was not found.

Please install:

zlib1g-dev (package on e.g. Debian and Ubuntu)

zlib-devel (package on e.g. Fedora, CentOS and RHEL)

and try again.

If the zlib library is installed on your system but the git2r configuration is unable to find it, you can specify the include and lib path to zlib with:

"R CMD INSTALL --configure-args='--with-zlib-include=INCLUDE_PATH --with-zlib-lib=LIB_PATH' git2r"


See "config.log" for more details

ERROR: configuration failed for package "git2r"

*removing "/usr/local/lib/R/3.3/site-library/git2r"

更新:同样的问题在 macOS X 10.12.5 和 R 3.4.0 上仍然存在——后者我 需要 DESeq2.

解决方案...嗯。不是 真的 。我只是卸载了 R 和所有的包,然后又重新安装了所有的东西。我按照此处的说明通过 homebrew 安装了 RRStudiohttps://rud.is/b/2015/10/22/installing-r-on-os-x-100-homebrew-edition/

奇怪的是:所有问题都消失了。

更新 #1:此解决方案显然不适用于 R 3.4.0 和 macOS X 10.12.5 的组合。我们需要针对此问题的解决方案。

更新 #2:我发现了我认为的问题所在:xcode 命令行工具的错误路径。

sudo xcode-select --reset 成功了,现在 xcode-select -p 指向 /Library/Developer/CommandLineTools。而 which xcode-select 指向 /usr/bin/xcode-select。谷歌搜索我发现不需要通过 App Store 安装 Xcode,因为它在 http://railsapps.github.io/xcode-command-line-tools.html 上指出:

"On earlier versions of macOS, it was more difficult to install Xcode Command Line Tools. It required a huge download of the full Xcode package from the Mac App Store or registration as an Apple developer for a smaller Command Line Tools package. Mac OS X Mavericks made installation of Xcode Command Line Tools much simpler.".

我遇到了同样的问题。我有一张 Note 8(三星)。只需转到 GitHub 并从那里安装 zlib。