-
安装 Homebrew
- 参考
- 准备
- 安装 Homebrew 之前,需要将 Xcode Command Line Tools 安装完成
xcode-select --install
- 安装
# 在 terminal 中复制以下命令,跟随指引,完成 Hombrew 安装 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- 配置
# 将 /usr/local/bin 添加至 $PATH 环境变量中 echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile # Cmd+T 打开一个新的 terminal 标签页,运行以下命令,确保 brew 运行正常 brew doctor
- 使用
- 安装一个包
brew install <package_name>
- 更新 Homebrew 在服务器端上的包目录
brew update
- 查看是否需要更新
brew outdated
- 更新包
brew upgrade <package_name>
- 查看安装过的包列表(包括版本号)
brew list --versions
- 清理旧版本的包缓存
brew cleanup
-
安装 Zsh
- 参考文档
- 安装 Zsh
brew update brew install zsh zsh-completions
- 安装 oh-my-zsh 让 zsh 获得拓展功能和主题
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
- 修改配置
vi ~/.zshrc
ZSH_THEME=pygmalion alias zshconfig="vi ~/.zshrc" alias envconfig="vi ~/Projects/config/env.sh" plugins=(git colored-man colorize github jira vagrant virtualenv pip python brew osx zsh-syntax-highlighting)
vi ~/Projects/config/env.sh
#!/bin/zsh # PATH export PATH="/usr/local/share/python:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" export EDITOR='vi -w' # export PYTHONPATH=$PYTHONPATH # export MANPATH="/usr/local/man:$MANPATH" # Virtual Environment export WORKON_HOME=$HOME/.virtualenvs export PROJECT_HOME=$HOME/Projects source /usr/local/bin/virtualenvwrapper.sh # Owner export USER_NAME=“rongsheng” eval "$(rbenv init -)" # FileSearch function f() { find . -iname "*$1*" ${@:2} } function r() { grep "$1" ${@:2} -R . } #mkdir and cd function mkcd() { mkdir -p "$@" && cd "$_"; } # Aliases alias cppcompile='c++ -std=c++11 -stdlib=libc++'
-
安装 Python3
brew install python3 vim ~/.zshrc alias python="/usr/local/Cellar/python@3.9/3.9.0_1/bin/python3" source ~/.zshrc python --version
-
安装 Mysql
- 参考
- 安装
brew update brew install mysql
- 配置
unset TMPDIR mkdir /usr/local/var mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
- 使用
# 启动 mysql.server start # 登录 mysql -uroot # 关闭 mysql.server stop # 修改密码 mysqladmin -u root password 'new-password'
-
安装 vim
brew install vim
网友评论