brew 설치

This commit is contained in:
Jerry Chae committed 2026-05-13 22:18:20 +09:00
1 parent fc8faeafa5
commit 83e4be78ac
3 files changed
+72 -18

No files matched your search

+22 -6
View File
@@ -51,6 +51,25 @@ error() {
}
success() { echo "[OK] $*" >&2; }
# ────────────────────────────────────────────
# Ensure Homebrew is available on macOS
# ────────────────────────────────────────────
ensure_brew() {
if command -v brew &>/dev/null; then
return 0
fi
info "Homebrew is not installed. Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [ -d /opt/homebrew/bin ]; then
export PATH="/opt/homebrew/bin:$PATH"
fi
if [ -d /usr/local/bin ]; then
export PATH="/usr/local/bin:$PATH"
fi
command -v brew &>/dev/null || error "Homebrew installation failed. Install it manually: https://brew.sh/"
success "Homebrew installed"
}
# ────────────────────────────────────────────
# Check required commands
# ────────────────────────────────────────────
@@ -63,12 +82,9 @@ if ! command -v npm &>/dev/null; then
info "npm is not installed. Installing Node.js..."
case "$OS" in
Darwin)
if command -v brew &>/dev/null; then
brew install node
success "Node.js installed via Homebrew"
else
error "Homebrew (brew) is required to install Node.js on macOS. Install it from https://brew.sh/"
fi
ensure_brew
brew install node
success "Node.js installed via Homebrew"
;;
Linux)
if command -v apt-get &>/dev/null; then