本文作者:guoweiye,腾讯 PCG 开发工程师

很多人都说 Mac 比 Windows 更适合做开发,那关键是要把 Mac 配置好,下面就来和大家分享一下如何从零开始把一台新 Mackbook 打造成开发利器。

一、基本设置

  1. 升级操作系统(macOS Mojave 10.14.3)

  2. 关闭菜单栏效果, 减少资源占用和产生的热量

系统偏好设置/辅助功能/显示, 勾选 (减弱动态效果、减少透明度)

  1. 配置睡眠保护

系统偏好设置/安全性与隐私/通用, 勾选(进入睡眠或开始保护程序 立即 要求输入密码)

  1. 配置触发角

系统偏好设置/屏幕保护程序/触发角, 选择(右上桌面,左下启动台,右下启动屏幕保护)

二、工具安装

  1. Xcode Command Line Tools

xcode-select --install

  1. Homebrew

# 这里必须设置 代理地址,否则无法安装brew/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install
  1. brew cask list

  2. brew 安装常用工具

  1. brew cask 安装常用工具

  1. 其他工具

  • 下载工具 motrix

  • 截图工具 jietu

  • 看图工具 jietu

  • brew cask tools list

  • 快速查看工具 Nicer plugins for QuickLook

    brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlimagesize webpquicklook suspicious-package quicklookase qlvideo

  • 微软的字体 Consolas

      wget -qO- https://raw.githubusercontent.com/yakumioto/YaHei-Consolas-Hybrid-1.12/master/install.sh && sudo install.sh
  • szrz插件

  • graphviz 所用语言 dot 验证

    dot -h

三、其他配置

  1. 设置 iterm2

  • iterm2 配色官网

    iterm2 > preference > profiles > colors > Color Presets > solarized dark

2.安装 zsh,oh-my-zsh

# 安装 zsh 及 补全brew install zsh zsh-completions

# 安装 oh-my-zshcurl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh

# 编辑 /etc/shellssudo vim /etc/shells

# 添加 zsh/usr/local/bin/zsh

# 修改默认shellsudo chsh -s /usr/local/bin/zsh

# 将环境变量移到~/.env.shvim ~/.zshrc

# 设置主题ZSH_THEME=pygmalion# 设置插件plugins=(git colored-man colorize github jira vagrant virtualenv pip python brew osx zsh-syntax-highlighting)

# ls 配色生效unset LSCOLORSexport CLICOLOR=1export CLICOLOR_FORCE=1

# 生效source ~/.env.sh

3. solarized 主题配色

# clone 之git clone https://github.com/altercation/solarized

# 配置 vim 主题cd solarized/vim-colors-solarized/mkdir -p ~/.vim/colorscp colors/solarized.vim ~/.vim/colors/

# 配置 vimvim ~/.vimrcsyntax onset background=darkcolorscheme solarizedset backspace=2

4. vscode 配置命令行中打开

