1. install homebrew
mac os 용 패키지 관리자인 homebrew를 먼저 설치해줍니다. (oh-my-szh설치하기 위해서 필수는 아니지만 맥에서 다양한 패키지 설치를 할때 기본적으로 필요하기 때문에 가장 처음 설치하는 것이 좋음)
Homebrew
The Missing Package Manager for macOS (or Linux).
brew.sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
터미널에 명령어 치고 나면 비밀번호를 두번정도 쳐줘야 하니 까먹지 말 것
2. install oh-my-zsh
기본 맥 터미널이 사용성이 떨어지기 때문에 oh-my-zsh을 설치해서 터미널 꾸미기를 할 수 있다.
Oh My Zsh - a delightful & open source framework for Zsh
Oh My Zsh is a delightful, open source, community-driven framework for managing your Zsh configuration. It comes bundled with hundresd of helpful functions, plugins, themes, and a few things that make you shout... OH MY ZSH!
ohmyz.sh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
여기까지만해도 나름 깔끔해진다.
3. plugins
(1) zsh-syntax-highlighting : 명령어 구문을 하이라이팅 해주는 플러그인
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
(2) zsh-autosuggestions : 이전 명령어를 자동으로 제안해주는 플러그인
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
두 플러그인만 있어도 터미널 생활이 조금은 나아진다. 그냥 clone 하기만 한다고해서 끝난 것은 아니다.
clone 한 플러그인을 활성화 해줘야 한다.
터미널 기반의 텍스트 편집기로 zsh 셀설정을 열어서 활성화 작업이 필요하다
3.1 vim으로 셸 파일 열기
vim ~/.zshrc
i 를 눌러 문서 편집 시작~
3.2 plugins=(...) 부분에 추가
plugins=(git zsh-syntax-highlighting zsh-autosuggestions)
저장하하고 나가기 :wq
3.3 설정 적용
source ~/.zshrc
바로 변경이 안된다면 터미널을 한번 끄고 켜보기
여기까지 하면 아래와 같이 터미널이 깔끔 해진다.