This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Unable to install clusterProfiler on Mac M1

Hi, I failed to install clusterProfiler on Mac M1. May I ask the solution

>BiocManager::install("clusterProfiler")

Bioconductor version 3.14 (BiocManager 1.30.19), R 4.1.3 (2022-03-10)
Installing package(s) 'clusterProfiler'
also installing the dependencies ‘fgsea’, ‘DOSE’, ‘enrichplot’, ‘GOSemSim’

Warning: unable to access index for repository https://bioconductor.org/packages/3.14/bioc/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.14/bioc/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
Warning: unable to access index for repository https://bioconductor.org/packages/3.14/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.14/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
Warning: unable to access index for repository https://bioconductor.org/packages/3.14/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.14/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
Warning: unable to access index for repository https://bioconductor.org/packages/3.14/workflows/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.14/workflows/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
Warning: unable to access index for repository https://bioconductor.org/packages/3.14/books/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.14/books/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
Packages which are only available in source form, and may need compilation of
  C/C++/Fortran: ‘fgsea’ ‘GOSemSim’
Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
installing the source packages ‘fgsea’, ‘DOSE’, ‘enrichplot’, ‘GOSemSim’, ‘clusterProfiler’

trying URL 'https://bioconductor.org/packages/3.14/bioc/src/contrib/fgsea_1.20.0.tar.gz'
Content type 'application/octet-stream' length 1274430 bytes (1.2 MB)
downloaded 1.2 MB

trying URL 'https://bioconductor.org/packages/3.14/bioc/src/contrib/DOSE_3.20.1.tar.gz'
Content type 'application/octet-stream' length 6347307 bytes (6.1 MB)
downloaded 6.1 MB

trying URL 'https://bioconductor.org/packages/3.14/bioc/src/contrib/enrichplot_1.14.2.tar.gz'
Content type 'application/octet-stream' length 88711 bytes (86 KB)
downloaded 86 KB

trying URL 'https://bioconductor.org/packages/3.14/bioc/src/contrib/GOSemSim_2.20.0.tar.gz'
Content type 'application/octet-stream' length 604263 bytes (590 KB)
downloaded 590 KB

trying URL 'https://bioconductor.org/packages/3.14/bioc/src/contrib/clusterProfiler_4.2.2.tar.gz'
Content type 'application/octet-stream' length 2659285 bytes (2.5 MB)
downloaded 2.5 MB

* installing *source* package ‘fgsea’ ...
** using staged installation
** libs
g++-12 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/BH/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
**/bin/sh: g++-12: command not found
make: *** [RcppExports.o] Error 127
ERROR: compilation failed for package ‘fgsea’**
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/fgsea’
* installing *source* package ‘GOSemSim’ ...
** using staged installation
** libs
g++-12 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I/opt/R/arm64/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c ICmethod.cpp -o ICmethod.o
**/bin/sh: g++-12: command not found
make: *** [ICmethod.o] Error 127
ERROR: compilation failed for package ‘GOSemSim’**
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/GOSemSim’
ERROR: dependencies ‘fgsea’, ‘GOSemSim’ are not available for package ‘DOSE’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/DOSE’
ERROR: dependencies ‘DOSE’, ‘GOSemSim’ are not available for package ‘enrichplot’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/enrichplot’
ERROR: dependencies ‘DOSE’, ‘enrichplot’, ‘GOSemSim’ are not available for package ‘clusterProfiler’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/clusterProfiler’

The downloaded source packages are in
    ‘/private/var/folders/2n/sfnct3cs7tqbd4c7chc96q080000gn/T/RtmpJBhZLN/downloaded_packages’
