skip to Main Content

I’ve seen this post, but I don’t know how this could help me. What I want to do is to start the debugger within a Rosetta terminal. What I currently do, is start the script in debug mode till it fails and then I type arch -x86_64 zsh to enter Rosetta2 emulation. Then I restart the debugger and then it works. How can I tell debugpy to immediately start with a Rosetta2 emulation?

I have added this to my settings.json:

    "terminal.integrated.profiles.osx": {
        "x86_64 zsh": {
            "path": "arch",
            "args": [
                "-arch", "x86_64", "zsh"
            ]
        }
    }

and I can use this as a normal terminal. But how do I select this for debugpy?

For debugpy within VSCode I switch to the Run and debug view an create a launch.json as shown below:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: appName.py",
            "type": "python",
            "request": "launch",
            "program": "/abs/path/to/appName.py",
            "console": "integratedTerminal",
            "justMyCode": true
        }
    ]
}

Then I hit the start debugging button as shown in this screenshot:
enter image description here
After that a debug terminal opens and fails since it is running on arm64. If I manually switch this terminal to x86_64 and hit the run and debug button again, it works.

2

Answers


  1. Try the following solution

    use automationProfile

    settings.json

    
    {
      // for tasks and debug
      "terminal.integrated.automationProfile.osx": {
        "path": "/bin/sh",
        "args": [
            "-arch", "x86_64", "zsh"
        ]
      }
    }
    
    

    refs

    https://code.visualstudio.com/docs/terminal/profiles#_configuring-the-taskdebug-profile

    https://code.visualstudio.com/docs/terminal/basics#_terminal-shells

    https://code.visualstudio.com/docs/python/debugging#_console

    Login or Signup to reply.
  2. xgqfrms’ answer sounds to me to be on the right track with usage of the terminal.automationProfile.<platform> settings, but I’m pretty sure arch needs to be the wrapper program, which I’m assuming would look something more along the lines of this:

    "terminal.integrated.automationProfile.osx": {
        "path": "arch", // full path might be needed
        "args": ["-arch", "x86_64", "zsh"],
    },
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search