Open the Command Palette ( ⇧⌘ P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.

  1. vscode 插件安装

  • Chinese language pack(中文语言包)

  • markdownlint(markdown格式检查器)

  • atom one dark theme(ATOM 风格主题)

  • one dark pro(主题)

  • material theme(主题)

  • vscode-icons(图标)

  • python(vscode python扩展包)

  • go(go 扩展包)

6. vscode shell 选择,zsh

首选项/设置, 搜索 terminal.integrated.shell.osx ,设置值为 /usr/local/bin/zsh

  1. vscode python 解释器选择

⇧⌘P, 搜索 select interpreter ,选择一个 env-3.6.8

  1. vscode python lint 安装,选择 pylint 即可

  2. vscode python 自动格式化

"python.formatting.provider": "black"

  1. python 开发工具

  • jetbrains 全家桶

  • pycharm Community

  • idea Community

四、 python 环境

  1. pyenv 安装

    # 安装 pyenv 参考, http://einverne.github.io/post/2017/04/pyenv.htmlcurl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
    
    # 添加环境变量vim ~/.zshrcexport PATH="/.pyenv/bin:<annotation encoding="application style="font-size: inherit;line-height: 1.75;color: rgb(80, 161, 79);overflow-wrap: inherit !important;word-break: inherit !important;" span="" class="hljs-string" encoding=""application"><span class="katex-html" aria-hidden="true" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="strut" style="height:1em;vertical-align:-0.25em;" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="mord mathit" style="margin-right:0.08125em;" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">H<span class="mord mathit" style="margin-right:0.02778em;" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">O<span class="mord mathit" style="margin-right:0.10903em;" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">M<span class="mord mathit" style="margin-right:0.05764em;" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">E/.<span class="mord mathit" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">p<span class="mord mathit" style="margin-right:0.03588em;" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">y<span class="mord mathit" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">e<span class="mord mathit" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">n<span class="mord mathit" style="margin-right:0.03588em;" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">v/<span class="mord mathit" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">b<span class="mord mathit" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">i<span class="mord mathit" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">n<span class="mspace" style="margin-right:0.2777777777777778em;" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">:PATH"eval "¨E45E)"eval"(pyenv init -)"eval "</span class="mspace" style="margin-right:0.2777777777777778em;"></span class="mord mathit"></span class="mord mathit"></span class="mord mathit"></span class="mord mathit" style="margin-right:0.03588em;"></span class="mord mathit"></span class="mord mathit"></span class="mord mathit" style="margin-right:0.03588em;"></span class="mord mathit"></span class="mord mathit" style="margin-right:0.05764em;"></span class="mord mathit" style="margin-right:0.10903em;"></span class="mord mathit" style="margin-right:0.02778em;"></span class="mord mathit" style="margin-right:0.08125em;"></span class="strut" style="height:1em;vertical-align:-0.25em;"></span class="katex-html" aria-hidden="true"></annotation encoding="application><span class="katex-html" aria-hidden="true" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="strut" style="height:1em;vertical-align:-0.25em;" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">(<span class="mord mathit" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">p<span class="mord mathit" style="margin-right:0.03588em;" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">y<span class="mord mathit" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">e<span class="mord mathit" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">n<span class="mord mathit" style="margin-right:0.03588em;" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">v<span class="mord mathit" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">i<span class="mord mathit" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">n<span class="mord mathit" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">i<span class="mord mathit" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">t¨<span class="mord mathit" style="margin-right:0.05764em;" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">E45<span class="mord mathit" style="margin-right:0.05764em;" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">E)"<span class="mord mathit" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">e<span class="mord mathit" style="margin-right:0.03588em;" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">v<span class="mord mathit" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">a<span class="mord mathit" style="margin-right:0.01968em;" style="font-size: inherit;color: inherit;line-height: 1.75;overflow-wrap: inherit !important;word-break: inherit !important;">l"(pyenv virtualenv-init -)"
    
    # 常用命令
    
    # 查看可用版本pyenv install -l
    
    # 安装 python2 最新版本pyenv install 2.7.16
    
    # 安装报错 ERROR: The Python zlib extension was not compiled. Missing the zlib? https://github.com/pyenv/pyenv/wiki/common-build-problemsbrew install readline xz
    
    # When running Mojave or higher (10.14+) you will also need to install the additional SDK headers by downloading them from Apple Developers. You can also check under /Library/Developer/CommandLineTools/Packages/ as some versions of Mac OS will have the pkg locally.sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
    
    # 安装 python3 最新版本 3.7.2# 报错 ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?# https://github.com/pyenv/pyenv/issues/1184#issuecomment-409320318CONFIGURE_OPTS="--with-openssl=$(brew --prefix openssl)" pyenv install 3.7.2
    
    # 安装 python 3.6 ,tf 支持的最新版本pyenv install 3.6.8
    
    # 安装 python2 最新版 2.7.16pyenv install 2.7.16
    
    # 创建虚拟环境pyenv virtualenv 3.6.4 env-3.6.4
    
    # 激活虚拟环境pyenv activate env-3.6.4
    
    # 退出虚拟环境pyenv deactivate</span class="mord mathit" style="margin-right:0.01968em;"></span class="mord mathit"></span class="mord mathit" style="margin-right:0.03588em;"></span class="mord mathit"></span class="mord mathit" style="margin-right:0.05764em;"></span class="mord mathit" style="margin-right:0.05764em;"></span class="mord mathit"></span class="mord mathit"></span class="mord mathit"></span class="mord mathit"></span class="mord mathit" style="margin-right:0.03588em;"></span class="mord mathit"></span class="mord mathit"></span class="mord mathit" style="margin-right:0.03588em;"></span class="mord mathit"></span class="strut" style="height:1em;vertical-align:-0.25em;"></span class="katex-html" aria-hidden="true">
  2. 创建 pip 配置文件

    # 创建 pip 配置目录mkdir ~/.pip
    
    # 编辑配置vim ~/.pip/.pip.conf
    
    # 添加以下内容[list]format=columns[global]download_cache = ~/.cache/pipindex-url = http://mirrors.aliyun.com/pypi/simple/[install]trusted-host=mirrors.aliyun.com

五、数据库安装

  1. 数据库安装

  2. 通过 brew service 管理此类后台任务

    brew tap homebrew/servicesbrew services start mysqlbrew services restart mysqlbrew services listbrew services cleanup
    
    # 通过界面管理后台服务brew cask install launchrocket

六、参考

  1. 主要参考

  • awesome-mac

  • open-source-mac-os-apps

  • Best-App

  • mac-setup

  • mac-dev-setup

  • dev-setup

还在用 Win?教你从零把 Mac 打造成开发利器相关推荐

  1. Mac 更适合做开发?从零把 Mac 打造成开发利器

    点击我爱计算机视觉标星,更快获取CVML新技术 本文作者:guoweiye,腾讯 PCG 开发工程师 很多人都说 Mac 比 Windows 更适合做开发,那关键是要把 Mac 配置好,下面就来和大家 ...

  2. 教你如何零基础学习视频剪辑,干货满满

    5000字长文预警!!! 软件推荐+专业术语解析+视频素材网站分享 教你如何零基础学习视频剪辑,干货满满 那么在推荐视频剪辑软件之前,首先你应该明确自己的制作视频的目的. 是想成为专业剪辑师,从事专业 ...

  3. 教你从零做起谷歌Adsense。开户,过审核,过pin码达到稳定收益

    Google Adsense,也就是谷歌广告联盟,最受欢迎的广告联盟之一.它的高单价.支付稳定等天然优势让国内众多的大大小小广告联盟黯然失色.受到全世界的欢迎和喜爱. Google Adsense也不 ...

  4. 教你从零写vue穿梭框

    教你从零写vue穿梭框 1. 前言 2. 制作选择组件(select-input) 2. 制作vue穿梭框组件(table-transfer) 4. 将选择组件和穿梭框组件结合使用 4.1 点击选择组 ...

  5. 【J2ME 2D 游戏开发系列】◣HIMI游戏开发启蒙教程◢JAVA零基础学习J2ME游戏开发全过程!...

    本站文章均为 李华明Himi 原创,转载务必在明显处注明:  转载自[黑米GameDev街区] 原文链接: http://www.himigame.com/j2me-2/774.html Himi从写 ...

  6. 从零搭建一个 Spring Boot 开发环境!Spring Boot+Mybatis+Swagger2 环境搭建

    从零搭建一个 Spring Boot 开发环境!Spring Boot+Mybatis+Swagger2 环境搭建 本文简介 为什么使用Spring Boot 搭建怎样一个环境 开发环境 导入快速启动 ...

  7. 零基础转行Web前端开发自学靠谱吗?菜鸟学习前端的方法分享

    Web 前端开发行业长期处于供不应求的状态,薪资待遇也随之水涨船高,因此吸引了不少零基础转业者.那么,可能会有人问了:零基础转行Web 前端开发自学靠谱吗?这个问题没有确切的答案,毕竟每个人的情况都不 ...

  8. 我33岁,从国企主管零基础转型大数据开发,年薪涨了20W

    一. 转行背景 1.温水煮青蛙的八年 男,1989年生,211理工科.家庭条件一般,从小没啥追求,人比较怂.2013年本科毕业留在上学的二线城市,到2021年,在一家国企里干了8年,分别干过培训,行政 ...

  9. 零预算?如何免费开发自己的管理系统?

    编者按:自己开发管理软件成本太高,所以只能退而求其次使用市面上的成品系统?先别草率定论,其实开发管理软件没有你想得那么困难,零预算,也可以开发自己的个性化系统! 一.为什么要开发自己的管理系统? 在信 ...

最新文章

  1. 我酸了~腾讯员工平均月薪 7.6 万 | 每日趣闻
  2. android 启动其它apk
  3. VS2010安装HTML5插件
  4. 在对比了 GitHub 5000 个 Python 项目之后,我们精选出了这 36 个!
  5. java web服务器tomcat介绍【转载】
  6. Java 7和Java 8之间的细微自动关闭合同更改
  7. [转载] Python3 String模块ascii_letters和digits
  8. 服务器位置设置,服务器部署位置
  9. g4600黑苹果efi_在黑苹果系统下挂载和打开EFI(ESP)分区
  10. 网络计算机显示器接口,电脑显示器常见的4种接口:VGA、DVI、HDMI、DP接口
  11. 线性二次型调节器(LQR)原理详解
  12. 全国计算机三级嵌入式 - 题库 - 真题(含答案) - 未来教育 - 视频讲解 - 资料获取
  13. 微信小程序上传silk格式录音并转码为mp3
  14. 【winui3】轻量笔记本应用
  15. 微信小程序获取WIFI列表可手动输入密码连接
  16. 使用GRUB2制作多重系统引导程序
  17. oracle同步数据adg_[adg数据库同步机制]三分钟读懂Oracle数据库容灾架之DataGuard
  18. 使用Node.js创建命令行工具
  19. 位运算——强大得令人害怕
  20. NLP:Word Embedding词嵌入/word2vec词向量思想方法(一种主流的分布式表示)的简介、使用方法、案例应用之详细攻略

热门文章

  1. 这几个在搞低功耗广域网的,才是物联网的黑马
  2. AM335X的USB otg网卡(RNDIS /Ethernet Gadget)调试
  3. zabbix配置发送报警邮件
  4. Openfiler的安装和配置
  5. 使用CoreText实现图文混排
  6. 恒安标准人寿:念好小公司数据保护生意经
  7. 任意元素的focus伪类
  8. BackTrack 5 发布了 ---直接下载地址
  9. 去除重复数据的SQL语句
  10. CodeForces - 888G Xor-MST(贪心+字典树+最小生成树)