«

»

8月 14

Print this 投稿

MBA(Late2010)の環境整備memo


MacBook Air(Mid2011 11″ 128GB)を購入したので,これまで使ってたMacBook Air(Late2010 11″ 64GB)を友人に譲ることに.
友人はこれからMacで開発とか始めてみたいと言うので,クリーンインストールから開発環境の基礎的なところまで構築してから渡すことにした.
ポイントは『64GBという限られたストレージを意識しつつ,dailyメンテナンスが楽』な環境.
Railsとかやりつつドキュメント整備も行う,下流と上流の狭間に揉まれるSE向け環境,誰かの参考になれば幸い.

リカバリUSBからSnowLeopardのクリーンインストール開始
ユーティリティからディスクユーティリティを起動.
「消去」タブから「Mac OS 拡張(ジャーナリング)」を選択してデータをゼロ消去.
約7分.さすがSSD.

Snow Leopardのインストール
言語環境から日本語環境以外のチェックボックスを外す.
Rosettaはなんとなく入れとく.
約16分のインストール作業後,再起動.
「情報を転送しない」を選択して住所とかポチポチに入力.

環境設定
Dockは大きさを最小にして拡大を最大にするのがオススメ.
ワイド画面なら下に置くより左か右,Lionも考えるなら左がオススメ.
画面スワイプでアプリを切り替えるとき,Dockが再左端の目印って直感的じゃない?
さらに後述するLaunchBar5で起動するので,Dockからはすべてのアプリを削除.
今起動しているアプリが何か一瞥するためのDockになる.
ExposeとSpaces,画面左下はDashboard,右上がスクリーンセーバーの開始,右下はすべてのウィンドウに割り当て.
Spacesは有効にしない.便利だと思えたことがない.
キーボードのところでは「F1, F2などのすべてのキーを標準のファンクションキーとして使用」,F10キーとか日本語入力中に多用するので.
忘れずに共有設定からコンピュータ名をかっこいい名前に変更する.

怒濤のソフトウェアアップデート
Xcode入れる前にアップデートしておくのが吉.

開発環境
まずはXcode 3.2.6とiOS SDK 4.3をMacDevCenterからダウンロード&インストール.
つづいてiTerm2をインストール.
XcodeのDLが長すぎて暇だったらDockに最近起動したアプリケーションをスタック表示できるようにしても良いかも.

defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }';killall Dock

HomeBrew
過去記事参照
最初に入れたのはこいつら.
git,git-extras,git-flow,fortune,zsh,coreutils –default-names,sqlite,wget,readline,gettext

rcファイルたち
GitHubからclone.
Vundleを使っているので:BundleInstallするだけでvim環境も構築完了!
rcファイルにシンボリックリンクを張って,zshにchshする.

GitHubにアクセスできなくなる可能性もあるし,ここに現時点のrcファイルを晒しておこう.

# users generic .zshrc file for zsh(1)

## Environment variable configuration
#
# LANG
#
export LANG=ja_JP.UTF-8
case ${UID} in
0)
    LANG=C
    ;;
esac

## Default shell configuration
#
# set prompt
#
autoload colors
colors
case ${UID} in
0)
    PROMPT="%{${fg[cyan]}%}$(echo ${HOST%%.*} | tr '[a-z]' '[A-Z]') %B%{${fg[red]}%}%/#%{${reset_color}%}%b "
    PROMPT2="%B%{${fg[red]}%}%_#%{${reset_color}%}%b "
    SPROMPT="%B%{${fg[red]}%}%r is correct? [No,Yes,Abort,Edit]:%{${reset_color}%}%b "
    ;;
