그 외/기타

맥북 포맷 + 개발 환경설정 (Home Brew)

sonoopy 2024. 10. 30. 17:29

맥북 포맷

 

1. 필요한 파일이나 중요 데이터 백업하기

 

2. 화면 모서리에 있는 Apple 메뉴()에서 '시스템 설정'을 선택

 

3. Apple ID 로그아웃, 나의 Mac 찾기 "끔"

: 혹시 연동되어 있는 기기와 충돌 및 문제가 발생할 수 있기 때문에 비활성화

 

 

4. 시스템 설정 - 일반 - 전송 또는 재설정 클릭 

 

 

5. 모든 콘텐츠 및 설정 지우기 클릭

 

 

6. macOS 설치 완료되면 초기 설정 다시 진행

: 언어, 키보드 레이아웃, wi-fi 네트워크 등 설정 후 애플 ID로 로그인

 

 


 

 

환경 설정

 

1. Home Brew 설치

 

명령어 코드 확인

https://brew.sh

 

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)"

 

다 설치 된 후 잘 깔렸는지 버전확인

brew --version

 

 

만약, "zsh: command not found: brew" 이렇게 뜨면 환경변수 설정해주기

/* 방법 1.*/
// 편집기 실행
vi ~/.zshrc
// 아래 내용 작성( i -> 작성-> esc -> :wq )
export PATH=/opt/homebrew/bin:$PATH
// 저장한 부분 실제로 적용하기
source ~/.zshrc 


/* 방법 2.*/
echo 'export PATH=/opt/homebrew/bin:$PATH' >> ~/.zshrc
source ~/.zshrc

 

 


 

 

2. iterm2 설치 및 커스텀

 

2-1. brew로 iterm2 설치

 

명령어 코드 확인

https://formulae.brew.sh/cask/iterm2#default

 

iterm2

Homebrew’s package index

formulae.brew.sh

 

brew install --cask iterm2

 

 

2-2. iterm2 내에서 brew 설치

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

 

 

2-3. iterm2 내에 oh-my-zsh 설치

brew install zsh # Mac OS 카타리나 버전부터는 기본 쉘이 zsh라 설치 안해도 됨
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

 

 

2-4. 테마 및 폰트 변경하기

 

2-4-1. 테마 변경하기

vim ~/.zshrc # 편집기 열기

 

편집기에서 ZSH_THEME을 찾은 후 "agnoster"로 변경 (default는 "robbyrussell" 테마)

다른 테마 적용하고 싶으면 해당 테마 이름으로 변경

아래 사이트에서 테마 확인 가능

https://github.com/ohmyzsh/ohmyzsh/wiki/Themes

 

Themes

🙃 A delightful community-driven (with 2,400+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, pyth...

github.com

 

수정 후 바로 적용하려면,

source ~/.zshrc

 

 

2-4-2. 폰트 변경하기 (글씨 깨짐 해결)

 

1) 폰트 설치

https://github.com/naver/d2codingfont

 

GitHub - naver/d2codingfont: D2 Coding 글꼴

D2 Coding 글꼴. Contribute to naver/d2codingfont development by creating an account on GitHub.

github.com

D2Coding-Ver1.3.2-20180524-all.ttc
8.06MB

 

 

2) iTerm2  >  Settings 클릭 (단축키 : command + ' , ')

    Profiles - Text - Font 에서 다운로드 받은 폰트 적용

 

 

2-4-3. 컬러테마 적용하기

 

1) iTerm2의 테마 목록에서 원하는 컬러 테마의 url을 복사 ( 원하는 테마 제목에서 마우스 오른쪽 버튼 - 링크 주소 복사)

https://github.com/mbadolato/iTerm2-Color-Schemes

 

GitHub - mbadolato/iTerm2-Color-Schemes: Over 325 terminal color schemes/themes for iTerm/iTerm2. Includes ports to Terminal, Ko