Old packages: 'BH', 'bit', 'blob', 'boot', 'broom', 'bslib', 'car', 'caret', 'class',
  'cluster', 'colorspace', 'commonmark', 'cpp11', 'crayon', 'curl', 'data.table',
  'DBI', 'dbplyr', 'desc', 'digest', 'dplyr', 'dtplyr', 'e1071', 'emmeans',
  'estimability', 'evaluate', 'fansi', 'farver', 'FNN', 'fontawesome', 'forcats',
  'foreign', 'formatR', 'fs', 'future', 'future.apply', 'gargle', 'generics', 'ggpubr',
  'ggrepel', 'ggridges', 'ggsignif', 'globals', 'googlesheets4', 'gower', 'gplots',
  'gtable', 'gtools', 'hardhat', 'haven', 'highr', 'Hmisc', 'hms', 'htmlTable',
  'htmltools', 'htmlwidgets', 'httpuv', 'httr', 'ica', 'igraph', 'ipred', 'irlba',
  'isoband', 'jpeg', 'jsonlite', 'knitr', 'latticeExtra', 'lava', 'leiden', 'listenv',
  'lme4', 'lmtest', 'locfit', 'lubridate', 'maptools', 'markdown', 'MASS', 'Matrix',
  'MatrixModels', 'matrixStats', 'mgcv', 'minqa', 'modelr', 'nlme', 'nnet', 'openxlsx',
  'parallelly', 'patchwork', 'pbapply', 'pbkrtest', 'pillar', 'plotly', 'plyr', 'png',
  'polyclip', 'progressr', 'proxy', 'ps', 'purrr', 'quantreg', 'raster',
  'RColorBrewer', 'Rcpp', 'RcppAnnoy', 'RcppArmadillo', 'RcppEigen', 'RcppTOML',
  'RCurl', 'readr', 'readxl', 'recipes', 'reprex', 'reticulate', 'rmarkdown', 'rmatio',
  'rpart', 'rpart.plot', 'rprojroot', 'RSpectra', 'RSQLite', 'rstatix', 'rstudioapi',
  'Rtsne', 'rvest', 'sass', 'sctransform', 'Seurat', 'SeuratObject', 'shiny', 'sp',
  'spatial', 'spatstat.data', 'spatstat.geom', 'spatstat.random', 'spatstat.sparse',
  'spatstat.utils', 'stringi', 'stringr', 'survival', 'sys', 'terra', 'tibble',
  'tidyr', 'tidyselect', 'tidyverse', 'timeDate', 'tinytex', 'uuid', 'uwot', 'vctrs',
  'viridisLite', 'vroom', 'xfun', 'XML', 'yaml', 'zip', 'zoo'
Update all/some/none? [a/s/n]: 
n
Warning messages:
1: In install.packages(...) :
  installation of package ‘fgsea’ had non-zero exit status
2: In install.packages(...) :
  installation of package ‘GOSemSim’ had non-zero exit status
3: In install.packages(...) :
  installation of package ‘DOSE’ had non-zero exit status
4: In install.packages(...) :
  installation of package ‘enrichplot’ had non-zero exit status
5: In install.packages(...) :
  installation of package ‘clusterProfiler’ had non-zero exit status
install m1 mac clusterprofiler

Have you installed Xcode and the command line tools that go with? If not you will need to install those.

Thanks! I installed Xcode. But it seems I got the same error.

* installing *source* package ‘fgsea’ ...
** using staged installation
** libs
g++-12 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/BH/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
/bin/sh: g++-12: command not found
make: *** [RcppExports.o] Error 127
ERROR: compilation failed for package ‘fgsea’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/fgsea’
* installing *source* package ‘GOSemSim’ ...
** using staged installation
** libs
g++-12 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I/opt/R/arm64/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c ICmethod.cpp -o ICmethod.o
/bin/sh: g++-12: command not found
make: *** [ICmethod.o] Error 127
ERROR: compilation failed for package ‘GOSemSim’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/GOSemSim’
ERROR: dependencies ‘fgsea’, ‘GOSemSim’ are not available for package ‘DOSE’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/DOSE’
ERROR: dependencies ‘DOSE’, ‘GOSemSim’ are not available for package ‘enrichplot’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/enrichplot’
ERROR: dependencies ‘DOSE’, ‘enrichplot’, ‘GOSemSim’ are not available for package ‘clusterProfiler’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/clusterProfiler’

You also need to install Xcode command line tools which is a separate install. (LINK)

I have installed the command line tools.

enter image description here

But I still got the error.

Can you try to run the install from a bash shell? Default shell with macOS is now zsh and that does not seem to work.

So type bash in your terminal, which will put you in a bash shell. Tell us what you get with which g++ command. If g++ is found then the install should work in bash shell.

0 answers

No answers yet.

Log in to answer this question.