VSCode 在 MacOS 中的 code 命令行 sigmarising 2025-06-12 92 阅读1分钟 在较新版本的 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