0%

配置新Mac

前言

每次换电脑的时候都要装一大堆的环境、软件什么的,遇到问题还要去搜,这次决定记录一下,为以后省点事。(第一台iMac,开心~)

环境

  • SSH key

    1
    2
    ssh-keygen -t rsa -C "xx@xxx.com"
    cat ~/.ssh/id_rsa.pub
  • git

    1
    2
    git config --global user.email "you@example.com"
    git config --global user.name "Your Name"
  • Homebrew

    这个不用说了吧,利器。。。

  • proxychains-ng

    1
    2
    brew install proxychains-ng
    vi /etc/proxychains.conf

    注释掉 socks4, 添加 socks5 127.0.0.1 1080
    使用 proxychains4 balabala...

  • node(npm)

    1
    brew install node
  • iTerm2/zsh(Oh My Zsh)

    • 插件autojump开启

      vim ~/.zshrc

      plugins=(git autojump)

  • aria2

    1
    2
    3
    4
    5
    brew install aria2
    cd ~
    mkdir .aria2
    cd .aria2
    touch aria2.conf

    编辑 aria2.conf,修改下载路径(来源:雪月秋水

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    # 用户名
    # rpc-user=user
    # 密码
    # rpc-passwd=passwd
    # 上面的认证方式不建议使用,建议使用下面的token方式
    # 设置加密的密钥
    # rpc-secret=token
    # 允许rpc
    enable-rpc=true

    # 允许所有来源, web界面跨域权限需要
    rpc-allow-origin-all=true

    # 允许外部访问,false的话只监听本地端口
    rpc-listen-all=true

    # RPC端口, 仅当默认端口被占用时修改
    # rpc-listen-port=6800

    # 最大同时下载数(任务数), 路由建议值: 3
    max-concurrent-downloads=5

    # 断点续传
    continue=true

    # 同服务器连接数
    max-connection-per-server=5

    # 最小文件分片大小, 下载线程数上限取决于能分出多少片, 对于小文件重要
    min-split-size=10M

    # 单文件最大线程数, 路由建议值: 5
    split=10

    # 下载速度限制
    max-overall-download-limit=0

    # 单文件速度限制
    max-download-limit=0

    # 上传速度限制
    max-overall-upload-limit=0

    # 单文件速度限制
    max-upload-limit=0

    # 断开速度过慢的连接
    # lowest-speed-limit=0

    # 验证用,需要1.16.1之后的release版本
    # referer=*

    # 文件保存路径, 默认为当前启动位置
    dir=/Users/xxx/Downloads

    # 文件缓存, 使用内置的文件缓存, 如果你不相信Linux内核文件缓存和磁盘内置缓存时使用, 需要1.16及以上版本
    # disk-cache=0
    # 另一种Linux文件缓存方式, 使用前确保您使用的内核支持此选项, 需要1.15及以上版本(?)
    # enable-mmap=true

    # 文件预分配, 能有效降低文件碎片, 提高磁盘性能. 缺点是预分配时间较长
    # 所需时间 none < falloc ? trunc « prealloc, falloc和trunc需要文件系统和内核支持
    file-allocation=prealloc

    开启 RPC: aria2c --conf-path="/Users/xxxxxx/.aria2/aria2.conf" -D
    Chrome 开发者模式、安装插件、Aria2 GUI。

软件

安装Anywhere的APP sudo spctl --master-disable

  • Shadowsocks

    IKEv2 安装 cer

  • Little Snitch

  • Google Chrome

  • Xcode

  • Alfred

  • Go2Shell

  • 有道词典

  • Dropbox

    使用ss时需要设置Proxy:

    • Proxy type: SOCKS5
    • Server: 1086(根据Local Socks5 Listen Port)
  • Typora

  • LICEcap

  • Spark

  • BetterZip

  • Office

  • Charles

  • Sublime Text

  • Proxifier

  • Paintbrush

  • Dr. Cleaner

脚本

创建init.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Homebrew
if hash brew 2>/dev/null; then
echo "brew exists"
else
echo "install brew"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi

# npm
if hash npm 2>/dev/null; then
echo "npm exists"
else
echo "install npm"
brew install node
fi