*)
    PROMPT="%{${fg[red]}%}%/%%%{${reset_color}%} "
    PROMPT2="%{${fg[red]}%}%_%%%{${reset_color}%} "
    SPROMPT="%{${fg[red]}%}%r is correct? [No,Yes,Abort,Edit]:%{${reset_color}%} "
    [ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
        PROMPT="%{${fg[cyan]}%}$(echo ${HOST%%.*} | tr '[a-z]' '[A-Z]') ${PROMPT}"
    ;;
esac

# auto change directory
#
setopt auto_cd

# auto directory pushd that you can get dirs list by cd -[tab]
#
setopt auto_pushd

# command correct edition before each completion attempt
#
setopt correct

# compacked complete list display
#
setopt list_packed

# no remove postfix slash of command line
#
setopt noautoremoveslash

# no beep sound when complete list displayed
#
setopt nolistbeep

## Keybind configuration
#
# emacs like keybind (e.x. Ctrl-a gets to line head and Ctrl-e gets
#   to end) and something additions
#
bindkey -e
bindkey "^[[1~" beginning-of-line # Home gets to line head
bindkey "^[[4~" end-of-line # End gets to line end
bindkey "^[[3~" delete-char # Del

# historical backward/forward search with linehead string binded to ^P/^N
#
autoload history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey "^p" history-beginning-search-backward-end
bindkey "^n" history-beginning-search-forward-end
bindkey "\\ep" history-beginning-search-backward-end
bindkey "\\en" history-beginning-search-forward-end

# reverse menu completion binded to Shift-Tab
#
bindkey "\e[Z" reverse-menu-complete

## Command history configuration
#
HISTFILE=${HOME}/.zsh_history
HISTSIZE=50000
SAVEHIST=50000
setopt hist_ignore_dups     # ignore duplication command history list
setopt share_history        # share command history data

## Completion configuration
#
fpath=(${HOME}/.zsh/functions/Completion ${fpath})
autoload -U compinit
compinit -u

## zsh editor
#
autoload zed

## Prediction configuration
#
#autoload predict-on
#predict-off

## Alias configuration
#
# expand aliases before completing
#
setopt complete_aliases     # aliased ls needs if file/dir completions work

alias where="command -v"
alias j="jobs -l"

#case "${OSTYPE}" in
#freebsd*|darwin*)
#    alias ls="ls -G -w"
#    ;;
#linux*)
#    alias ls="ls --color"
#    ;;
#esac

alias ls="ls --color -F"
alias la="ls -a"
alias ll="ls -la"

alias du="du -h"
alias df="df -h"

alias rm="rm -i"
alias mv="mv -i"
alias cp="cp -i"

alias su="su -l"

alias vi="vim"
alias CotEditor="open -W -n -a CotEditor"

## terminal configuration
#
case "${TERM}" in
screen)
    TERM=xterm
    ;;
esac

case "${TERM}" in
xterm|xterm-color)
    export LSCOLORS=exfxcxdxbxegedabagacad
    export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
    zstyle ':completion:*' list-colors 'di=34' 'ln=35' 'so=32' 'ex=31' 'bd=46;34' 'cd=43;34'
    ;;
kterm-color)
    stty erase '^H'
    export LSCOLORS=exfxcxdxbxegedabagacad
    export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
    zstyle ':completion:*' list-colors 'di=34' 'ln=35' 'so=32' 'ex=31' 'bd=46;34' 'cd=43;34'
    ;;
kterm)
    stty erase '^H'
    ;;
cons25)
    unset LANG
    export LSCOLORS=ExFxCxdxBxegedabagacad
    export LS_COLORS='di=01;34:ln=01;35:so=01;32:ex=01;31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
    zstyle ':completion:*' list-colors 'di=;34;1' 'ln=;35;1' 'so=;32;1' 'ex=31;1' 'bd=46;34' 'cd=43;34'
    ;;
jfbterm-color)
    export LSCOLORS=gxFxCxdxBxegedabagacad
    export LS_COLORS='di=01;36:ln=01;35:so=01;32:ex=01;31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
    zstyle ':completion:*' list-colors 'di=;36;1' 'ln=;35;1' 'so=;32;1' 'ex=31;1' 'bd=46;34' 'cd=43;34'
    ;;
esac

# set terminal title including current directory
#
case "${TERM}" in
xterm|xterm-color|kterm|kterm-color)
    precmd() {
        echo -ne "\033]0;${USER}@${HOST%%.*}:${PWD}\007"
    }
    ;;
esac

## auto ls
#
function chpwd() { la }

## load user .zshrc configuration file
#
[ -f ${HOME}/.zshrc.mine ] && source ${HOME}/.zshrc.mine

## SSH
bindkey "^?" backward-delete-char

## HomeBrew
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
# Man
export MANPATH=/usr/local/man:/usr/share/man:$MANPATH

## RubyGems
export PATH=/Library/Ruby/Gems/1.8/bin:$PATH
" vimrc
" LastModified: 2011/08/03

set nocompatible "vi非互換モード

"#######################
" Vundle
"#######################
filetype off
set rtp+=~/.vim/vundle.git/
call vundle#rc()
Bundle 'Shougo/neocomplcache'
Bundle 'Shougo/unite.vim'
filetype plugin on

"#######################
" neocomplcache
"#######################
let g:neocomplcache_enable_at_startup = 1

"#######################
" unite
"#######################
let g:unite_enable_start_insert = 1

