zsh: command not found: code
오류는 Visual Studio Code의 CLI(Command Line Interface) 명령인 code
가 설정되지 않았기 때문에 발생합니다. 아래 단계를 따라 해결하세요.
Visual Studio Code 열기:
Command Palette 열기:
Cmd
+ Shift
+ P
를 눌러 Command Palette를 엽니다.CLI 명령 설치:
Shell Command: Install 'code' command in PATH
를 검색하고 실행합니다.code
CLI 명령을 /usr/local/bin
경로에 추가합니다.터미널 재시작:
테스트:
code --version
이 명령이 성공적으로 실행되면 CLI 설정이 완료된 것입니다.
CLI 명령 위치 확인:
/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code
경로를 환경 변수에 추가:
.zshrc
파일을 열어 경로를 추가합니다:
nano ~/.zshrc
다음 줄을 추가합니다:
export PATH="/Applications/Visual Studio Code.app/Contents/Resources/app/bin:$PATH"
저장 후 적용:
source ~/.zshrc
테스트:
code --version
CLI 설정이 완료되었다면 다시 시도하세요:
code .