Installing R inside MSYS2 using Miniconda in Windows

Submitted by Dickens A S on Tue, 07/20/2021 - 06:19

This article demonstrates how install R using Miniconda inside MSYS2 MINGW64 shell

Download and install Miniconda

MIniconda can be downloaded from

Install miniconda iniside c:\msys64\opt\miniconda without adding to PATH

Set PATH environment variable permanently in MSYS2 .bashrc

Open c:\msys64\home\<username>\.bashrc and add scripts folder to the PATH

Example .bashrc

export PATH=$PATH:/opt/miniconda/Scripts
export PATH=$PATH:/opt/miniconda/Library/bin

Please note that we are not specifying windows path, we are using POSIX path only

Close and open the MINGW64 terminal by executing


Initiate conda inside MSYS2

Now initiate conda by issuing below command

$ conda init bash

Close and open the MINGW64 terminal by executing

Check the version of conda

$ conda --version
conda 4.10.3

Install R using conda

$ conda install -c r r-irkernel

Check the version of R

$ R --version
R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see

Now you can install jupyter and enjoy programming in R

Important Note: a shell code introduced inside file .bash_profile as below

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
eval "$('/opt/miniconda/Scripts/conda.exe' 'shell.bash' 'hook')"
# <<< conda initialize <<<

If you want to work in your regular bash for other compilation works, you need to comment this

Otherwise other compilers like clang, gcc might get impacted due to the fact $PATH will be changed to point to conda folders



Add new comment