程序員如何優(yōu)雅的使用Mac

安裝iterm2

說明:
mac系統(tǒng)上替代終端的命令行工具

安裝方法:
直接從官網(wǎng)下載安裝即可,下載地址


安裝brew

說明:
Homebrew,是Mac OSX的軟件包管理工具,安裝或者卸載軟件非常方便,類似Linux下的apt-get

安裝方法:

  • 方法一:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • 方法二:
curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1

例子:

brew install wget
brew uninstall wget 

安裝oh my zsh

說明:
Linux/Unix提供了很多種shell,常用的shell有sh、bash、csh,執(zhí)行命令cat /etc/shells可以系統(tǒng)有幾種shell

/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh

zsh就是shell中的一種,但是配置復(fù)雜,于是有大神就開發(fā)了oh my zsh

安裝方法:

  • 方法一:
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  • 方法二:
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

配置:

  1. 設(shè)置zsh為默認(rèn)的shell,chsh -s /bin/zsh
  2. 使用主題(推薦使用agnoster)
    • 下載agnoster主題,下載地址
    • 打開zsh的配置文件,vi ~/.zshrc
    • 修改ZSH_THEME的字段為agnoster,ZSH_THEME="agnoster"
  3. 安裝字體庫
    • 下載字體庫,下載地址
    • cd到文件目錄,執(zhí)行./install.sh
    • 設(shè)置字體,iterm2 -> profiles -> open profiles(或者直接cmd+o) -> edit profiles -> text -> change font,設(shè)置你喜歡的字體和大小即可
  4. 配色(推薦使用Solarized)
    • 下載Solarized,下載地址
    • cd到solarized/iterm2-colors-solarized
    • 雙擊Solarized Dark.itermcolors和Solarized Light.itermcolors,導(dǎo)入iterm2
    • 設(shè)置配色,iterm2 -> profiles -> open profiles(或者直接cmd+o) -> edit profiles -> colors -> color presets -> Solarized Dark
  5. 設(shè)置vim配色
    $ cd solarized
    $ cd vim-colors-solarized/colors
    $ mkdir -p ~/.vim/colors
    $ cp solarized.vim ~/.vim/colors/
    
    $ vi ~/.vimrc
    syntax enable
    set background=dark
    colorscheme solarized
    
  6. 指令高亮
    • 下載zsh-syntax-highlighting,下載地址

    • 移到zsh插件文件中,mv zsh-syntax-highlighting ~/.oh-my-zsh/custom/plugins/

    • 修改配置文件,vi ~/.zshrc,添加如下語句

      plugins=(zsh-syntax-highlighting)
      source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
      
    • 執(zhí)行source ~/.zshrc


iterm2克隆會話(clone-session)

說明:
一般IT公司開發(fā),都需要先登入跳板機(jī),然后登入開發(fā)機(jī)。每次開一個(gè)新窗口時(shí),如果都要輸入密碼,非常麻煩。Windows下用過SecureCRT的人都知道,它只要一次輸入密碼即可。我們使用mac的iterm2時(shí),也可以實(shí)現(xiàn)同樣的功能。

配置:

  1. 修改iterm2配置,iterm2 -> profiles -> open profiles(或者直接cmd+o) -> edit profiles -> general -> reuse previous session's directory

  2. 修改ssh配置文件,vi ~/.ssh/config

    host *
    ControlMaster auto
    ControlPath ~/.ssh/master-%r@%h:%p
    

未完待續(xù)。。。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容