Setup new installation of R in MacosX

Adapted from https://ryanhomer.github.io/posts/build-openmp-macos-catalina-complete

Install R from cran.r-project.org

At the end of ~/.zshrc add: 

export PATH=$PATH:/Library/Frameworks/R.framework/Versions/Current/Resources/bin/

Then you can use R within the terminal.


Install macbrew via:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then in ~/.Rprofile:

marcgirondot@MacBook-Pro-de-Marc ~ % cat .Rprofile

# Default CRAN mirror

options(repos=structure(c(CRAN="https://cloud.r-project.org/")))


# Path to run R with system

Sys.setenv(PATH=paste(Sys.getenv("PATH"), "/Library/Frameworks/R.framework/Versions/Current/Resources/bin/", sep=":"))

Install llvm


brew install llvm libomp


Install GCC and gettext


brew install gcc gettext


To configure R to build packages with the versions of clang and gcc you just installed, set up a Makevars file. This must be located at ~/.r/Makevars.


Some parts do no work still...


# macOS Makevars configuration for LLVM/GCC

# for OpenMP support 

# For installation details, see

# http://ryanhomer.github.io/posts/build-openmp-macos-catalina-complete

#

# Some sources used as reference:

# https://github.com/Rdatatable/data.table/wiki/Installation

# https://asieira.github.io/using-openmp-with-r-packages-in-os-x.html

# https://thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/

# https://bit.ly/3d16TuW

# https://www.kthohr.com/r-mac-source.html


XCBASE:=$(shell xcrun --show-sdk-path)

LLVMBASE:=$(shell brew --prefix llvm)

GCCBASE:=$(shell brew --prefix gcc)

GETTEXT:=$(shell brew --prefix gettext)


CC=$(LLVMBASE)/bin/clang

CXX=$(LLVMBASE)/bin/clang++

CXX11=$(LLVMBASE)/bin/clang++

CXX14=$(LLVMBASE)/bin/clang++

CXX17=$(LLVMBASE)/bin/clang++

CXX1X=$(LLVMBASE)/bin/clang++


CPPFLAGS=-isystem "$(LLVMBASE)/include" -isysroot "$(XCBASE)"

LDFLAGS=-L"$(LLVMBASE)/lib" -L"$(GETTEXT)/lib" --sysroot="$(XCBASE)"


FC=$(GCCBASE)/bin/gfortran

F77=$(GCCBASE)/bin/gfortran

FLIBS=-L$(GCCBASE)/lib/gcc/9/ -lm


To use locate in terminal:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Commentaires

Posts les plus consultés de ce blog

Standard error from Hessian Matrix... what can be done when problem occurs

stepAIC from package MASS with AICc

Install treemix in ubuntu 20.04