2019年1月21日 星期一

Mac上用Homebrew安裝R語言

在Mac上面安裝R語言,可以使用Homebrew這個軟體管理程式來直接安裝。指令如下(不需要使用到系統管理者權限):
  1. brew info R
  2. brew install R
第一個指令是看安裝的R版本、第二個指令就是直接安裝,做完就裝好了~

照這個方式安裝後的R程式的路徑與版本是:
  • which R
    /usr/local/bin/R
  • R --version
    R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
    Copyright (C) 2018 The R Foundation for Statistical Computing
    Platform: x86_64-apple-darwin18.2.0 (64-bit)

安裝過程的詳細內容如下
$ brew info R
R: stable 3.5.2 (bottled)
Software environment for statistical computing
https://www.r-project.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/r.rb
==> Dependencies
Build: pkg-config ✘
Required: gcc ✘, gettext ✔, jpeg ✘, libpng ✘, openblas ✘, pcre ✘, readline ✘, xz ✔
$ brew install R
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
...
...

==> Installing dependencies for r: gmp, isl, mpfr, libmpc, gcc, jpeg, libpng, openblas, pcre and readline
==> Installing r dependency: gmp
==> Downloading https://homebrew.bintray.com/bottles/gmp-6.1.2_2.mojave.bottle.t
######################################################################## 100.0%
==> Pouring gmp-6.1.2_2.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/gmp/6.1.2_2: 18 files, 3.1MB
==> Installing r dependency: isl
==> Downloading https://homebrew.bintray.com/bottles/isl-0.20.mojave.bottle.tar.
######################################################################## 100.0%
==> Pouring isl-0.20.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/isl/0.20: 71 files, 3.9MB
==> Installing r dependency: mpfr
==> Downloading https://homebrew.bintray.com/bottles/mpfr-4.0.1.mojave.bottle.ta
######################################################################## 100.0%
==> Pouring mpfr-4.0.1.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/mpfr/4.0.1: 28 files, 4.6MB
==> Installing r dependency: libmpc
==> Downloading https://homebrew.bintray.com/bottles/libmpc-1.1.0.mojave.bottle.
######################################################################## 100.0%
==> Pouring libmpc-1.1.0.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/libmpc/1.1.0: 12 files, 354KB
==> Installing r dependency: gcc
==> Downloading https://homebrew.bintray.com/bottles/gcc-8.2.0.mojave.bottle.2.t
######################################################################## 100.0%
==> Pouring gcc-8.2.0.mojave.bottle.2.tar.gz
🍺  /usr/local/Cellar/gcc/8.2.0: 1,413 files, 295.9MB
==> Installing r dependency: jpeg
==> Downloading https://homebrew.bintray.com/bottles/jpeg-9c.mojave.bottle.tar.g
######################################################################## 100.0%
==> Pouring jpeg-9c.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/jpeg/9c: 21 files, 733.4KB
==> Installing r dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.36.mojave.bottle
######################################################################## 100.0%
==> Pouring libpng-1.6.36.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/libpng/1.6.36: 27 files, 1.2MB
==> Installing r dependency: openblas
==> Downloading https://homebrew.bintray.com/bottles/openblas-0.3.5.mojave.bottl
######################################################################## 100.0%
==> Pouring openblas-0.3.5.mojave.bottle.tar.gz
==> Caveats
openblas is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BLAS and LAPACK in the Accelerate framework.

For compilers to find openblas you may need to set:
  export LDFLAGS="-L/usr/local/opt/openblas/lib"
  export CPPFLAGS="-I/usr/local/opt/openblas/include"

==> Summary
🍺  /usr/local/Cellar/openblas/0.3.5: 21 files, 117.6MB
==> Installing r dependency: pcre
==> Downloading https://homebrew.bintray.com/bottles/pcre-8.42.mojave.bottle.tar
######################################################################## 100.0%
==> Pouring pcre-8.42.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/pcre/8.42: 204 files, 5.5MB
==> Installing r dependency: readline
==> Downloading https://homebrew.bintray.com/bottles/readline-8.0.0.mojave.bottl
######################################################################## 100.0%
==> Pouring readline-8.0.0.mojave.bottle.tar.gz
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

For compilers to find readline you may need to set:
  export LDFLAGS="-L/usr/local/opt/readline/lib"
  export CPPFLAGS="-I/usr/local/opt/readline/include"

==> Summary
🍺  /usr/local/Cellar/readline/8.0.0: 48 files, 1.5MB
==> Installing r
==> Downloading https://homebrew.bintray.com/bottles/r-3.5.2_2.mojave.bottle.tar
######################################################################## 100.0%
==> Pouring r-3.5.2_2.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/r/3.5.2_2: 2,116 files, 55.7MB
==> Caveats
==> openblas
openblas is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BLAS and LAPACK in the Accelerate framework.

For compilers to find openblas you may need to set:
  export LDFLAGS="-L/usr/local/opt/openblas/lib"
  export CPPFLAGS="-I/usr/local/opt/openblas/include"

==> readline
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

For compilers to find readline you may need to set:
  export LDFLAGS="-L/usr/local/opt/readline/lib"
  export CPPFLAGS="-I/usr/local/opt/readline/include"
這邊可以看到用到的GCC版本是gcc-8.2.0。
其他安裝方式請看下方的參考資訊與相關資訊

參考資料與相關資訊

_EOF_

沒有留言:

張貼留言