MrZhang.me icon indicating copy to clipboard operation
MrZhang.me copied to clipboard

重装系统之后

Open antife-yinyue opened this issue 9 years ago • 13 comments

系统偏好设置

  • 更改电脑名称

    Sharing

  • 允许安装任何来源的 APP

    Security & Privacy --> General

  • 设置快捷键

    Keyboard --> Shortcuts

  • 允许 tab 键切换窗口按钮

    Keyboard --> Shortcuts --> Full Keyboard Access

snip20170806_4

编辑 /etc/paths

/usr/local/bin
/usr/local/sbin
/usr/bin
/usr/sbin
/bin
/sbin

通过 App Store 安装 Xcode

安装 Command Line Tools

$ xcode-select --install

安装 Oh My Zsh

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

自定义主题:~/.oh-my-zsh/themes/^_^.zsh-theme

# Symbols:
# ☀ ✹ ☄ ♆ ♀ ♁ ♐ ♇ ♈ ♉ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♣ ⚢ ⚲ ⚳ ⚴ ⚥ ⚤ ⚦ ⚒ ⚑ ⚐ ♺ ♻ ♼ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷
# ✡ ✔ ✖ ✚ ✱ ✤ ✦ ❤ ➜ ➟ ➼ ✂ ✎ ✐ ⨀ ⨁ ⨂ ⨍ ⨎ ⨏ ⨷ ⩚ ⩛ ⩡ ⩱ ⩲ ⩵  ⩶ ⨠
# ⬅ ⬆ ⬇ ⬈ ⬉ ⬊ ⬋ ⬒ ⬓ ⬔ ⬕ ⬖ ⬗ ⬘ ⬙ ⬟  ⬤ 〒 ǀ ǁ ǂ ĭ Ť Ŧ     

ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}git:(%{$fg[magenta]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[cyan]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[cyan]%})"

ZSH_THEME_NVM_PROMPT_PREFIX="%{$fg[cyan]%}node:(%{$fg[magenta]%}"
ZSH_THEME_NVM_PROMPT_SUFFIX="%{$fg[cyan]%})"

PROMPT='
%{$fg_bold[green]%}⬊ %~ %{$reset_color%} $(nvm_prompt_info) $(git_prompt_info)
%{$fg[red]%}❤︎%{$reset_color%} '

配置墙内源

编辑 ~/.zshrc

export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"
export NVM_NODEJS_ORG_MIRROR="https://npm.taobao.org/mirrors/node"
export ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/"
export PHANTOMJS_MIRROR="https://npm.taobao.org/mirrors/phantomjs"

安装 Homebrew

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

安装 git, autojump, httpie, tree, bat, htop

$ brew install git autojump httpie tree bat htop

e.g.

$ tree -L 2 -I node_modules     # 打印目录结构
$ http -h https://baidu.com     # 获取 HTTP 请求的相应头

生成 SSH 公钥

$ ssh-keygen -t rsa

安装 nvm

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash

安装 node.js

$ nvm i 4
$ nvm alias default node

安装 rbenv

$ brew install rbenv ruby-build rbenv-gemset
$ echo 'eval "$(rbenv init -)"' >> ~/.zshrc

安装 Ruby

OS X 10.9+ 自带 Ruby 2.0.0,使用时加 sudo 即可

$ rbenv install -l     # list all available versions
$ rbenv install 2.3.0  # install a Ruby version
$ rbenv global 2.3.0   # set the global version
$ rbenv versions       # list all installed Ruby versions

配置 gem 墙内源

$ gem sources -a http://gems.ruby-china.org -r https://rubygems.org/
$ echo 'gem: --no-document' >> ~/.gemrc

替换掉源之后,执行 gem sources -l,确保只有 http://gems.ruby-china.org

还有个阿里云的源 http://mirrors.aliyun.com/rubygems/ ,哪个速度快就用哪个。

如果你使用 Gemfile 和 Bundle (例如:Rails 项目),你可以用 Bundler 的 Gem 源代码镜像命令

$ bundle config mirror.https://rubygems.org http://gems.ruby-china.org

这样使用 bundle 安装 gems 时,就会以此为准,忽略 Gemfile 里的配置。

安装 MongoDB, MySQL

$ brew install mongodb mysql

设置开机自启动「可选」:

$ mkdir -p ~/Library/LaunchAgents
$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents

~/.zshrc 全貌

zsh-syntax-highlighting

# mirrors
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"
export NVM_NODEJS_ORG_MIRROR="https://npm.taobao.org/mirrors/node"
export ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/"
export PHANTOMJS_MIRROR="https://npm.taobao.org/mirrors/phantomjs"

