在较新版本的 MacOS 系统中,VSCode 安装时不再默认注册 code
到命令行 PATH
环境变量之中。而根据 VSCode 的官网指南,官方提供了两种方式注册 code
命令。
方式一为通过命令面板的形式。这种方式的主要原理是在 usr\local\bin
下建立一个 link 文件,然而经过测试,在使用 iTerm 的情况下,经常会遇到机器重启失效的情况,所以方式一并不推荐。
方式二为主动写入 shell profile 的方式,经过测试,本方式较前者稳定很多,更为推荐。
参考连接
- Visual Studio Code on macOS
- StackOverflow - “code .” is not working in on the command line for Visual Studio Code on OS X/Mac
版权声明:本文遵循 CC BY-SA 4.0 版权协议,转载请附上原文出处链接和本声明。
Copyright statement: This article follows the CC BY-SA 4.0 copyright agreement. For reprinting, please attach the original source link and this statement.