I just updated my Visual Studio application (now 1.71.0 (Universal)) on my Mac (High Sierra), and I noticed that when I start up my terminal in VSCode, that I get this message with every command that I run:
sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
I think this has something to do with me updating VS Code, but I don't know why or how to fix it. Has anyone run into this before?
CodePudding user response:
Straightforward solution
Please, see the GitHub issues:
- [MacOs][Bug][Terminal] `sed: illegal option -- r` before executing commands · Issue #159864 · microsoft/vscode.
- sed -r shell integration error on OSX · Issue #159946 · microsoft/vscode · GitHub.
The solution is to wait for a next Visual Studio Code release with the resolved issue(s).
Workaround solution #1
Please, see the GitHub issue: sed -r shell integration error on OSX · Issue #159946 · microsoft/vscode · GitHub.
Please, note the workaround-related comment:
Tyriar commented yesterday
See comments in e55863c
sed -r doesn't work on OSX Catalina, I get an error at each command in the integrated terminal
Workaround for anyone hitting this is to set
HISTCONTROL
to one oferasedups
,ignoreboth
,ignoredups
in your~/.bashrc
.
Workaround solution #2
The solution is to override («replace») the macOS (BSD) sed
with the GNU sed
.
For example, please, refer:
CodePudding user response:
This may not be the most technically savvy solution, but I did this:
- Install gsed
brew install gnu-sed
- make a symbolic link to gsed
cd /usr/local/bin
ln -s gsed sed
When VSCode fixes the issue, I will delete the symbolic link, and uninstall gsed.