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?
2 Answers
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:
-
Thank you! I don't use VSCode, but I had set up an x86_64 Terminal profile over a year ago, forgot how it worked, and accidentally deleted the command when I wanted to switch back to ARM. I tried to search for it again, and found so many convoluted answers which I knew were wrong. This is truly the simplest way to allow switching back and forth between platforms in Terminal.– bitjeepJun 16, 2022 at 15:27
-
1To avoid confusion and to be sure you are really using
x86 zshinstead of defaultzsh, you can also add"overrideName": trueallows for setting own profile name under"x86 zsh"so that the profile name appears asx86 zshinstead of defaultzshAug 9, 2022 at 7:48
I see the best option to use Rosetta settings on VS code is to download the Intel version from official website. This will by default run in i386 arch as expected.
For arch arm64 you can use either the Universal version or the Apple Silicon one.
-
VSCode for Macs are Universal builds now, that run on both Intel and Apple silicon MACS. Moreover, I have seen that running x86 applications are often quite resource intensive (CPU and Battery). It's much more efficient to setup a separate Terminal profile in your VSCode, or other IDEs like PyCharm. Oct 12, 2022 at 13:37

