brew 설치
This commit is contained in:
1 parent
fc8faeafa5
commit
83e4be78ac
3 files changed
+72
-18
No files matched your search
+27
-6
@@ -30,6 +30,30 @@ 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"
|
||||
}
|
||||
error() {
|
||||
echo "[ERROR] $*" >&2
|
||||
exit 1
|
||||
}
|
||||
success() { echo "[OK] $*" >&2; }
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# Check for git (required by lazygit)
|
||||
# ────────────────────────────────────────────
|
||||
@@ -37,12 +61,9 @@ if ! command -v git &>/dev/null; then
|
||||
info "git is not installed. Installing git..."
|
||||
case "$(uname -s)" in
|
||||
Darwin)
|
||||
if command -v brew &>/dev/null; then
|
||||
brew install -y git
|
||||
success "git installed via Homebrew"
|
||||
else
|
||||
error "Homebrew (brew) is required to install git on macOS. Install it from https://brew.sh/"
|
||||
fi
|
||||
ensure_brew
|
||||
brew install -y git
|
||||
success "git installed via Homebrew"
|
||||
;;
|
||||
Linux)
|
||||
if command -v apt-get &>/dev/null; then
|
||||
|
||||
+22
-6
@@ -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
|
||||
|
||||
+23
-6
@@ -43,6 +43,26 @@ Darwin | Linux) ;;
|
||||
;;
|
||||
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)"
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
@@ -56,12 +76,9 @@ if command -v tmux &>/dev/null; then
|
||||
else
|
||||
case "$OS" in
|
||||
Darwin)
|
||||
if command -v brew &>/dev/null; then
|
||||
brew install -y tmux
|
||||
success "tmux installed via Homebrew"
|
||||
else
|
||||
error "Homebrew (brew) is required on macOS. Install it from https://brew.sh/"
|
||||
fi
|
||||
ensure_brew
|
||||
brew install tmux
|
||||
success "tmux installed via Homebrew"
|
||||
;;
|
||||
Linux)
|
||||
if command -v apt-get &>/dev/null; then
|
||||
|
||||
Reference in new issue
Block a user