欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Mac 开发环境配置

程序员文章站 2024-02-19 18:03:04
...

起点

macOS 10.13.6默认
没有git、没有pip
有python版本为2.7,没有3.0版本,
有xcode-select、xcodebuild命令

xcode-select --install

macOS Sierra 允许“任何来源”选项,运行第三方应用

sudo spctl --master-disable

Mac系统如何显示隐藏文件

defaults write com.apple.finder AppleShowAllFiles -bool true;
KillAll Finder

oh-my-zsh安装

安装
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

卸载: 
uninstall_oh_my_zsh

添加2个额外插件:

zsh-autosuggestions:
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
brew install zsh-syntax-highlighting

编辑.zshr文件:
plugins=(
  git
  zsh-autosuggestions
  zsh-syntax-highlighting
)

HomeBrew安装

http://brew.sh/index_zh-cn.html
formulae: (package descriptions)
taps: (repositories containing formulae)

安装
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

卸载: 
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

brew 不自动更新:写入.zshrc文件中:
export HOMEBREW_NO_AUTO_UPDATE=true

安装列表

brew ansible mas docker chisel mysql mongodb sqlite redis

chisel安装路径:/usr/local/Cellar/chisel/
.lldbinit文件中加入:

command script import /usr/local/opt/chisel/libexec/fblldb.py

更换brew源,提升安装速度

替换brew.git:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git 

重置brew.git:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git

重置homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
生成Brewfile文件
brew bundle dump

Brewfile文件:

tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core", "https://mirrors.ustc.edu.cn/homebrew-core.git"
tap "homebrew/services"
brew "tree"
brew "wget"
cask "fastlane"
cask "sublime-text"
mas "iPic", id: 1101244278
mas "Maipo", id: 789066512
mas "Reeder", id: 880001334

注意:mas "xxx", id: yyy 需要先安装mas

Brewfile文件的配置安装文件

# brew bundle [install] [-v|--verbose] [--no-upgrade] [--file=path|--global]:
brew bundle

Git自动补全

cd ~
curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash

添加下面几行到你的 ~/.bash_profile 文件中:
if [ -f ~/.git-completion.bash ]; then
    . ~/.git-completion.bash
fi

CocoaPods安装

https://cocoapods.org/

sudo gem install cocoapods