Over 325 terminal color schemes/themes for iTerm/iTerm2. Includes ports to Terminal, Konsole, PuTTY, Xresources, XRDB, Remmina, Termite, XFCE, Tilda, FreeBSD VT, Terminator, Kitty, MobaXterm, LXTer...

github.com

 

2) 유틸 디렉토리 생성 후 해당 디렉토리로 이동

mkdir util && cd util

 

 

 3) curl -LO [url] 입력

curl -LO https://raw.githubusercontent.com/mbadolato/iTerm2-Color-Schemes/master/schemes/Dracula%2B.itermcolors

 

 

4) iTerm2  >  Settings 클릭 (단축키 : command + ' , ')

    Profiles - Colors - Color Presets... 에서 다운로드 한 템플릿 Import 후 적용

 

 

2-4-4. 상태바 설정하기

 

1) iTerm2  >  Settings 클릭 (단축키 : command + ' , ')

    Appearance - General - Status var location: "Bottom" 설정

    Profiles - Session - Miscellaneous - Status bar enabled 체크

 

 

2) 드래그해서 원하는 컴포넌트를 Active Components로 이동 후 적용

 

 

2-4-5. 사용자 이름 숨기고 이모지 표시

 

zshrc 편집기 열어서 아래 내용 추가해주고 저장 후 source ~/.zshrc 로 적용

# 기본 사용자 이름을 숨기고 ✨ 이모지만 표시
prompt_context() {
  if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
    prompt_segment black default "%(!.%{%F{yellow}%}.)$USER ✨"
  else
    prompt_segment black default "✨"
  fi
}

 

 


 

3. 깃 설치

 

명령어 코드 확인

https://formulae.brew.sh/formula/git#default

 

git

Homebrew’s package index

formulae.brew.sh

 

brew install git

 

 


 

 

4. 인텔리제이 설치

 

명령어 코드 확인

https://formulae.brew.sh/cask/intellij-idea#default

 

intellij-idea

Homebrew’s package index

formulae.brew.sh

 

 

 

brew install --cask intellij-idea

 

 

커뮤니티 버전은 아래 코드로!

brew install --cask intellij-idea-ce

 

 


 

4. JDK 설치

 

명령어 코드 확인

https://formulae.brew.sh/formula/openjdk@17#default

 

openjdk@17

Homebrew’s package index

formulae.brew.sh

 

brew install openjdk@17

 

환경변수 설정

echo 'export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
// 시스템 Java 래퍼를 위한 심볼릭 링크 추가
sudo ln -sfn /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk

 


 

5. Postman 설치

 

명령어 코드 확인

https://formulae.brew.sh/cask/postman#default

 

postman

Homebrew’s package index

formulae.brew.sh

 

brew install --cask postman

 

 


 

6. VSCode 설치

 

명령어 코드 확인

https://formulae.brew.sh/cask/visual-studio-code#default

 

visual-studio-code

Homebrew’s package index

formulae.brew.sh

 

brew install --cask visual-studio-code

 

 


 

 

7. nvm 설치와 node 설치

 

7-1. nvm 설치 (node 버전 관리)

 

명령어 코드 확인

https://formulae.brew.sh/formula/nvm#default

 

nvm

Homebrew’s package index

formulae.brew.sh

 

 

환경변수 설정

mkdir ~/.nvm
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.zshrc
echo '[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"' >> ~/.zshrc
echo '[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"' >> ~/.zshrc
source ~/.zshrc

 

 

7-2. node 설치

 

설치가능한 노드 버전 확인

nvm ls-remote

 

nvm install {설치할 버전} // 특정 버전 설치
nvm install --lts // 최신 lts버전 설치

 

 

 


 

 

8. 구글 크롬 설치

 

명령어 코드 확인

https://formulae.brew.sh/cask/google-chrome#default

 

google-chrome

Homebrew’s package index

formulae.brew.sh

 

brew install --cask google-chrome

 

 


 

 

9. 피그마 설치

 

명령어 코드 확인

https://formulae.brew.sh/cask/figma#default

 

figma

Homebrew’s package index

formulae.brew.sh

 

brew install --cask figma