MBP 構築

# システム設定

## dock
* サイズ 左から 50pxぐらい
* 拡大 on
* 拡大 右から100pxぐらい
* 画面上の位置 左
* dockを自動的に隠す/表示
* Dockの待機時間ゼロにする
```
defaults write com.apple.Dock autohide-delay -float 0 && killall Dock
```

## mission control

### ホットコーナー
左下のみ

* スクリーンセイバーを開始する

## ディスプレイ
* メニューバーにディスプレイを表示

## キーボード
* キーリピート 最速
* リピート入力認識までの時間 最短
* F1, F2など… on
* [僕の Mac の US キーボード設定 3 つ](http://d.hatena.ne.jp/suginoy/20120614/p1)
* 修飾キー CapsLock <-> Ctrl入れ替え

### キーボードショートカット
* キーボードと文字入力
	* 次のウィンドウを操作対象にする	alt + tab
* フルキーボードアクセス すべてのコントロール

## トラックパッド
* タップでクリック on
* 3本指のドラッグ on
* 軌跡の速さ 右から2つめ
* アプリケーションExpose on

## Bluetooth
* off

# applications
## download from web
* [KeyRemap4MacBook](http://pqrs.org/macosx/keyremap4macbook/index.html.ja)
* [PCKeyboardHack](http://pqrs.org/macosx/keyremap4macbook/extra.html.ja)
* [iterm2](http://www.iterm2.com/#/section/home)
	* [iterm2の機能まとめ その1](http://yanmoo.blogspot.jp/2012/02/iterm2.html)
	* [iterm2の機能まとめ その2](http://yanmoo.blogspot.jp/2012/02/iterm2-2.html)
* [Evernote](http://www.evernote.com/)
* [google Chrome](http://www.google.co.jp/chrome/intl/ja/landing.html)
* [better touch tool](http://blog.boastr.net/?page_id=1722)
* [kobito app](http://kobitoapp.com/)
* [bitstream vera mono](http://www.dafont.com/font.php?file=bitstream_vera_mono)
* [libreoffice](http://ja.libreoffice.org/download/)
* [virtual box](https://www.virtualbox.org/wiki/Downloads)
* [growl notify](http://growl.info/downloads)
* [XtraFinder](http://www.trankynam.com/xtrafinder/)
* [google日本語入力](http://www.google.co.jp/ime/index-mac.html)
* [squel pro mysqlの管理](http://www.sequelpro.com/download/)
* [xcode command line tools](https://developer.apple.com/downloads/index.action#)
* [iWebInspector](http://www.iwebinspector.com/)
* [Mac Anti-Virus、セキュリティと保護 | ソフォス無償ツール](http://www.sophos.com/ja-jp/products/free-tools/sophos-antivirus-for-mac-home-edition.aspx)

# other

* [Adobe Creative Cloud | Adobe.com](https://www.google.co.jp/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CDAQtwIwAA&url=http%3A%2F%2Fwww.adobe.com%2Fjp%2Fproducts%2Fcreativecloud.html&ei=BHWZU7TSJIPUkwXDzYCYAw&usg=AFQjCNEI-1Mkf_O26jWPrTEtgednf9MmrA&sig2=a6gO2ZKq2ErNl6qMZwqasw)
* [OminiGraffle for Mac](http://www.omnigroup.com/products/omnigraffle/))
* [kindle](http://www.amazon.com/gp/kindle/mac/download)
* [f.lux](http://stereopsis.com/flux/) Jins PC要らず
* [Cockos Incorporated | LICEcap](https://www.google.co.jp/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0CCwQFjAB&url=http%3A%2F%2Fwww.cockos.com%2Flicecap%2F&ei=LHaZU4DZJoPvkQWzkoHwDA&usg=AFQjCNH1E6_3gp9S8w4RTnv1BK4wajBnJw&sig2=z0lmu78qywBgzsKJzYGHeg)
* [Toggl - Insanely simple time tracking](https://www.toggl.com/public/tour/desktop)

---

# development

## font

http://save.sys.t.u-tokyo.ac.jp/~yusa/fonts/rictydiminished.html#discord

## xcode command line tools

xcode-select --install

## iterm 2 setting

* Preferences -> Keys -> Shortcut Keys
	* ctrl + l -> Next Tab
	* ctrl + h -> Previous Tab
	* ctrl + j -> Scroll One Line Up
	* ctrl + k -> Scroll One Line Down

* [のびーの食っちゃね～だらだらな日々。食っちゃ寝生活してても意外と平気だったりする。 : ターミナル (iTerm2) な Vim を Solarized カラースキーマで！](http://blog.livedoor.jp/okashi1/archives/51836732.html)

## homebrew

```
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
brew update
```

## zsh
```
brew install zsh
sudo view /etc/shells
chsh
```

## git
```
brew install git
brew install tig
```

```
git config --global alias.st "status -s -b"
git config --global alias.ll "log --graph --pretty --decorate"
```

## dotfiles
```
mkdir -p repository/github.com/ppworks
cd repository/github.com/ppworks
git clone git@github.com:ppworks/dotfiles.git
```

```
cd ~
ln -nsf ~/repository/github.com/ppworks/dotfiles/bin bin
ln -nsf ~/repository/github.com/ppworks/dotfiles/.gitconfig .gitconfig
ln -nsf ~/repository/github.com/ppworks/dotfiles/.zshrc .zshrc
ln -nsf ~/repository/github.com/ppworks/dotfiles/.gemrc .gemrc
ln -nsf ~/repository/github.com/ppworks/dotfiles/.vim .vim
ln -nsf ~/repository/github.com/ppworks/dotfiles/.vimrc .vimrc
ln -nsf ~/repository/github.com/ppworks/dotfiles/.tmux.conf .tmux.conf
ln -nsf ~/repository/github.com/ppworks/dotfiles/.bundle ./.bundle
```

## vim

```
sudo mv /usr/bin/vim /usr/bin/old_vim
sudo -s ln /usr/local/bin/vim /usr/bin/vim

```

## vim plugins

```
curl https://raw.githubusercontent.com/Shougo/neobundle.vim/master/bin/install.sh | sh
mkdir -p ~/.vim/bundle
git clone https://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim

```


## heroku

```
curl -L https://toolbelt.heroku.com/install.sh | sh
```


## pow

```
if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".rvmrc" ]; then
  source "$rvm_path/scripts/rvm"
  source ".rvmrc"
fi
```

## qt

````
brew install qt
```

## mysql

```
brew install mysql

```

```
Set up databases to run AS YOUR USER ACCOUNT with:
    unset TMPDIR
    mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

To set up base tables in another folder, or use a different user to run
mysqld, view the help for mysqld_install_db:
    mysql_install_db --help

and view the MySQL documentation:
  * http://dev.mysql.com/doc/refman/5.5/en/mysql-install-db.html
  * http://dev.mysql.com/doc/refman/5.5/en/default-privileges.html

To run as, for instance, user "mysql", you may need to `sudo`:
    sudo mysql_install_db ...options...

Start mysqld manually with:
    mysql.server start

    Note: if this fails, you probably forgot to run the first two steps up above

A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.

To connect:
    mysql -uroot

To launch on startup:
* if this is your first install:
    mkdir -p ~/Library/LaunchAgents
    cp /usr/local/Cellar/mysql/5.5.25/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

* if this is an upgrade and you already have the homebrew.mxcl.mysql.plist loaded:
    launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    cp /usr/local/Cellar/mysql/5.5.25/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

You may also need to edit the plist to use the correct "UserName".

==> Summary
/usr/local/Cellar/mysql/5.5.25: 6382 files, 222M, built in 4.3 minutes
```

## postgreSQL

```
brew install postgresql
```

```

```


```
initdb /usr/local/var/postgres

```

```
vim /usr/local/var/postgres/postgresql.conf
```

```
timezone = 'UTC'
```


## pwgen

パスワード生成

```
brew install pwgen
```

### usage

```
pwgen -s
```

## ios アプリ開発

### ライブラリ管理

```
gem install cocoapods
```


## tmux

```
brew install tmux
brew install reattach-to-user-namespace
```

## perl

```
curl -kL http://install.perlbrew.pl | bash
source ~/perl5/perlbrew/etc/bashrc
perlbrew install perl-5.20.0
perlbrew switch perl-5.20.0
perlbrew install-cpanm
cpanm App::Ack
cpanm Archer
```

## mongdb

```
brew install mongodb
```

```
sudo mkdir -p /data/db/
sudo chown `id -u` /data/db
```

```
mongod
```

## redis

```
brew install redis
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
```

## postfix

```
sudo /etc/postfix/sasl_passwd
```

```
[smtp.gmail.com]:587 <gmail account> <gmail pw>
```

```
sudo postmap /etc/postfix/sasl_passwd
```

```
sudo vim /etc/postfix/main.cf
```

```
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
smtp_use_tls = yes
```

```
sudo postconf -e tls_random_source=/dev/urandom
```

```
sudo touch /etc/postfix/submit.cred
```

```
sudo vim /etc/postfix/submit.cred
```

```
#この2行を追加
submitcred version 1
hostname|username|password
```

```
sudo chmod 600 /etc/postfix/submit.cred
```

```
sudo vim /etc/postfix/generic

```

```
# Translate my primary email address to the Gmail address
# This is ONLY for the outbound email, and does not apply to
# local email.
<yourusername>@<machinename>  <your gmail ID, e.g. user@gmail.com>
@<machinename>                <your gmail ID, e.g. user@gmail.com>
```

```
sudo postmap /etc/postfix/generic
```


```
sudo postfix start
```

```
sudo postfix stop
```


```
sudo mkdir -p /Library/Server/Mail/Data/spool
sudo chmod g-w /Library/Server/Mail/Data/mta
```

```
sudo mkdir /etc/postfix/certs/
cd /etc/postfix/certs/
```

## rename

```
brew install rename
```

### usage

* [ファイル名を一括でリネームする方法](http://d.hatena.ne.jp/kawa_xxx/20120527/1338136718)

## phantomjs

```
brew update
brew install phantomjs
```

## imagick

```
brew install imagemagick --with-libpng
```

## tmux

```
brew install reattach-to-user-namespace 
echo 'set-option -g default-command "reattach-to-user-namespace -l $SHELL"' >> ~/.tmux.conf"
```

## ag

```
brew install the_silver_searcher
```

## php

```
brew install php54
brew tap josegonzalez/homebrew-php
brew install josegonzalez/php/composer
```

## rbenv

```
brew install rbenv
brew install ruby-build

RUBY_CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline) --with-openssl-dir=$(brew --prefix openssl)" rbenv install 2.1.2
rbenv global 2.1.2

rbenv exec gem install bundler
rbenv rehash
```

## polipo

```
brew install polipo
cp /usr/local/Cellar/polipo/1.1.1/homebrew.mxcl.polipo.plist  ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.polipo.plist
```

```
sudo mkdir /etc/polipo
sudo vim /etc/polipo/config
```


```
proxyAddress = 127.0.0.1
proxyPort = 8123
dnsNameServer = 8.8.8.8, 8.8.4.4
dnsUseGethostbyname = false
dnsQueryIPv6 = false
allowedClients = 127.0.0.1
allowedPorts = 1-65535
cacheIsShared = false
chunkHighMark = 104857600
chunkCriticalMark = 83886080
chunkLowMark = 52428800
objectHighMark = 131072
publicObjectLowMark = 16384
maxDiskCacheEntrySize = 5000000000
disableIndexing = false
disableServersList = false
dontCacheRedirects = true
dnsMaxTimeout = 1s
dontCacheCookies = true
serverSlots = 256
serverSlots1 = 128
pipelineAdditionalRequests = true
```

```
launchctl list|grep polip|awk '{print $1}'|xargs kill
```

`ネットワーク -> プロキシ -> httpとhttpsに localhost 8123`と入れる


## vagrant

### virtual box
https://www.virtualbox.org/wiki/Downloads

### vagrant
http://downloads.vagrantup.com/

```
vagrant box add ubuntu-14.04 https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04-amd64-vbox.box
```

```
mkdir -p vagrant/rails
```

```
cd /usr/local/Library/Formula
git checkout 3c5ca25 /usr/local/Library/Formula/gecode.rb
brew install gecode
```

## idobata hook

```
git clone git@github.com:ppworks/idobata-hooks.git
brew install icu4c
brew install cmake
```