Skip to content

Sending code to R GUI not working on M1 macOS Big Sur / R 4.1 alpha #150

Open

Description

@ltalluto

Not entirely sure if this is a SendCode issue or an R issue. I am trying to get SendCode running on the R nightly build for M1 macs here.

SendCode works fine when sending to terminal or iTerm. However, sending to R GUI manages to launch R (if it is not running), but does not send any code. I am selecting the target by using "Choose Program" in the command palette, the settings look like this:

{
	"prog": "r",
	"r":
	{
		"bracketed_paste_mode": false,
		"prog": "r"
	}
}

Possibly related, when I change the program (e.g., from R to iTerm), SendCode stops working until I restart Sublime Text.

R 4.1.0 Patched (2021-05-18 r80324)
SublimeText 3.2.2 build 3211
M1 mac, macOS 11.2.3

Activity

  1. randy3k commented on May 19, 2021

    @randy3k
    Owner

    The settings look fine. Is there any error message in the sublime console?

  2. ltalluto commented on May 19, 2021

    @ltalluto
    Author

    Here are the steps to get this console message.

    1. Package control: Choose program => R-IDE (R IDE is not running at this point)
    2. Re-start Sublime (note that sending code at this point does nothing, no message, no response)
    3. Cmd-return to send code. R GUI launches, but nothing else happens. No console message.
    4. Quit R, at which point the following message appears
      File "/Users/mtalluto/Library/Application Support/Sublime Text 3/Packages/SendCode/send_code.py", line 88, in <lambda>
        sublime.set_timeout_async(lambda: sender.send_text(cmd))
      File "/Users/mtalluto/Library/Application Support/Sublime Text 3/Packages/SendCode/code_sender/sender.py", line 130, in send_text
        self.send_to_r(cmd)
      File "/Users/mtalluto/Library/Application Support/Sublime Text 3/Packages/SendCode/code_sender/sender.py", line 139, in send_to_r
        send_to_r(cmd)
      File "/Users/mtalluto/Library/Application Support/Sublime Text 3/Packages/SendCode/code_sender/r/__init__.py", line 13, in send_to_r
        osascript(RAPPLESCRIPT, cmd)
      File "/Users/mtalluto/Library/Application Support/Sublime Text 3/Packages/SendCode/code_sender/applescript.py", line 5, in osascript
        subprocess.check_call(["osascript"] + list(args))
      File "./python3.3/subprocess.py", line 547, in check_call
    subprocess.CalledProcessError: Command '['osascript', '/Users/mtalluto/Library/Application Support/Sublime Text 3/Packages/SendCode/code_sender/r/r.applescript', 'print("Hello world")']' returned non-zero exit status 1
    
  3. randy3k commented on May 19, 2021

    @randy3k
    Owner

    You may need to allow R in Accessibility.
    Screen Shot 2021-05-19 at 11 47 51 AM

    Another thing that you could try is to open "Script Editor" and run

    tell application "R" to cmd "print('hello')"
    
  4. ltalluto commented on May 19, 2021

    @ltalluto
    Author

    Interesting. Allowing R in accessibility has no effect. Running it in Script Editor directly works fine.

  5. ltalluto commented on May 19, 2021

    @ltalluto
    Author

    Some progress, maybe. Running:

    osascript '/Users/mtalluto/Library/Application Support/Sublime Text 3/Packages/SendCode/code_sender/r/r.applescript' 'print("hello")'
    

    Directly from the command line pops up a warning from gatekeeper about allowing iTerm to control R. Allowing it then results in the command executing. In the automation tab in settings, Sublime has no checkbox for R, and I cannot find out how to enable it.

    Screenshot 2021-05-19 at 22 29 29

  6. randy3k commented on May 19, 2021

    @randy3k
    Owner

    Interesting, the following popped up the first time I sent code to R GUI.

    Screen Shot 2021-05-19 at 1 49 25 PM

    And now, I have R under Sublime Text
    Screen Shot 2021-05-19 at 1 50 51 PM

  7. ltalluto commented on May 26, 2021

    @ltalluto
    Author

    I downgraded to R 4.0.5 (running under emulation), and it works exactly as expected. So maybe this is an issue with R? When I have a chance, I can try re-installing 4.1, now that it is released.

  8. ltalluto commented on May 26, 2021

    @ltalluto
    Author

    Well, now I've updated Sublime (to build 4107), and the situation is even worse; it no longer sends to R 4.0.5 anymore either. There is no listing for Sublime Text at all under automation. So is this a Sublime issue?

  9. fabeit commented on Feb 28, 2023

    @fabeit

    It's not working for me either 4.2.1

  10. franvillamil commented on Feb 20, 2024

    @franvillamil

    Any solutions? Have the same issue, and it also doesn't show in Security & Privacy > Automation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions