hsunny study blog

MAC 터미널 현재 위치에서 vscode 열기 본문

programming/etc

MAC 터미널 현재 위치에서 vscode 열기

헤써니 2019. 7. 9. 04:51

You can also run VS Code from the terminal by typing 'code' after adding it to the path:

 

1. Launch VS Code.

2. Open the Command Palette (Ctrl+Shift+P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.

3. Restart the terminal for the new $PATH value to take effect. You'll be able to type 'code .' in any folder to start editing files in that folder.

 

Note: If you still have the old code alias in your .bash_profile (or equivalent) from an early VS Code version, remove it and replace it by executing the Shell Command: Install 'code' command in PATH command.

 

To manually add VS Code to your path, you can run the following commands:

cat << EOF >> ~/.bash_profile
# Add Visual Studio Code (code)
export PATH="\$PATH:/Applications/Visual Studio Code.app/C

Start a new terminal to pick up your .bash_profile changes.

 

Note: The leading slash \ is required to prevent $PATH from expanding during the concatenation. Remove the leading slash if you want to run the export command directly in a terminal.

 


path 지정 후,  'code' 명령어로 vscode를 실행할 수 있습니다.

 

1. VS Code를 실행합니다.

2. Command Palette(Ctrl+Shift+P)를 열고 Shell Command: Install 'code' command in PATH를 찾기 위해 'shell command'를 입력합니다. 

Mac Command Palette: command + shift + P

3. 새로운 $PATH 값을 에 적용하기 위해 터미널을 재시작합니다. 어떤 폴더에서든 'code .'를 입력함으로써 폴더에서 파일 편집을 시작할 수 있습니다.

 

주의: 만약 .bash_profile(이나 같은 역할의 설정 파일) 옛 버전의 VS code에서 설정했던 code alias가 존재한다면, 삭제한 뒤에 Shell Command: Install 'code' command in PATH를 실행해주세요.

 

Path에 수동으로 VS Code를 추가할 수도 있습니다. 아래 명령어를 따라하시면 됩니다:

cat << EOF >> ~/.bash_profile
# Add Visual Studio Code (code)
export PATH="\$PATH:/Applications/Visual Studio Code.app/C

.bash_profile 의 변경사항을 적용하기 위해 터미널을 재시작합니다.

 

주의: PATH로 지정할 때, 가장 앞에 작성한 \는 $PATH로 설정된 것들을 잇는 중에 확장을 막기 위해 필요합니다. 만약 터미널에서 내보내기 명령을 직접 실행하려면 \를 제거해야 합니다.

 

 

https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line

 

Running Visual Studio Code on macOS

Get Visual Studio Code up and running on Mac (macOS).

code.visualstudio.com

 

'programming > etc' 카테고리의 다른 글

nvm 사용해보기 (MAC)  (0) 2021.09.02
[linux vim] vi, vim 문자열 찾기  (0) 2021.03.07
[linux vim] 파일의 맨 처음/맨 끝으로 이동하는 방법  (0) 2020.12.28
자주 사용하는 Playground  (0) 2020.12.27
zsh, oh-my-zsh  (0) 2020.08.30