ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • m1 mac, 맥북 터미널 꾸미기, iTerm color theme 설정, iTerm 유용한 플러그인 설정
    기타 2023. 3. 5. 19:28
    반응형

    안녕하세요 ㅎㅎ 

    맥북을 사거나 새롭게 바꾸면 항상 제일 먼저 하는 일, 터미널 꾸미기 아닌가요..? ㅎㅎ 

    뭔가 이제는 기본 터미널을 못쓰겠더라구요 어색해서 

    매번 다시 찾아보기 귀찮아서 한번에 정리해왔습니다. 

    참고로 아래 내용들은 m1 맥북을 기준으로 작성했다는 점 알아주세요 ㅎ ㅎ

    1️⃣ iTerm2 설치

    https://iterm2.com/

     

    iTerm2 - macOS Terminal Replacement

    iTerm2 by George Nachman. Website by Matthew Freeman, George Nachman, and James A. Rosen. Website updated and optimized by HexBrain

    iterm2.com

    - 아래 링크에서 다운로드를 받아 iTerm2를 설치해주세요

    2️⃣ zsh 설치

    • homebrew가 설치 되어 있어야 합니다., 설치 되어 있지 않다면 homebrew 먼저 설치해야 합니다.
    # zsh install
    brew install zsh
    
    # oh-my-zsh install
    sh -c "$(curl -fsSL <https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh>)"
    

    3️⃣ iTerm2에서 사용할 컬러 테마 고르기

     
    현재 iterm2의 디자인이 마음에 들지 않아요. 이쁜 컬러 테마를 골라서 꾸며봅시다! 😊
     
    아래 사이트에서 다양한 컬러 테마를 고를 수 있어요.
     
    이곳에서 마음에 드는 테마를 고른 후 링크를 클릭하세요.
     
    링크를 클릭하면 코드로 가득 찬 화면이 나와요. 화면은 무시하고 링크를 복사하세요.

    color theme을 다운로드해서 모아놓을 디렉토리를 만들고, 해당 디렉토리에서 위 링크를 다운로드 합니다.

    cd util
    
    curl -LO {다운받을 theme 링크} 
    // ex
    // curl -LO <https://raw.githubusercontent.com/mbadolato/iTerm2-Color-Schemes/master/schemes/Snazzy.itermcolors>
    

     

    4️⃣ color theme 적용하기

    • iTerm2를 열고 command + , 를 눌러 설정 창에 진입합니다.
    • profiles → color에 가서 Color presets.. 를 누르고 하단에 Import를 클릭합니다.

    • 위에서 다운 받은 파일을 선택해서 넣어줍니다. 파일 이름은 이런식으로 저장 되어 있습니다. ex)Desert.itermcolors
    • 저장 후에는 이렇게 보입니다.

    - import한 color theme을 선택하면 적용이 됩니다.

    5️⃣ theme 적용하기

    • 현재 checkout 중인 branch를 알게 해주는 ‘agnoster’ theme을 적용해봅시다.
    • iterm에 vi ~/.zshrc 를 입력해 특정 부분을 수정해 줄 것이에용
    If you come from bash you might have to change your $PATH.
    # export PATH=$HOME/bin:/usr/local/bin:$PATH
    
    # Path to your oh-my-zsh installation.
    export ZSH="$HOME/.oh-my-zsh"
    
    # Set name of the theme to load --- if set to "random", it will
    # load a random theme each time oh-my-zsh is loaded, in which case,
    # to know which specific one was loaded, run: echo $RANDOM_THEME
    # See <https://github.com/ohmyzsh/ohmyzsh/wiki/Themes>
    ZSH_THEME="agnoster"
    
    # Set list of themes to pick from when loading at random
    # Setting this variable when ZSH_THEME=random will cause zsh to load
    # a theme from this variable instead of looking in $ZSH/themes/
    # If set to an empty array, this variable will have no effect.
    # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
    
    # Uncomment the following line to use case-sensitive completion.
    # CASE_SENSITIVE="true"
    
    # Uncomment the following line to use hyphen-insensitive completion.
    # Case-sensitive completion must be off. _ and - will be interchangeable.
    # HYPHEN_INSENSITIVE="true"
    
    # Uncomment one of the following lines to change the auto-update behavior
    # zstyle ':omz:update' mode disabled  # disable automatic updates
    # zstyle ':omz:update' mode auto      # update automatically without asking
    # zstyle ':omz:update' mode reminder  # just remind me to update when it's time
    
    # Uncomment the following line to change how often to auto-update (in days).
    # zstyle ':omz:update' frequency 13
    
    • 저 위에 ‘ZSH_THEME’ 부분을 수정 또는 추가해 줄 것이에요
    • ZSH_THEME="agnoster" 이렇게 수정하고 저장(!wq)하고 눌러서 나오면 됩니다.

    6️⃣ font 변경하기

    • 여기까지 적용하고 나면 한글이 깨지는 현상을 발견하게 됩니다.
    • font를 바꿔줍시다 
    • 개발자들이 많이 사용하는 Naver D2 coding font입니다. 들어가서 링크에서 다운받읍시다.

    https://github.com/naver/d2codingfont

    • zip 파일을 다운 받은 후 , 폴더에 들어가서 폰트를 클릭해서 설치를 꼭 해주어야 합니다.
    • 폰트를 설치하고 난 뒤, 아까와 같이 command + , 를 눌러 설정창에 들어간 후 profile → text를 누릅니다.

    Font를 방금 설치한 D2Coding으로 바꿔줍시다.

    7️⃣ 유용한 플러그인 설치하기

    • iterm2에는 여러 유용한 플러그인들을 설치할 수 있습니다.
    • 플러그인을 설치하는 방법은 다음과 같습니다.
      • 설치하고자 하는 플러그인들을 git clone으로 다운 받는다. (유용한 플러그인들은 대부분 오픈소스로 공개되어 있기 때문에 git clone으로 다운 받을 수 있다.)
      • vi ~/.zshrc 에 들어가서 plugin 부분을 수정한다.
      • 수정한 후 꼭!!! source ~/.zshrc를 실행해 반영 시켜주어야 한다.

    syntax highlighting

    • 명령어를 입력했을 때 해당 명령어가 맞는 명령어인지 아닌 명령어인지를 알려주는 플러그인입니다.
    • 올바른 명령어는 초록색, 올바르지 않은 명령어는 빨간색으로 표기됩니다.
    • 플러그인 설치
    git clone <https://github.com/zsh-users/zsh-syntax-highlighting.git> ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    
    • 플러그인 적용 ( vi ~/.zshrc)
    plugins=(
    	git
    	zsh-syntax-highlighting
    )
    

    zsh-autosuggestions

    • 이 플러그인은 한번이라도 사용되었던 전에 사용한 명령어를 보여줍니다.
    • 위 방향키를 누르면 명령어를 번거롭게 또 입력하지 않아도 다시 사용할 수 있습니다.
    • 플러그인 설치
    git clone <https://github.com/zsh-users/zsh-autosuggestions> ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
    
    • 플러그인 적용 ( vi ~/.zshrc)
    plugins=( 
        # other plugins...
        zsh-autosuggestions
    )
    

     

    반응형

    댓글

Designed by Tistory.