Skip to content

Instantly share code, notes, and snippets.

@dahlia
Last active October 23, 2022 09:44
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dahlia/f7804869ae8bfe40f040c7824d1816cf to your computer and use it in GitHub Desktop.
Save dahlia/f7804869ae8bfe40f040c7824d1816cf to your computer and use it in GitHub Desktop.
Dirty workaround to let VS Code Live Share run on Apple silicon Macs without Rosetta 2

As of June 2022, VS Code's Live Share still does not work well on Apple silicon Macs (M1/M2 series) without Rosetta 2. Although this bug is tracked in the official issue tracker on GitHub, unfortuneately, Live Share extension is not open source, so no outsiders can send any patch to address this bug to the upstream. Instead, I'd like to share a workaround I found:1

  1. Install .NET SDK 6 (arm64) or higher. It's also available on Homebrew Cask: brew install --cask dotnet-sdk.

  2. Replace vsls-agent (no postfix) in ~/.vscode/extensions/ms-vsliveshare.vsliveshare-*/dotnet_modules/ directory (use your version instead of *) with vsls-agent included in this Gist.

  3. Make it executable: chmod +x ~/.vscode/extensions/ms-vsliveshare.vsliveshare-*/dotnet_modules/vsls-agent.

  4. Reload VS Code.

That's all. Of course, this dirty fix will be overwritten when the Live Share extension is upgraded.

Footnotes

  1. If you are interested in the details, please see my previous comments too: A & B.

#!/bin/bash
set -eou pipefail
if ! command -v dotnet > /dev/null || [[ "$(dotnet --version)" != 6.* ]]; then
echo Install .NET SDK 6 or higher first. >&2
exit 1
fi
runtime_version="$( \
dotnet --list-runtimes \
| grep '^Microsoft.NETCore.App\b' \
| awk '{ print $2 }'
)"
dotnet --fx-version "$runtime_version" \
"$(dirname "$0")/vsls-agent.dll" \
"$@" || exit $?
@Geczy
Copy link

Geczy commented Jun 21, 2022

this actually works, thanks!

@davidmeadejr
Copy link

I've been looking all over the net for a solution to this issue, thanks

@chrisdevereux
Copy link

chrisdevereux commented Aug 24, 2022

Absolutely brilliant - working for me too, thanks so much!

If anyone else is using a development container you can also use this approach inside that (although you'll need to install .NET inside the container inside the container and add it to your path first, rather than using brew). Could maybe be incorporated into the container's Dockerfile to work around being cleared on rebuild.

@elroychua
Copy link

Thanks for this! Was wondering if you had a solution for Live Share audio? Seems to still have issues on Monterrey.

@dahlia
Copy link
Author

dahlia commented Oct 23, 2022

@elroychua Unfortunately, no. I've never tried to use Live Share Audio, so haven't needed a workaround for it for myself.

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