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

+27 -6
View File
@@ -30,6 +30,30 @@ error() {
} }
success() { echo "[OK] $*" >&2; } 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"
}
error() {
echo "[ERROR] $*" >&2
exit 1
}
success() { echo "[OK] $*" >&2; }
# ──────────────────────────────────────────── # ────────────────────────────────────────────
# Check for git (required by lazygit) # Check for git (required by lazygit)
# ──────────────────────────────────────────── # ────────────────────────────────────────────
@@ -37,12 +61,9 @@ if ! command -v git &>/dev/null; then
info "git is not installed. Installing git..." info "git is not installed. Installing git..."
case "$(uname -s)" in case "$(uname -s)" in
Darwin) Darwin)
if command -v brew &>/dev/null; then ensure_brew
brew install -y git brew install -y git
success "git installed via Homebrew" success "git installed via Homebrew"
else
error "Homebrew (brew) is required to install git on macOS. Install it from https://brew.sh/"
fi
;; ;;
Linux) Linux)
if command -v apt-get &>/dev/null; then if command -v apt-get &>/dev/null; then
+22 -6
View File
@@ -51,6 +51,25 @@ error() {
} }
success() { echo "[OK] $*" >&2; } 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 # Check required commands
# ──────────────────────────────────────────── # ────────────────────────────────────────────
@@ -63,12 +82,9 @@ if ! command -v npm &>/dev/null; then
info "npm is not installed. Installing Node.js..." info "npm is not installed. Installing Node.js..."
case "$OS" in case "$OS" in
Darwin) Darwin)
if command -v brew &>/dev/null; then ensure_brew
brew install node brew install node
success "Node.js installed via Homebrew" 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
;; ;;
Linux) Linux)
if command -v apt-get &>/dev/null; then if command -v apt-get &>/dev/null; then
+23 -6
View File
@@ -43,6 +43,26 @@ Darwin | Linux) ;;
;; ;;
esac esac
# ────────────────────────────────────────────
# 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)"
# Add brew to PATH for Apple Silicon
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"
}
info "Platform: $OS ($ARCH)" info "Platform: $OS ($ARCH)"
# ──────────────────────────────────────────── # ────────────────────────────────────────────
@@ -56,12 +76,9 @@ if command -v tmux &>/dev/null; then
else else
case "$OS" in case "$OS" in
Darwin) Darwin)
if command -v brew &>/dev/null; then ensure_brew
brew install -y tmux brew install tmux
success "tmux installed via Homebrew" success "tmux installed via Homebrew"
else
error "Homebrew (brew) is required on macOS. Install it from https://brew.sh/"
fi
;; ;;
Linux) Linux)
if command -v apt-get &>/dev/null; then if command -v apt-get &>/dev/null; then