When m2r is loaded it attempts to find M2. How it looks depends
on your operating system.
If you're using a Mac or Linux machine, it looks based on your
system's path. Unfortunately, R changes the system path in such
a way that the path that R sees is not the same as the path that
you'd see if you were working in the terminal. (You can open the
Terminal app on a Mac by going to
/Applications/Utilities/Terminal.) Consequently, m2r tries to
guess the file in which your path is set. To do so, it first
checks if your home directory (type echo ~/ in the terminal to
figure out which directory this is if you don't know) for the
file named .bash_profile. If this file is present, it runs it
and then checks your system's path variable (echo $PATH). If
it's not present, it does the same for .bashrc and then .profile.
In any case, once it has its best guess at your path, it looks
for "M2".
On Windows, m2r just defaults to the cloud implementation. Local
M2 instances are not currently supported on Windows.