If you are using TextMate and you want to run an R script using cmd + R, you will first need to configure the editor. Here's how:

Step 1 - Install R Bundles

Go to Preferences > Bundles and select: "R", "R Console (R.app)" and "R Console (Rdaemon)".


Step 2 - Configure Variables

The next step is to add a variable to TextMate. Go to TextMate > Preferences > Variables and add this variable:

TM_REXEC => /usr/local/bin/R.

This assumes that you have R installed using a package manager such as Homebrew.


Step 3 - You're Done!

Once you've completed those two steps, you should be able to run your scripts from within TextMate.