anacondaからARMネイティブなディストリビューションがリリースされていたのでインストールしました。
ところが、インストール後にナビゲーターを起動すると、R Studioがパッケージに含まれていません。
ARM MAC 版の Anacondaには Rの処理環境はバンドルされていません。
別途、Rの環境をインストールすることにします。
Home Brewのインストール
x86版のBrewがインストール済みであれば外してから、ARM版をインストールします。
# uninstall x86_64 homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
# make sure you unalias "brew" if you aliased it with "arch"
# install arm64 homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# install wget (to make sure stuff is working)
brew install wget
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
==> The following new directories will be created:
/opt/homebrew/Cellar
/opt/homebrew/Caskroom
Press RETURN/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew/Cellar /opt/homebrew/Caskroom
==> /usr/bin/sudo /bin/chmod ug=rwx /opt/homebrew/Cellar /opt/homebrew/Caskroom
==> /usr/bin/sudo /usr/sbin/chown xxxxxxxx /opt/homebrew/Cellar /opt/homebrew/Caskroom
==> /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew/Cellar /opt/homebrew/Caskroom
==> /usr/bin/sudo /usr/sbin/chown -R xxxxxxxx:admin /opt/homebrew
==> /usr/bin/sudo /bin/mkdir -p /Users/xxxxxxxx/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/xxxxxxxx/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown -R xxxxxxxx /Users/xxxxxxxx/Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Enumerating objects: 233534, done.
remote: Counting objects: 100% (119/119), done.
remote: Compressing objects: 100% (107/107), done.
remote: Total 233534 (delta 19), reused 80 (delta 12), pack-reused 233415
Receiving objects: 100% (233534/233534), 67.19 MiB | 255.00 KiB/s, done.
Resolving deltas: 100% (171421/171421), done.
From https://github.com/Homebrew/brew
* [new branch] master -> origin/master
* [new tag] 0.1 -> 0.1
* [new tag] 0.2 -> 0.2
* [new tag] 0.3 -> 0.3
* [new tag] 0.4 -> 0.4
* [new tag] 0.5 -> 0.5
* [new tag] 0.6 -> 0.6
* [new tag] 0.7 -> 0.7
.
.
省略
.
.
.
* [new tag] 4.0.6 -> 4.0.6
* [new tag] 4.0.7 -> 4.0.7
* [new tag] 4.0.8 -> 4.0.8
* [new tag] 4.0.9 -> 4.0.9
HEAD is now at d80f7ac48 Merge pull request #15052 from MikeMcQuaid/formulary_service
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Next steps:
- Run brew help to get started
- Further documentation:
https://docs.brew.sh
次にwgetをインストールします
brew install wget
$ brew install wget
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 2 taps (shivammathur/php and homebrew/core).
==> New Formulae
adr-viewer mailsy
agg mariadb@10.10
aichat mariadb@10.8
aicommits mariadb@10.9
aiven-client markdownlint-cli2
akku marksman
.
.
.
省略
.
lmfit zf
luacheck zlint
lucky-commit zls
m1ddc zsh-autocomplete
macpine zsh-autopair
==> Deleted Formulae
php@7.3 ✘
You have 52 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
Please create a new installation in /opt/homebrew using one of the
"Alternative Installs" from:
https://docs.brew.sh/Installation
You can migrate your previously installed formula list with:
brew bundle dump
エラーになりました。
以前のバージョンとマイグレーションするため、以下のコマンドを試します。
brew bundle dump
$ brew bundle dump
==> Tapping homebrew/bundle
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle'...
remote: Enumerating objects: 7042, done.
remote: Counting objects: 100% (843/843), done.
remote: Compressing objects: 100% (154/154), done.
Receiving objects: 100% (7042/7042), 1.65 MiB | 340.00 KiB/s, done.
remote: Total 7042 (delta 739), reused 744 (delta 689), pack-reused 6199
Resolving deltas: 100% (4117/4117), done.
Tapped 1 command (99 files, 2MB).
次にhomebrewを別な方法でインストールします。
git clone https://github.com/Homebrew/brew homebrew
$ git clone https://github.com/Homebrew/brew homebrew
Cloning into 'homebrew'...
remote: Enumerating objects: 233534, done.
remote: Counting objects: 100% (75/75), done.
remote: Compressing objects: 100% (63/63), done.
remote: Total 233534 (delta 19), reused 36 (delta 12), pack-reused 233459
Receiving objects: 100% (233534/233534), 67.19 MiB | 333.00 KiB/s, done.
Resolving deltas: 100% (171421/171421), done.
eval "$(homebrew/bin/brew shellenv)"
brew update --force --quiet
$ brew update --force --quiet
==> Homebrew has enabled anonymous aggregate formula and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
No analytics have been recorded yet (nor will be during this `brew` run).
==> Tapping homebrew/core
Cloning into '/Users/xxxxxxxxx/homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 1442857, done.
remote: Counting objects: 100% (364/364), done.
remote: Compressing objects: 100% (185/185), done.
remote: Total 1442857 (delta 225), reused 306 (delta 179), pack-reused 1442493
Receiving objects: 100% (1442857/1442857), 556.64 MiB | 1.67 MiB/s, done.
Resolving deltas: 100% (1007537/1007537), done.
Tapped 2 commands and 6597 formulae (6,950 files, 611.9MB).
chmod -R go-w "$(brew --prefix)/share/zsh"
ライブラリのインストール
ライブラリ関係をインストールします。
ダウンロードするファイルを一時保存しておくためのディレクトリを作成します。
その中にarm64用のライブラリをダウンロードします。
#install arm64 homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
#install wget
brew install wget
# place for r-libs
mkdir ~/Downloads/libs-arm64/
# go there
cd ~/Downloads/libs-arm64
# grab'em from https://mac.r-project.org/libs-arm64/
for dl in $(curl -sS "https://mac.r-project.org/libs-arm64/" \
| xmllint --html --xpath '//td/a[contains(@href, 'tar.gz')]/@href' 2>/dev/null - \
| sed -e 's/ href="//g' -e 's/"/\n/g'); do wget https://mac.r-project.org/libs-arm64/${dl} ; done
# prime sudo
sudo ls ~/Downloads/libs-arm64
# extract'em
for gz in $(ls ~/Downloads/libs-arm64/*gz); do
sudo tar fvxz ${gz} -C /
done
64-darwin20.dmg
mac.r-project.org (mac.r-project.org) をDNSに問いあわせています... 169.60.149.197
mac.r-project.org (mac.r-project.org)|169.60.149.197|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 73110774 (70M) [application/octet-stream]
`emacs-27.1-app-arm64-darwin20.dmg' に保存中
emacs-27.1-app-arm6 100%[===================>] 69.72M 378KB/s 時間 2m 26s
2023-03-25 07:25:16 (488 KB/s) - `emacs-27.1-app-arm64-darwin20.dmg' へ保存完了 [73110774/73110774]
--2023-03-25 07:25:17-- https://mac.r-project.org/libs-arm64/tcltk-8.6.11-xft-darwin20.4-arm64.pkg
mac.r-project.org (mac.r-project.org) をDNSに問いあわせています... 169.60.149.197
mac.r-project.org (mac.r-project.org)|169.60.149.197|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 8393736 (8.0M) [application/octet-stream]
`tcltk-8.6.11-xft-darwin20.4-arm64.pkg' に保存中
tcltk-8.6.11-xft-da 100%[===================>] 8.00M 2.08MB/s 時間 3.9s
2023-03-25 07:25:21 (2.08 MB/s) - `tcltk-8.6.11-xft-darwin20.4-arm64.pkg' へ保存完了 [8393736/8393736]
--2023-03-25 07:25:21-- https://mac.r-project.org/libs-arm64/texinfo-6.7-darwin20.4-arm64.pkg
mac.r-project.org (mac.r-project.org) をDNSに問いあわせています... 169.60.149.197
mac.r-project.org (mac.r-project.org)|169.60.149.197|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 1495341 (1.4M) [application/octet-stream]
`texinfo-6.7-darwin20.4-arm64.pkg' に保存中
texinfo-6.7-darwin2 100%[===================>] 1.43M 259KB/s 時間 5.5s
2023-03-25 07:25:28 (265 KB/s) - `texinfo-6.7-darwin20.4-arm64.pkg' へ保存完了 [1495341/1495341]
ダウンロードしたファイルを展開します。
# prime sudo
sudo ls ~/Downloads/libs-arm64
# extract'em
for gz in $(ls ~/Downloads/libs-arm64/*gz); do
sudo tar fvxz ${gz} -C /
done
x opt/R/arm64/bin/lzmore
x opt/R/arm64/bin/lzfgrep
x opt/R/arm64/bin/xzmore
x opt/R/arm64/bin/xzgrep
x opt/R/arm64/bin/lzma
x opt/R/arm64/bin/lzegrep
x opt/R/arm64/bin/xzdiff
x opt/R/arm64/
x opt/R/arm64/bin/
x opt/R/arm64/include/
x opt/R/arm64/lib/
x opt/R/arm64/pkg/
x opt/R/arm64/pkg/zeromq-4.3.2-darwin.20-arm64.list
x opt/R/arm64/lib/pkgconfig/
x opt/R/arm64/lib/libzmq.la
x opt/R/arm64/lib/libzmq.a
x opt/R/arm64/lib/pkgconfig/libzmq.pc
x opt/R/arm64/include/zmq_utils.h
x opt/R/arm64/include/zmq.h
x opt/R/arm64/bin/curve_keygen
開発環境のインストール
# grab r-devel
wget https://mac.r-project.org/big-sur/R-devel/arm64/R-devel.tar.gz
$ wget https://mac.r-project.org/big-sur/R-devel/arm64/R-devel.tar.gz
--2023-03-25 07:27:52-- https://mac.r-project.org/big-sur/R-devel/arm64/R-devel.tar.gz
mac.r-project.org (mac.r-project.org) をDNSに問いあわせています... 169.60.149.197
mac.r-project.org (mac.r-project.org)|169.60.149.197|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 79330143 (76M) [application/octet-stream]
`R-devel.tar.gz' に保存中
R-devel.tar.gz 100%[===================>] 75.65M 861KB/s 時間 1m 44s
2023-03-25 07:29:37 (744 KB/s) - `R-devel.tar.gz' へ保存完了 [79330143/79330143]
圧縮ファイルを展開してインストールします。
# extract it
sudo tar fvxz R*.tar.gz -C /
x Library/Frameworks/R.framework/Versions/4.4-arm64/PrivateHeaders/R_ext/stats_package.h
x Library/Frameworks/R.framework/Versions/4.4-arm64/PrivateHeaders/R_ext/Makefile.in
x Library/Frameworks/R.framework/Versions/4.4-arm64/PrivateHeaders/R_ext/Complex.h
x Library/Frameworks/R.framework/Versions/4.4-arm64/PrivateHeaders/R_ext/Lapack.h
x Library/Frameworks/R.framework/Versions/4.4-arm64/PrivateHeaders/R_ext/Random.h
x Library/Frameworks/R.framework/Versions/4.4-arm64/PrivateHeaders/R_ext/eventloop.h
x Library/Frameworks/R.framework/Versions/4.4-arm64/PrivateHeaders/vg/valgrind.h
x Library/Frameworks/R.framework/Versions/4.4-arm64/PrivateHeaders/vg/memcheck.h
brew install libxml2 ccache libgit2 unixodbc
For pkg-config to find libxml2 you may need to set:
export PKG_CONFIG_PATH="/Users/xxxxxxxx/homebrew/opt/libxml2/lib/pkgconfig"
==> ccache
To install symlinks for compilers that will automatically use
ccache, prepend this directory to your PATH:
/Users/xxxxxxxx/homebrew/opt/ccache/libexec
If this is an upgrade and you have previously added the symlinks to
your PATH, you may need to modify it to the path specified above so
it points to the current version.
NOTE: ccache can prevent some software from compiling.
ALSO NOTE: The brew command, by design, will never use ccache.
パスをとうすために以下の一行を~/.zshrc に追加します。
export PATH=/opt/R/arm64/bin:$PATH
vi ~/.zshrc
また、コマンドプロンプトからも同じ処理実行します。
# and also run it at the command prompt
export PATH=/opt/R/arm64/bin:$PATH
変更を読み込みます。
source ~/.zshrc
続きの設定は以下のリンクへ