How can I prevent file association from resetting: .R <> RStudio

Solution 1:

  1. Locate your .R file, from the Finder menu bar select File > Get Info.
  2. In the Get Info window, move down to the section for Open with: and select the RStudio.app.
  3. Just below the dropdown list, click on Change All...
  4. You will get a dialog box that says:

    Are you sure you want to change all similar documents to open with the application “RStudio”?

    This change will apply to all documents with extension ".R".
  5. Click Continue. This should set all .R files to open with RStudio.

(Here are sample screenshots using a text file named text.txt.

Screenshot of the Get Info window

Screenshot of the dialog box to confirm changing the application