# zsh
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="^_^"
plugins=(autojump nvm sublime zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh

# ruby
eval "$(rbenv init -)"

# PATH
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
export MAVEN_HOME="/usr/local/Cellar/maven/3.2.5"
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=${PATH}:${JAVA_HOME}/bin:${MAVEN_HOME}/bin
export NODE_PATH=`npm root -g`

# alias
alias mongod="mongod --config /usr/local/etc/mongod.conf"
alias sm=subl
alias xb=xcodebuild
alias lap="ls -lap"
alias gb="git branch"
alias gc="git checkout"
alias mk="make"
alias hh="http -h"
alias x=sofax
alias ti="tnpm ii"
alias tig="tnpm ii -g"
alias tls="tnpm ls -g --depth=0"
alias adb=$ANDROID_HOME/platform-tools/adb
alias tree2="tree -L 2 -I node_modules"
alias tree3="tree -L 3 -I node_modules"
alias tree4="tree -L 4 -I node_modules"

fanqiang() {
  export http_proxy="http://localhost:10086"
  export https_proxy="http://localhost:10086"
  echo "👌"
}

Sublime Text 3

Package Control

BabelConsole APIVelocityLESSSCSS ConvertToUTF8Codecs33BracketHighlighter Terminal

Settings

{
  "default_line_ending": "unix",
  "ensure_newline_at_eof_on_save": true,
  "file_exclude_patterns": [ ".DS_Store", "*.zip" ],
  "folder_exclude_patterns": [ ".git", ".svn" ],
  "font_size": 18,
  "highlight_line": true,
  "highlight_modified_tabs": true,
  "line_padding_top": 5,
  "open_files_in_new_window": false,
  "show_encoding": true,
  "tab_size": 2,
  "translate_tabs_to_spaces": true,
  "trim_automatic_white_space": false,
  "trim_trailing_white_space_on_save": true,
  "word_separators": "./\\()\"':,.;<>~!@#$%^&*|+=[]{}`~?"
}

Key Bindings

[
  // Add folder to project
  { "keys": ["super+shift+o"], "command": "prompt_add_folder" },
  // Match with `ctrl+shift+k`
  { "keys": ["ctrl+shift+d"], "command": "duplicate_line" },
  { "keys": ["alt+up", "alt+1"], "command": "fold_by_level", "args": {"level": 1} },
  { "keys": ["alt+up", "alt+2"], "command": "fold_by_level", "args": {"level": 2} },
  { "keys": ["alt+up", "alt+3"], "command": "fold_by_level", "args": {"level": 3} },
  { "keys": ["alt+up", "alt+4"], "command": "fold_by_level", "args": {"level": 4} },
  { "keys": ["alt+up", "alt+5"], "command": "fold_by_level", "args": {"level": 5} },
  { "keys": ["alt+up", "alt+6"], "command": "fold_by_level", "args": {"level": 6} },
  { "keys": ["alt+up", "alt+7"], "command": "fold_by_level", "args": {"level": 7} },
  { "keys": ["alt+up", "alt+8"], "command": "fold_by_level", "args": {"level": 8} },
  { "keys": ["alt+up", "alt+9"], "command": "fold_by_level", "args": {"level": 9} },
  { "keys": ["alt+down"], "command": "unfold_all" },
  { "keys": ["alt+up","alt+up"], "command": "sftp_upload_file" },
  // Go to left bracket
  {
    "keys": ["ctrl+alt+super+up"],
    "command": "bh_key",
    "args": {
      "no_outside_adj": true,
      "lines" : true,
      "plugin": {
        "type": ["__all__"],
        "command": "bh_modules.bracketselect",
        "args": {"select": "left"}
      }
    }
  },
  // Go to right bracket
  {
    "keys": ["ctrl+alt+super+down"],
    "command": "bh_key",
    "args": {
      "no_outside_adj": true,
      "lines": true,
      "plugin": {
        "type": ["__all__"],
        "command": "bh_modules.bracketselect",
        "args": {"select": "right"}
      }
    }
  }
]

antife-yinyue avatar Mar 31 '15 13:03 antife-yinyue

my zsh不必要 这种属于强制价值观输出

sometimes(many times maybe) we just need a tool, not a tool factory

robertlyc avatar Mar 31 '15 14:03 robertlyc

这本来就是写给我自己看的啊

antife-yinyue avatar Mar 31 '15 15:03 antife-yinyue

大仙, 为什么你的博客现在直接跳转到这边来了

Andrew-liu avatar Apr 09 '15 07:04 Andrew-liu

为了躲霾

antife-yinyue avatar Apr 09 '15 07:04 antife-yinyue

:100:

fengmk2 avatar Sep 22 '15 10:09 fengmk2

很有帮助,谢谢。

wayne5a avatar Nov 30 '15 01:11 wayne5a

@wenming1990 不客气~

antife-yinyue avatar Nov 30 '15 14:11 antife-yinyue

中科大的 homebrew bottles 源,绝对良心啊

antife-yinyue avatar Mar 11 '16 16:03 antife-yinyue

dotfiles 更嗨皮 https://dotfiles.github.io/

medifle avatar Mar 24 '16 12:03 medifle

👍

genffy avatar Jul 13 '16 06:07 genffy

:+1:

xudafeng avatar Jul 13 '16 15:07 xudafeng

👍

blog-lyn avatar Apr 11 '17 06:04 blog-lyn

这是什么,貌似很牛逼。

limin13215 avatar Apr 19 '17 14:04 limin13215