"#######################
" 表示系
"#######################
set number "行番号表示
set showmode "モード表示
set title "編集中のファイル名を表示
set ruler "ルーラーの表示
set showcmd "入力中のコマンドをステータスに表示する
set showmatch "括弧入力時の対応する括弧を表示
set laststatus=2 "ステータスラインを常に表示

"入力モード時、ステータスラインのカラーを変更
augroup InsertHook
autocmd!
autocmd InsertEnter * highlight StatusLine guifg=#ccdc90 guibg=#2E4340
autocmd InsertLeave * highlight StatusLine guifg=#2E4340 guibg=#ccdc90
augroup END

"行末の空白を強調表示
highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /¥s¥+$/
autocmd WinEnter * match WhitespaceEOL /¥s¥+$/

"#######################
" プログラミングヘルプ系
"#######################
syntax on "カラー表示
"colorscheme desert
set autoindent
set smartindent "オートインデント
" tab関連
set expandtab "タブの代わりに空白文字挿入
set ts=4 sw=4 sts=0 "タブは半角4文字分のスペース
" ファイルを開いた際に、前回終了時の行で起動
autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g`\"" | endif

"#######################
" 検索系
"#######################
set ignorecase "検索文字列が小文字の場合は大文字小文字を区別なく検索する
set smartcase "検索文字列に大文字が含まれている場合は区別して検索する
set wrapscan "検索時に最後まで行ったら最初に戻る
set incsearch "検索文字列入力時に順次対象文字列にヒットさせない
set hlsearch "検索結果文字列の非ハイライト表示
# screenrc
# LastModified: 2011/08/03

# basics
escape ^Tt
shell /bin/zsh
autodetach on
bind w windowlist -b

# shut up!
startup_message off
vbell off

# hardstatus
hardstatus alwayslastline |%w|
defhstatus I^En:^EtI

nethack on

ブラウザ
Safariで「ダウンロード後,安全なファイルを開く」わけがない.
常用するのはFirefoxかな.Chromeでも良いけど.このあたりは友人の趣味に任せることにする.

他に入れたアプリたち

  • LaunchBar5
  • 有料だけどQuickSilverより軽くて気が利く.
    Demo版入れておいてあげよう.
    Keyboard Shortcutsの”Search in LaunchBar”がIME切替とバッティングしているのでoption+Spaceに変更.
    Search in SpotlightはOS標準のCtrl+Spaceで良いので,チェックボックスを外す.

  • Growl
  • Skitch
  • AppStoreだと有料だけど公式サイトにアカウント作ってログインすれば無料版が手に入る.

  • CyberDuck
  • ~/.sshにid_rsaを置いて,iTerm2からsshやgitできることを確認したら,CyberDuckからも公開鍵認証でSFTPできるか確認.
    CyberDuckもAppStoreからDLすると有料なんだよなー.

  • GitHub for Mac
  • Mac使ってるならこれをインストールしない手はないよねぇ.

  • OnyX
  • MonthlyメンテにはOnyX.BetaではあるけどLion版も出ているのでしばらくは使い続けられそう.

  • AppCleaner
  • TrashMeのほうが少し高機能だけど,アプリ消すぐらい無料で済ませたいので.

  • Google IME
  • ほんとはATOKを使いたいけど,ことえりよりはマシ.

  • CotEditor
  • TextWranglermiも試したんだけど,結局はCotEditorに落ち着いた.
    シンタックススタイルでDotOutlineする設定やEvernoteに送信できるスクリプトを追加すると他のエディタに浮気できなくなる.

  • Monolingual
  • ここまで構築すると64GBは残り34GBほどに.
    思いきって日本語英語以外の言語はもちろん,ArchitechtureからARMやPowerPC系も全部削除.
    これで1GBぐらい増える.

Rails
まずgemが1.3.5じゃ不便なので.

sudo gem install rubygems-update
sudo update_rubygems

あとはgemでrailsを入れるだけ.

sudo gem install rails

rails 3.0.9が入りましたよ.
念のためsudo gem updateもしておく.

Sphinx
過去に記事を書いたけど,HomeBrewでのpipの扱いが変わっていた.

easy_install pip
sudo pip install -U sphinxcontrib-blockdiag

外装洗浄
中性洗剤とアルコールでピッカピッカにしーてやんよ〜♪

Similar Posts:

Share on Facebook
MBA(Late2010)の環境整備memob - log

Permanent link to this article: http://bellonieta.net/2011/08/mbalate2010%e3%81%ae%e7%92%b0%e5%a2%83%e6%95%b4%e5%82%99memo/

コメントを残す

メールアドレスは公開されません