MacOS – How to prevent MacVim from inheriting .profile as if it was Bash itself

bashmacosmacvimterminal

I have this guard in my .profile:

if [ -n "$BASH_VERSION" ]; then
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi

    if [ -f "$HOME/.bash_aliases" ]; then
        . "$HOME/.bash_aliases"
    fi
fi

Still, I have verified the check is passing for MacVim started from Finder, not only from bash terminal, and .bashrc contains terminal related script that seems to make MacVim not work as expected when started by double click, so I must have this check failing for non-terminal executions. I'm not sure whether this affects MacVim only or just any application. I was expecting $BASH_VERSION empty for anything started from Finder.

Any tips?

Best Answer

There is a preference in MacVim to do this.

defaults write org.vim.MacVim MMLoginShell 0