##Homebrew
- 简介:
Homebrew是一个包管理器,类似于Linux上的yum/apt,用于在Mac上安装一些OS X没有的UNIX工具(比如unix/linux 下的wget)。 - 安装步骤:
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
安装完毕后检测下,在终端运行命令:
brew doctor
如果网络问题,需要走代理,配置如下:
vi ~/.zshrc
alias proxy=‘export all_proxy=socks5://127.0.0.1:1086’
alias unproxy=‘unset all_proxy’
source ~/.zshrc
- 使用:
安装软件:brew install <soft_name>
更新 Homebrew 的源: brew update
更新包:brew upgrade <package_name>
查看安装过的软件列表:brew list --versions - 常用软件安装:
brew install wget htop mtr
mtr运行报错:
mtr: unable to get raw sockets.
解决:
sudo chown root /usr/local/sbin/mtr
sudo chmod u+s /usr/local/sbin/mtr
##Homebrew Cask
- 简介:
Homebrew Cask可以优雅、简单、快速的安装和管理 OS X 图形界面程序,比如 Google Chrome 和 Dropbox。 - 安装步骤:
brew tap caskroom/cask // 添加 Github 上的 caskroom/cask 库
brew install brew-cask // 安装 brew-cask - 使用:
搜索:brew cask search
安装:brew cask install <soft_name> - 常用软件安装:
文件预览插件:可以让 Mac 上的文件预览更有效,比如语法高亮、markdown 渲染、json 预览等等。
brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql webp-quicklook suspicious-package
实用工具:
brew cask install svnx alfred appcleaner cheatsheet dropbox google-chrome sublime-text mou textmate
##go2shell
- 安装Go2Shell:brew cask install go2shell
- 使用说明:按着command 将go2shell拖拽到finder工具栏
- 使用:在finder进到对应目录下,点击finder工具栏上的go2shell图标即可快速用终端打开当前的目录,对于终端控很方便(除此之外,在mac下也可以在命令行下输入cd空格 然后将finder的目录拖拽到终端下即可识别文件路径,回车即可进入对应的目录)
- 修改Go2Shell的打开终端:
open -a Go2Shell --args config
##Item+zsh:
###item:
- 安装:brew cask install iterm2
- 自定义设置字体或主题,我使用的主题是solarized
###zsh:
- 安装:
brew install zsh - 安装oh my zsh:一个快速这是zsh的工具
自动安装:
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
手动安装:
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
- 安装autojump插件,跳转目录异常牛逼:
brew install autojump
- zsh配置:
#编辑用户家目录下的.zshrc文件,这个是zsh的配置文件:
vim .zshrc
#在vim中跳转到最后位置,追加自定义的快捷键,下面是我常用的:
alias cls='clear'
alias ll='ls -l'
alias la='ls -a'
alias rm='rm -i'
alias vi='vim'
alias grep= "grep --color=auto"
alias -s html=mate #在命令行直接输入后缀为html的文件,会在TextMate中打开
alias -s rb=mate # 在命令行直接输入 ruby 文件,会在 TextMate 中打开
alias -s py=vi # 在命令行直接输入 python 文件,会用 vim 中打开,以下类似
alias -s js=vi
alias -s c=vi
alias -s txt=vi
alias -s gz='tar -xzvf'
alias -s tgz='tar -xzvf'
alias -s zip='unzip'
#alias -s bz2='tar -xjvf'
alias p='ping'
alias s='ssh -l root'
# 设置zsh的主题:
vim ~/.oh-my-zsh/themes/robbyrussell.zsh-theme`
#注释PROMPT一行,添加如下一行:
PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%d %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}>'
#解释:把 c 改为 d,c 表示当前目录,d 表示绝对路径。
vim 配置
vim .zshrc
[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh
#vim 配置:
vim ~/.vimrc
#设置语法高亮
syntax on
#--------------基本设置--------------
# 显示行号
set number
set showmatch
#设置光标位置
set ruler
# 将输入的命令显示出来,便于查看当前输入的信息
set showcmd
# 取消底部状态栏显示。1为关闭,2为开启。
set laststatus=2
# 设置魔术匹配控制,可以通过:h magic查看更详细的帮助信息
set magic
# 设置vim存储的历史命令记录的条数
set history=100
# 下划线高亮显示光标所在行
set cursorline
# 插入右括号时会短暂地跳转到匹配的左括号
set showmatch
# 不对匹配的括号进行高亮显示
let loaded_matchparen=1
# 在按退格键时,如果前面有4个空格,则会统一清除
set softtabstop=4
# 设置Insert模式和Normal模式下Left和Right箭头键左右移动可以超出当前行
set whichwrap=b,s,<,>,[,]
# 设置颜色方案
colorscheme murphy
#colorscheme peachpuff
#colorscheme 1desert
#--------------搜索设置---------------
#打开搜索高亮
set hlsearch
#搜索忽略大小写
set ignorecase
#--------------自定义设置------------
# 定位到上次打开的位置
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif