title: Command to see 'R' path that RStudio is using
body: <h1>Original Question</h1>
  
  <p>This seems easy and has likely been asked before, but I could not find it via a search.</p>
  
  <hr>
  
  <p>I have a few flavors of <code>R</code> installed.  I simply want to know, when I run RStudio, which flavor of <code>R</code> is it pointing to.  So, I need a command -- within RStudio itself, ideally -- that can tell me the underlying <code>R</code> executable that is being used for this RStudio window that I am currently working with.</p>
  
  <hr>
  
  <p>To be clear, I do not need / want to know the <strong>version</strong> of R that I'm using (e.g., <code>R version 3.2.2 (2015-08-14) -- 'Fire Safety'</code>).  Instead, I want to know the actual path that RStudio is using to get to R -- looking at it from within RStudio -- so that I know "for reals" which version it's using.  (E.g., <code>/usr/local/bin/R</code>.)</p>
  
  <hr>
  
  <h1>Edit &amp; Answer</h1>
  
  <p>There are a lot of great discussions here, and some are OS-specific.  I have a Mac.  In my case, I found that:</p>
  
  <pre><code>&gt; system("type R")
  R is /usr/local/bin/R
  
  &gt; R.home()
  [1] "/usr/local/Cellar/r/3.2.2_1/R.framework/Resources"
  
  &gt; file.path(R.home("bin"), "R")
  [1] "/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/bin/R"
  </code></pre>
  
  <p>As those of you familiar can see, I am using <a href="http://brew.sh/" rel="noreferrer"><code>brew</code></a>.  If I look for <code>/usr/local/bin/R</code> outside of R, I see:</p>
  
  <pre><code>$ ls -l /usr/local/bin/R
  lrwxr-xr-x  1 mike  admin  25 Nov 14 17:31 /usr/local/bin/R -&gt; ../Cellar/r/3.2.2_1/bin/R
  </code></pre>
  
  <p>which eventually resolves (2 symbolic links) to:</p>
  
  <pre><code>/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/bin/R
  </code></pre>
  
  <p>as the final destination.</p>
  
  <p>So on my system (Mac OS X), <strong><em><code>file.path(R.home("bin"), "R")</code> was the most accurate</em></strong>.</p>