京橋のバイオインフォマティシャンの日常

南国のビーチパラソルの下で、Rプログラムを打ってる日常を求めて、、Daily Life of Bioinformatician in Kyobashi of Osaka

Macで、RをTerminalコマンドでアンインストールするときにやること

Mac版Rのアンイストールについての諸事

Mac版Rは、GUI(R.APP)とR frameworkから構成されている。 そのため、アンイストール時には、それらフォルダを削除する。

一般的なインストールの手順では、GUIは/Applications/R.appフォルダに、R frameworkは/Library/Frameworks/R.frameworkフォルダにインストールされている。 また、 /usr/local/bin/R、/usr/local/bin/Rscriptへのリンクも存在する。

これらを踏まえて、ターミナルを使って、 R関連ファイルを削除したい場合には、次のようにコマンド実行すると良い。

sudo rm -rf \
    /Library/Frameworks/R.framework /Applications/R.app \
    /usr/local/bin/R \
    /usr/local/bin/Rscript

rmのオプションである、-r,-R --recursiveは、 「ディレクトリを再帰的に削除する」ことを意味する。

これで、Rのアンインストールは完了である。

「4.2 Uninstalling under macOS」の原文

R for macOS consists of two parts: the GUI (R.APP) and the 
R framework. Un-installation is as simple as removing those 
folders (e.g. by dragging them onto the Trash aka Bin). The 
typical installation will install the GUI into the /Applications/R.app 
folder and the R framework into the /Library/Frameworks/R.framework 
folder. The links to R and Rscript in /usr/local/bin should also
be removed.

If you want to get rid of R more completely using a Terminal, 
simply run:

sudo rm -Rf /Library/Frameworks/R.framework /Applications/R.app \
   /usr/local/bin/R /usr/local/bin/Rscript

The installation consists of up to four Apple packages:26 for 
the Intel build, org.R-project.R.fw.pkg, org.R-project.R.GUI.pkg, 
org.r-project.x86_64.tcltk.x11 and org.r-project.x86_64.texinfo. 
You can use sudo pkgutil --forget if you want the Apple Installer 
to forget about the package without deleting its files (useful 
for the R framework when installing multiple R versions in parallel), 
or after you have deleted the files. NB: the package names are 
case-sensitive and the R domain is given inconsistently.

Uninstalling the Tcl/Tk and Texinfo components (which are 
installed under /usr/local on a ‘x86_64’ build and /opt/R/arm64 
for an ‘arm64’ one) is not as simple. You can list the files they 
installed in a Terminal by e.g.

pkgutil --files org.r-project.x86_64.tcltk.x11
pkgutil --files org.r-project.x86_64.texinfo
These are paths relative to /, the root of the file system.

cran.r-project.org