IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Linux 程序员的 Mac 安装记录

    alswl发表于 2013-12-08 15:44:00
    love 0

    作为一个 Linux 的老用户,我再一次验证了那句老话「Linux 用户有钱就换 Mac」。 前段时间,托朋友从香港购入一台 rMBP,下面就是我的 Mac 使用安装记录。

    Brew

    Brew 是 Mac 下面的包管理工具,通过 Github 托管适合 Mac 的编译配置以及 Patch,可以方便的安装开发工具。

    安装 Brew:

    ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
    

    我安装的 Brew 包:

    brew install watch
    brew install tmux
    brew install openssl
    brew install nginx
    brew install ack
    brew install source-highlight
    brew install aria2
    brew install maven
    brew install dos2unix
    brew install privoxy
    brew install nmap
    brew install iotop
    brew install htop
    brew install tinyproxy
    brew install multitail
    brew install cliclick
    brew install ctags
    brew install readline
    brew install reattach-to-user-namespace
    brew install git-flow
    brew install macvim --env-std --override-system-vim
    brew install sshfs
    

    Brew cask

    Brew cask 是类似 Brew 的管理工具, 直接提供 dmg 级别的二进制包,(Brew 是不带源码,只有对应项目所在的 URL)。

    Brew cask 安装:

    brew tap phinze/homebrew-cask
    brew install brew-cask
    

    我通过 Brew cask 安装的软件:

    brew cask install mplayerx
    brew cask install appcleaner
    brew cask install github
    brew cask install bartender
    brew cask install alfred
    brew cask install bettertouchtool
    brew cask install qq
    brew cask install slate
    brew cask install omnigraffle
    brew cask install eclipse-ide
    brew cask install dradio
    

    按键配置

    作为 Awesome 的用户,我实在是受不了 Mac 默认的按键控制,太渣。在两天狂搜之后,尝试了 Divvy / BetterTouchToll 这些按键控制软件之后,还是觉得按键不够自由,直到我发现了 Slate。

    Slate 可以管理几乎所有按键,并进行 窗口/Workspace/Shell 控制,配合 Cliclick 可以完全完成桌面控制。

    下面是我配置的 .slate 文件:

    详细代码可以参见 alswl/.oOo.

    # This is the default .slate file.
    # If no ~/.slate file exists this is the file that will be used.
    
    config defaultToCurrentScreen true
    config nudgePercentOf screenSize
    config resizePercentOf screenSize
    
    # Alias
    alias mouse_left shell path:~/ '/usr/local/bin/cliclick m:640,400 && /Users/alswl/dev/myproject/.oOo./local/bin/mouse_restore.sh'
    alias mouse_right shell path:~/ '/usr/local/bin/cliclick m:1920,400 && /Users/alswl/dev/myproject/.oOo./local/bin/mouse_restore.sh'
    
    alias mouse_iTerm shell path:~/ '/Users/alswl/dev/myproject/.oOo./local/bin/mouse_restore.sh iTerm'
    alias mouse_Firefox shell path:~/ '/Users/alswl/dev/myproject/.oOo./local/bin/mouse_restore.sh Firefox'
    alias mouse_Google_Chrome shell path:~/ '/Users/alswl/dev/myproject/.oOo./local/bin/mouse_restore.sh Google_Chrome'
    alias mouse_QQ shell path:~/ '/Users/alswl/dev/myproject/.oOo./local/bin/mouse_restore.sh QQ'
    alias mouse_MacVim shell path:~/ '/Users/alswl/dev/myproject/.oOo./local/bin/mouse_restore.sh MacVim'
    
    # Resize Bindings
    #bind right:alt       resize +10% +0
    #bind left:alt        resize -10% +0
    #bind up:alt          resize +0   -10%
    #bind down:alt        resize +0   +10%
    #bind right:ctrl;alt  resize -10% +0 bottom-right
    #bind left:ctrl;alt   resize +10% +0 bottom-right
    #bind up:ctrl;alt     resize +0   +10% bottom-right
    #bind down:ctrl;alt   resize +0   -10% bottom-right
    
    # Push Bindings
    #bind right:ctrl;cmd  push right bar-resize:screenSizeX/3
    #bind left:ctrl;cmd   push left  bar-resize:screenSizeX/3
    #bind up:ctrl;cmd     push up    bar-resize:screenSizeY/2
    #bind down:ctrl;cmd   push down  bar-resize:screenSizeY/2
    
    # Nudge Bindings
    #bind right:shift;alt nudge +10% +0
    #bind left:shift;alt  nudge -10% +0
    #bind up:shift;alt    nudge +0   -10%
    #bind down:shift;alt  nudge +0   +10%
    
    # Throw Bindings
    bind 1:ctrl;alt         throw 0 resize
    bind 2:ctrl;alt         throw 1 resize
    #bind 3:ctrl;alt         throw 2 resize
    #bind right:ctrl;alt;cmd throw right resize
    #bind left:ctrl;alt;cmd  throw left  resize
    #bind up:ctrl;alt;cmd    throw up    resize
    #bind down:ctrl;alt;cmd  throw down  resize
    
    # Focus Bindings
    bind `:alt     sequence ${mouse_iTerm} > focus 'iTerm'
    bind 1:alt     sequence ${mouse_Firefox} > focus 'Firefox'
    bind 2:alt     sequence ${mouse_Google_Chrome} > focus 'Google Chrome'
    bind 3:alt     sequence ${mouse_QQ} > focus 'QQ'
    bind q:alt     sequence ${mouse_MacVim} > focus 'MacVim'
    bind h:alt     sequence ${mouse_left} > focus left
    bind l:alt     sequence ${mouse_right} > focus right
    #bind up:cmd       focus up
    #bind down:cmd     focus down
    bind k:alt   focus behind
    bind j:alt focus behind
    
    # Window Hints
    #bind esc:cmd hint
    
    # Toogle Application
    #bind `:alt toggle 'iTerm'
    

    其中用到的鼠标位置记忆脚本是这样的:

     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
    #!/bin/sh
    
    ## Save
    # get current postion, save to last
    CURRENT_WINDOW=iTerm
    [ -f /tmp/SLATE_M_CURR ] && CURRENT_WINDOW=`cat /tmp/SLATE_M_CURR`
    
    # save now pos
    
    NOW_POS=`/usr/local/bin/cliclick p | /usr/bin/awk '{print $4}'`
    echo $NOW_POS > /tmp/SLATE_M_$CURRENT_WINDOW
    
    ## Restore
    if [ $1 != '' ]; then
            # get wanted position
            POS=500,400
            [ -f /tmp/SLATE_M_$1 ] && POS=`cat /tmp/SLATE_M_$1`
    
            # restore postion
            /usr/local/bin/cliclick m:$POS
    
            #LAST_WINDOW=iTerm
            #[ -f /tmp/SLATE_M_LAST_WINDOW ] && LAST_WINDOW=`cat /tmp/SLATE_M_LAST_WINDOW`
            echo $1 > /tmp/SLATE_M_CURR
    fi
    

    原文链接: http://blog.log4d.com/2013/12/mac/
    3a1ff193cee606bd1e2ea554a16353ee


沪ICP备19023445号-2号
友情链接