πŸ’‘ ~/.bash_profile vs. ~/.zshrc κ°œλ… 정리 (Mac 개발 ν™˜κ²½ μ„€μ • 파일)

λ΄„Β·2025λ…„ 3μ›” 14일

πŸͺΒ FE Info

λͺ©λ‘ 보기
3/7
post-thumbnail

κ°œλ… (μ •μ˜)

  • μ‰˜(Shell)이 싀행될 λ•Œ μžλ™μœΌλ‘œ 섀정을 μ μš©ν•˜λŠ” 파일
  • μ‚¬μš©ν•˜λŠ” μ‰˜μ— 따라 μ μš©λ˜λŠ” μ„€μ • 파일이 닀름

μ—­ν• 

  • ν„°λ―Έλ„μ—μ„œ ν™˜κ²½ λ³€μˆ˜(PATH), λͺ…λ Ήμ–΄ μžλ™ μ‹€ν–‰ λ“±μ˜ 섀정을 μ €μž₯ν•˜λŠ” 파일
  • μ‰˜μ„ μ‹€ν–‰ν•  λ•Œ 이 νŒŒμΌμ„ μ½μ–΄μ„œ ν™˜κ²½μ„ 섀정함

예λ₯Ό λ“€μ–΄, JAVA_HOME ν™˜κ²½ λ³€μˆ˜λ₯Ό μ„€μ •ν•˜λ©΄ 터미널을 μ—΄ λ•Œ μžλ™μœΌλ‘œ 적용됨!


μ‚¬μš©λ˜λŠ” 파일 (μ‰˜ μ’…λ₯˜μ— 따라 닀름)

μ‚¬μš© μ‰˜(Shell)μ μš©λ˜λŠ” μ„€μ • 파일
Bash (λ°°μ‹œ)~/.bash_profile
Zsh (μ œνŠΈμ‰˜)~/.zshrc

Intel Mac vs. Apple Silicon Mac

Mac μ’…λ₯˜κΈ°λ³Έ μ‰˜(Shell)μ„€μ • 파일
Intel Mac (κ΅¬ν˜•)Bash (λ°°μ‹œ)~/.bash_profile
Apple Silicon Mac (M1/M2/M3)Zsh (μ œνŠΈμ‰˜)~/.zshrc
  • μ΅œμ‹  Mac(M1/M2/M3)은 기본적으둜 Zsh을 μ‚¬μš©ν•˜λ―€λ‘œ ~/.zshrcλ₯Ό μ„€μ •ν•˜λ©΄ 됨!
  • Intel Macμ—μ„œ μ„€μ •ν•œ ~/.bash_profile은 Apple Silicon Macμ—μ„œλŠ” ν•„μš” μ—†μŒ!

μ„€μ • 파일 μˆ˜μ • 및 적용 방법

πŸ“Œ Apple Silicon Mac(M1/M2/M3)μ—μ„œ ν™˜κ²½ λ³€μˆ˜ μΆ”κ°€ (~/.zshrc)


echo 'export JAVA_HOME=$(/usr/libexec/java_home -v 17)' >> ~/.zshrc
source ~/.zshrc  # μ„€μ • 적용

πŸ“Œ (μ°Έκ³ ) κ΅¬ν˜• Intel Macμ—μ„œ ν™˜κ²½ λ³€μˆ˜ μΆ”κ°€ (~/.bash_profile)


echo 'export JAVA_HOME=$(/usr/libexec/java_home -v 17)' >> ~/.bash_profile
source ~/.bash_profile  # μ„€μ • 적용

μ΅œμ’… μš”μ•½

βœ” μ‰˜(Shell)이 싀행될 λ•Œ ν™˜κ²½ λ³€μˆ˜λ₯Ό μžλ™μœΌλ‘œ λΆˆλŸ¬μ˜€λŠ” μ„€μ • 파일이 profile νŒŒμΌμ΄λ‹€!

βœ” μ‚¬μš©ν•˜λŠ” μ‰˜μ΄ Bashλ©΄ ~/.bash_profile, Zsh이면 ~/.zshrcλ₯Ό μ‚¬μš©ν•œλ‹€!

βœ” Apple Silicon Mac(M1/M2/M3)μ—μ„œλŠ” ~/.zshrcλ₯Ό μ‚¬μš©ν•˜λ©΄ 되고, ~/.bash_profile은 ν•„μš” μ—†λ‹€!

profile
FE 개발 κΏˆν‹€μ΄

0개의 λŒ“κΈ€