Can I specify my shell for vim? I'm running OS X and have zsh installed via Homebrew and am using MacVim. When I type
shell in MacVim, the shell opens up as
bash. How can I have it open as
Add or change the following line in
1This doesn't work for me. I specify
set shell=/bin/bashin ~/.vimrc, but when I execute
echo $SHELLoutput is
/bin/zsh. Apr 11, 2017 at 23:32
2@Daniel Kats, The
SHELLenv var doesn't indicate what shell is being used; it specifies what shell to use for interactive shells.– ikegamiJun 27, 2020 at 19:31
Not enough reputation for adding a comment, this is meant as a response to @BlackSheep comment in the accepted answer:
Despite the similar syntax, the
set shell=/bin/bash does not apply to shell variables, but to variables that are internal to vi, so you can run a shell even if the system's shell for the active user is not a real one.
Also you can use
:set shell=/bin/bash then
:sh if you don't want to modify
chshto change your shell on your mac.
chsh), yet MacVim was using
:shelled out. I thought it could be some weird app security / sandboxing thing with recent versions of macOS, but here is this question from 2011.