Skip to content

Instantly share code, notes, and snippets.

@lovepocky
Last active September 5, 2020 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lovepocky/a87a41d0517d031489f5c782f2d49a74 to your computer and use it in GitHub Desktop.
Save lovepocky/a87a41d0517d031489f5c782f2d49a74 to your computer and use it in GitHub Desktop.
安装mac开发环境
# custom config file for https://github.com/geerlingguy/mac-dev-playbook
---
downloads: ~/.ansible-downloads/
configure_dotfiles: yes
configure_sudoers: no
configure_terminal: no
configure_osx: yes
# https://github.com/geerlingguy/dotfiles.git
dotfiles_repo: https://github.com/lovepocky/dotfiles.git
dotfiles_repo_accept_hostkey: yes
dotfiles_repo_local_destination: ~/Sync/data/dotfiles
dotfiles_files:
- .zshrc
# * git
- .gitignore_global
- .gitconfig
# * python
- .pip
- .pydistutils.cfg
# * node
- .npmrc
# * others
# - .inputrc
# - .osx
# - .vimrc
- .macos
homebrew_installed_packages:
# * misc
- wget
- proxychains-ng
- docker-credential-helper
- fzf
- htop
- telnet
- tree
- unzip
- zsh-autosuggestions
# * python
- readline
- openssl
- pyenv
# * nodejs
- nodenv
# * optional
# - neovim
# - ncdu
# - supervisor
- tmux
- tldr
- tig
# * others
# - ansible # Installed via Pip.
# - autoconf
# - bash-completion
# - doxygen
# - gettext
# - gifsicle
# - git
# - github/gh/gh
# - go
# - gpg
# - httpie
# - iperf
# - libevent
# - sqlite
# - mcrypt
# - nmap
# - node
# - nvm
# - cowsay
# - pv
# - wrk
homebrew_cask_apps:
# - clashxr # 需要代理
- google-chrome
- docker
- visual-studio-code
# - iterm2 # 可能需要代理
- wechat
- dingtalk
- sogouinput
# * 建议
# - contexts # 应用切换工具 # 网络慢
# - snipaste # 截图工具 # 网络慢
# - keka # 压缩工具
# - free-download-manager # 下载工具
# - proxifier # 需要破解
# * optional
# - go2shell
# - kap # 录屏工具
# - karabiner-elements
# - sip # 取色工具
# - switchkey # 根据应用切换输入法
homebrew_repo: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
# git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git $(brew --repo homebrew/core)
# Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
homebrew_taps:
- name: homebrew/core
url: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
- name: homebrew/cask
url: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
- name: homebrew/cask-fonts
url: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git
- name: homebrew/cask-drivers
url: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-drivers.git
- name: homebrew/cask-versions
# url: https://mirrors.nwafu.edu.cn/homebrew-cask-versions.git
homebrew_cask_appdir: /Applications
# See `geerlingguy.mas` role documentation for usage instructions.
mas_installed_apps: []
mas_email: ""
mas_password: ""
osx_script: "~/.macos"
# Install packages from other package managers.
# Note: You are responsible for making sure the required package managers are
# installed, eg. through homebrew.
composer_packages:
[]
# - name: drush
# state: present # present/absent, default: present
# version: "^8.1" # default: N/A
gem_packages:
[]
# - name: bundler
# state: present # present/absent/latest, default: present
# version: "~> 1.15.1" # default: N/A
npm_packages:
[]
# - name: webpack
# state: present # present/absent/latest, default: present
# version: "^2.6" # default: N/A
pip_packages:
[]
# - name: mkdocs
# state: present # present/absent/latest, default: present
# version: "0.16.3" # default: N/A
# Glob pattern to ansible task files to run after all other tasks are finished.
post_provision_tasks: []
########################################################
# 使用方式:
# cd ~
# curl https://gist.githubusercontent.com/lovepocky/a87a41d0517d031489f5c782f2d49a74/raw/setup_mac.sh | bash -s
# or
# curl https://gist.githubusercontent.com/lovepocky/a87a41d0517d031489f5c782f2d49a74/raw/setup_mac.sh -o setup_mac.sh
# bash setup_mac.sh
# 可选:
# export CURLOPT_FRESH_CONNECT=TRUE
#
# 安装过程:
# 1. mac xcode
# 2. 使用 https://github.com/geerlingguy/mac-dev-playbook 安装所需的工具
#
# 镜像源:
# homebrew:
# - https://developer.aliyun.com/mirror/homebrew
# - https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/
# - https://mirrors.cloud.tencent.com/homebrew/
# - https://nwafu-mirrors-help.readthedocs.io/zh_cn/homebrew-cask-versions.git.html
# Homebrew-bottles:
# - https://mirrors.tuna.tsinghua.edu.cn/help/homebrew-bottles/
#
# over https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/
# TODO pyenv: install version
# TODO nodenv: install version
# TODO proxifier: crack + profile
# TODO istatus menus: crack
# TODO oh-my-zsh
cd
set -e
######################################################## mac 基础工具
xcode-select -p 1>/dev/null
test $? -ne 0 && sudo xcode-select --install
######################################################## 安装ansible
PIP_MIRROR='https://mirrors.aliyun.com/pypi/simple'
PIP_BIN_DIR="$HOME/Library/Python/2.7/bin"
# 安装pip到 /usr/local/bin/pip
[ ! -f "/usr/local/bin/pip" ] && sudo /usr/bin/easy_install -i $PIP_MIRROR pip
# 用系统自带的python2
/usr/local/bin/pip show ansible
test $? -ne 0 && /usr/local/bin/pip install -i $PIP_MIRROR ansible
######################################################## 安装 setup 项目
# clone mac-dev-playbook
if [ ! -d 'mac-dev-playbook' ]; then
git clone https://github.com/geerlingguy/mac-dev-playbook --depth=1
fi
cd mac-dev-playbook
if [ ! -f 'config.yml' ]; then
curl https://gist.githubusercontent.com/lovepocky/a87a41d0517d031489f5c782f2d49a74/raw/config.yml -o config.yml
fi
$PIP_BIN_DIR/ansible-galaxy install -r requirements.yml
######################################################## 安装 软件
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
# mirror for homebrew/core
# if [ ! -d '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core' ]; then
# sudo mkdir -p /usr/local/Homebrew
# sudo chown ${USER}:admin /usr/local/Homebrew
# mkdir -p /usr/local/Homebrew/Library/Taps/homebrew
# git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
# fi
$PIP_BIN_DIR/ansible-playbook main.yml -i inventory -K
echo install complete, please log out and log back to make some settings take effect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment