Home > database >  Configure M1 VSCode ARM but with a rosetta terminal
Configure M1 VSCode ARM but with a rosetta terminal

Time:12-04

I am on m1 arm chip. I would like VSCode to run on ARM but I would like the vscode terminal itself to run in rosetta. How can I do that?

CodePudding user response:

How to run using Rosetta from the command line

In general, you can use the arch command to run a program using Rosetta like this:

/usr/bin/arch -arch x86_64 program args...

So you can run an instance of zsh using Rosetta like this:

/usr/bin/arch -arch x86_64 /bin/zsh

And that shell will run all subprocesses using Rosetta as well (unless one of them uses arch to switch back to arm64…).

How to set up a Visual Studio Code Terminal profile to use Rosetta

Open your settings.json file. In Code you can open settings.json from the menu bar by choosing View > Command Palette, typing open settings json into the palette text field, and then choosing “Preferences: Open Settings (JSON)” from the palette list.

Here's my settings.json with a Terminal profile added to run zsh under Rosetta:

{
    "editor.minimap.enabled": false,
    "window.zoomLevel": 1,
    "haskell.plugin.hlint.codeActionsOn": false,
    "haskell.plugin.hlint.diagnosticsOn": false,
    "editor.accessibilitySupport": "off",
    "breadcrumbs.enabled": false,
    "terminal.integrated.profiles.osx": {
        "x86 zsh": {
            "path": "/usr/bin/arch",
            "args": ["-arch", "x86_64", "/bin/zsh"]
        }
    },
    "terminal.integrated.defaultProfile.osx": "x86 zsh"
}

So copy the terminal.integrated.profiless.osx clause from that example into your own settings.json and edit it to your taste. Also copy the terminal.integrated.defaultProfile.osx setting if you want the Rosetta zsh to be your default Terminal profile.

If you don't use x86 zsh as your default Terminal profile, then you have to start it manually by using the pull-down menu attached to the button in the Terminal pane:

new Terminal pull-down menu with x86 zsh item highlighted

  • Related