Mac 系统重装

  1. App Store上下载系统
  2. 格式化U盘,命名 MacOsInstall
  3. 终端运行下面代码, 制作u盘安装盘
# 需先根据系统版本先替换代码中的系统名, 以下以Mac Os 10.12举列
sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/MacOsInstall --applicationpath /Applications/Install\ macOS\ Sierra.app

翻墙

  1. 下载 Shadowsocket https://github.com/shadowsocks/ShadowsocksX-NG/releases/
  2. 搭建翻墙服务器, 可使用“搬瓦工” https://bwh8.net/

终端美化

  1. 使用 iterm2 代替 Terminal, item2站点: https://www.iterm2.com
  2. 安装Mac包管理器:HomeBrew, 站点:https://brew.sh
# HomeBrew 安装命令
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. 使用 zsh 代替 bash, 只需下载安装oh-my-zsh即可, 站点:https://ohmyz.sh
 # oh-my-zsh 安装命令
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  1. 安装 Fire Code编程字体,下载后安装ttf文件夹中的字体 https://github.com/tonsky/FiraCode
  2. 安装命令行提示: brew install zsh-autosuggestions, 安装完添加 source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh 到 .zhrc 文件中, 执行 source .zshrc
  3. 生成本机的ssh ssh-keygen -t rsa -b 4096 -C "zhoujiping@zhoujiping.com"
  4. 个人主目录下新建文件.aliases, 可添加别名到这里,如: alias sshzjp='ssh www@120.55.45.224', 然后echo 'source ~/.aliases' >> ~/.zshrc

Sublime编辑器安装和配置

  1. 下载sublime text 3 http://www.sublimetext.com (brew 安装太慢)
  2. 建立 subl 软链 sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
  3. 安装Sublime包管理器 Package Control:快捷键 control + \` , 在打开的命令行中输入 import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
    4.安装Material Theme主题: 快捷键 command + shift + p, 打开Package Control,输入install,选择Package Control:Install Package回车,在跳出的命令行输入选择Material Theme安装
  4. command + , 打开配置页配置

    {
    "always_show_minimap_viewport": false,
    "color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
    "font_face": "Fira Code",
    "font_size": 15,
    "ignored_packages":
    [
    "Vintage"
    ],
    "line_padding_bottom": 4,
    "line_padding_top": 4,
    "tab_size": 4,
    "theme": "Material-Theme.sublime-theme",
    "translate_tabs_to_spaces": true
    }
  5. 安装 AdvanceNewFile 插件,安装完后打开AdvanceNewFile的setting-user配置文件, 输入{ "rename_default": "<filepath>", } 以显示全路径.

  6. 构建自己的代码块, Tools->Developer->New Snippet, 输入以下的代码,保存,打开的窗口建立个snippets文件夹,保存的文件命名为PHP Method.sublime-snippet, 后缀名必须是.sublime-snippet`

    <snippet>
    <content><![CDATA[
    public function ${1}()
    {
    ${2}
    }
    ]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>met</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.php</scope>
    </snippet>
  7. 安装 EditorConfig, 保证代码风格的一致性

PHP 虚拟开发环境 Homestead

  1. 安装VirtualBox brew cask install virtualbox, 推荐直接下载安装 https://www.virtualbox.org/,速度快。
  2. 安装 Vagrant,一个用来管理虚拟机的工具, brew cask install vagrant
  3. 安装 php 包管理器 composer, brew install composer ,可使用中国镜像加速

    # 全局配置
    composer config -g repo.packagist composer https://packagist.laravel-china.org
    # 当前工程下使用
    composer config repo.packagist composer https://packagist.laravel-china.org
    # 取消镜像
    composer config -g --unset repos.packagist
  4. 下载 Homestead Box, http://download.fsdhub.com/lc-homestead-6.1.1-2018090400.zip 下载后解压 lc-homestead-6.1.1-2018090400.zip,进入文件夹,运行 vagrant box add metadata.json 命令导入homestead.

  5. 下载 Homestead 管理脚本

    cd
    git clone https://git.coding.net/summerblue/homestead.git Homestead
    cd ~/Homestead
    git checkout v7.8.0
    bash init.sh
  6. 配置 Homestead.yaml 配置文件

    # 同步mac的公钥和私钥到虚拟机
    keys:
    - ~/.ssh/id_rsa
    - ~/.ssh/id_rsa.pub

    # 共享文件
    folders:
    - map: ~/Sites
    to: /home/vagrant/Sites

    # 站点配置, 需在/etc/hosts 中添加 192.168.10.10 zhoujiping.test
    sites:
    - map: zhoujiping.test
    to: /home/vagrant/Sites/zjp_blog

    # 数据库
    # databases:
    - homestead
    - zjp_blog
  7. 虚拟机命令添加到 .aliases 中

    alias vup='~/Homestead && vagrant up'
    alias vh='~/Homestead && vagrant halt'
    alias vssh='~/Homestead && vagrant ssh'
    alias vp='~/Homestead && vagrant provision'