#!/bin/bash
# 检查是否安装了Xcode Command Line Tools
echo "Checking for Xcode Command Line Tools..."
if ! xcode-select -p &>/dev/null; then
echo "Installing Xcode Command Line Tools..."
xcode-select --install
else
echo "Xcode Command Line Tools already installed."
fi
# 检查是否安装了Homebrew
echo "Checking for Homebrew..."
if ! command -v brew &>/dev/null; then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
else
echo "Homebrew already installed."
fi
# 更新Homebrew
echo "Updating Homebrew..."
brew update
# 定义一个函数来检查应用是否已安装
install_if_not_installed() {
app_name="$1"
install_command="$2"
if brew list --cask "$app_name" &>/dev/null || brew list "$app_name" &>/dev/null; then
echo "$app_name is already installed."
else
echo "Installing $app_name..."
eval "$install_command"
fi
}
# 安装Xcode
install_if_not_installed "xcode" "brew install --cask xcode"
# 安装CocoaPods
install_if_not_installed "cocoapods" "brew install cocoapods"
# 安装Developer工具包
install_if_not_installed "developer" "brew install --cask developer"
# 安装Visual Studio Code
install_if_not_installed "visual-studio-code" "brew install --cask visual-studio-code"
# 安装微信
install_if_not_installed "wechat" "brew install --cask wechat"
# 安装QQ
install_if_not_installed "qq" "brew install --cask qq"
# 安装网易有道词典
install_if_not_installed "youdaodict" "brew install --cask youdaodict"
# 安装ShadowsocksX-NG
install_if_not_installed "shadowsocksx-ng" "brew install --cask shadowsocksx-ng"
# 安装V2RayX
install_if_not_installed "v2rayx" "brew install --cask v2rayx"
# 安装WPS Office
install_if_not_installed "wps-office" "brew install --cask wps-office"
# 安装Google Chrome
install_if_not_installed "google-chrome" "brew install --cask google-chrome"
# 安装印象笔记(Evernote)
install_if_not_installed "evernote" "brew install --cask evernote"
# 安装百度网盘
install_if_not_installed "baidunetdisk" "brew install --cask baidunetdisk"
# 安装网易云音乐
install_if_not_installed "neteasemusic" "brew install --cask neteasemusic"
# 安装搜狗输入法
install_if_not_installed "sogouinput" "brew install --cask sogouinput"
# 清理Homebrew缓存
echo "Cleaning up..."
brew cleanup
echo "All applications installed successfully!"
vi setup_dev_environment.sh
chmod +x setup_dev_environment.sh
./setup_dev_environment.sh