Change integrated terminal in VSCode from sh to zsh

Hey everyone,

I’ve been oh-my-zsh which has been really pleasant, but my default shell settings haven’t translated to vscode. When I change the setting to /bin/zsh or /usr/bin/zsh it says it can’t find an executable shell there. When I navigate to my /bin folder, it’s there and it’s executable.

Could it be because the flatpak code OSS doesn’t have the permissions to go there? The werid thing is that it’s fine with /bin/sh or /bin/bash and those have seem to have the same permissions.

(it says it doesn’t exist, but when I check it’s definitely there)

1 Like

Did you try to add “/usr/bin/zsh” instaed just of “zsh”?

/bin seams to be a symlink to /usr/bin does this exist ?

Last option would be to check your $PATH variables or the users you run the app with, if it contains /bin and /usr/bin . Just then it will find the zsh command without path.

I found a solution online!

Add this to settings:
“terminal.integrated.shell.linux”: “flatpak-spawn”,
“terminal.integrated.shellArgs.linux”: ["–host", “zsh”],

If anyone knows anything better let me know.

Not sure if this will survive a restart, haha

I tried both of these to no avail, I think it has to do with the sandboxing of flatpak apps.

Yeah, I think the best way of running VS Code is from within a toolbox. This way, you can use all the add-ons and such. But I only have one main development container. (And others for other stuff. Some people have multiple development containers, however, so this might not work as smoothly someone who does.)

Here’s a post I wrote about it back in 2019; it still holds up and is still what I do: SSH into a Toolbox - #4 by garrett

As noted in the comment, I copied the .desktop file from the toolbox to ~/.local/share/applications/ and edited the exec lines to prefix it with the toolbox command. This way, I can launch it from GNOME Shell too.

I have tried using a flatpak since, but it’s not quite right.

Meanwhile, Owen has another method too. Toolbox and Visual Studio Code Remote Containers (I haven’t tried it.)

In case anybody else is confused, the thread title “SSH into a Toolbox” is confusing - Garrett’s method is to install and run VSCode inside the toolbox. I think that’s a solid method, though as Garrrett notes, it works less well if you have multiple toolboxes, and there are some challenges in integrating it into the UI.

Would recommend! 5 stars! :wink:

More seriously, I definitely do not recommend running the Flatpak of Visual Studio Code without this, because you are not using Fedora as your development environment, you are using the Flatpak SDK and set of installed Flatpak SDK extensions. That can be pretty confusing - as this thread shows - and also misses the advantages of working with Fedora - having a rich ecosystem of development tools and libraries available to easily install.

2 Likes