Hi,
Under Mojave, applescripts from Textmate  to R.app have broken.

I thought this would be fixed by adding TextMate and R.app to the apps allowed to control my computer 
(prefs: security: privacy: accessibility)

But seems not. This repro script runs properly from terminal
osascript -e 'tell application "R" to cmd "2+2" '

But from textmate, the script below activates R.app, but doesn’t execute cmd in R…

Any thought?

This is the script of the TM command I use to send the selection to R.app

#!/usr/bin/env bash

# input is selection or document
rawText="`cat`"

curDir=''
if [[ ${#TM_DIRECTORY} -gt 0 ]]; then
curDir="$TM_DIRECTORY"
fi

osascript -e 'on run(theCode)' \
 -e 'tell application "R" to activate' \
 -e 'if (item 2 of theCode) is not "" then tell application "R" to cmd "setwd('\''" & (item 2 of theCode) & "'\'')"' \
 -e 'tell application "R" to cmd (item 1 of theCode)' \
 -e 'end run' -- "$rawText" "$curDir"