MacBookAir再購入につきセットアップをログる
Macに水こぼしたんです。また同じMacBookAirを買ったのでセットアップ手順をログっておく
右クリック
システム環境設定 > トラックパッド にて幅ボタンクリック(右下隅)を有効にします。
DropboxとSugarSyncへのシンボリックリンク
iTunesのデータを同期しておく。このやり方で、もし複数PC間でiPhoneと同期とる場合にどうなるかはよく知らない。
$ mv "~/Music/iTunes ~/Music/_iTunes $ ln -s ~/SugarSync/iTunes ~/Music/iTunes
もし、まだ~/SugarSync/Musicが存在していない場合はコピー
$ cp -fr "~/Music/iTunes ~/SugarSync/iTunes
試しにiTunesを立ち上げて問題が起きてないかを確認します。
上記では音楽ファイルだけを同期しています。動画のバックアップはSugarSyncのような容量に限りがあるサービスでは向いてないのですが、まあ簡易なバックアップとしていいのではないでしょうか。
xcode ダウンロード
なぜか有料化されてしまったxcode4。無料版であるxcode3をとりあえず使った場合の方法は下記。
Dev Centerにログインしてから下記の場所でDLできます。
https://developer.apple.com/devcenter/mac/index.action
Xcode 3.2.6 and iOS SDK 4.3
で、4.1GBあるからお風呂に入ろう…
うーん。前回ダウンロードしておいたxcodeのインストーラを保存したUSBどこ行ったんや…
とりあえずダウンロードに時間がかかるので次の作業へ
アプリインストール
以下、入れておく。ほかにおすすめがあれば教えて下さい。
- mi
- ATOK
- Google Chrome
- FireFox
- DropBox
- SugarSync
- HandBrake
- Growl
- VLC media player
- The Unarchiver
- Adium
xcodeダウンロード中に再起動するとやりなおしになるので注意
homebrew
下記サイトの install Homebrew today から 実行すべきコマンドを見つける
http://mxcl.github.com/homebrew/
ということで下記コマンドを実行。
$ ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"
ちなみにこのコマンドが行っていることはこんな感じ
- /usr/local/以下にディレクトリを作成します。
- root権限が必要なのでパスワードを聞かれます。
- パスワードを渡すとそれを元にsudoコマンドをつかって/usr/localを作成
- staffは管理者権限のないユーザグループのことです。このグループに属しているユーザーに対して/usr/localへの書き込み、実行権限を渡します
brewコマンドでinstallする各種コマンドは/usr/localに保存されます。
なにかあったらこの/usr/localを削除してもう一度installをやり直すことも可能です。
$ ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)" ==> This script will install: /usr/local/bin/brew /usr/local/Library/Formula/... /usr/local/Library/Homebrew/... Press enter to continue ==> /usr/bin/sudo /bin/mkdir /usr/local WARNING: Improper use of the sudo command could lead to data loss or the deletion of important system files. Please double-check your typing when using sudo. Type "man sudo" for more information. To proceed, enter your password, or type Ctrl-C to abort. Password: ==> /usr/bin/sudo /bin/chmod g+w /usr/local ==> /usr/bin/sudo /usr/bin/chgrp staff /usr/local ==> Downloading and Installing Homebrew... ==> Installation successful!
インストールが終わったら一応READMEを読んでおきましょう。
$ cat /usr/local/README.md
brew install git
最初にgitをインストールします。
理由は私がscreen, vim, zshの設定ファイルをgithubにおいてあるからです。
$ brew install git
key作成
% mkdir -p ~/.ssh/keys % cd ~/.ssh % ssh-keygen -t dsa -f ~/.ssh/keys/id_dsa
パーミッションを変更
$ chmod 0700 ~/.ssh $ chmod 0600 ~/.ssh/id_dsa
設定ファイルを記述
% vi ~/.ssh/config Host github.com User okamuuu Port 22 Hostname github.com IdentityFile ~/.ssh/keys/id_dsa TCPKeepAlive yes IdentitiesOnly yes
githubにログインし、公開鍵を追加します。
公開鍵は以下をコピペする
cat id_dsa.pub
以上で公開鍵は不要なので削除しておきます。
$ rm ~/.ssh/keys/id_dsa.pub
もしまた必要になった場合は秘密鍵があれば公開鍵を作ることが可能です。
$ ssh-keygen -y Enter file in which the key is (/Users/okamura/.ssh/id_rsa): /Users/okamura/.ssh/keys/id_dsa
git configを設定
$ git config --global user.name "my name" $ git config --global user.email myemailaddress@example.com $ git config --global core.editor "/usr/bin/vim"
github.comにssh経由でアクセスし、dotfilesというプロジェクトをMacにダウンロードします。
このときWarningsが表示されますが、これはこの鍵で初めてアクセスするサーバーの場合、正しい処理です。
もし、いつもアクセスしているはずのサーバーに対してのアクセスでこのwarningsが表示された場合、サーバーが変更されているので「悪意のある誰か」が「罠を仕掛けたサーバーにすり替えて」いる可能性が無きにしもあらず、です。
なのでサーバー管理者に問い合わせてサーバーを変更しているかどうかを問いただします。
まあたいていサーバー管理者は「え、変えたけど何で?」とか返事すると思います。
$ mkdir ~/project $ git clone git@github.com:okamuuu/dotfiles.git ~/project/dotfiles Cloning into /Users/okamura/project/dotfiles... The authenticity of host 'github.com (207.97.227.239)' can't be established. RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts. remote: Counting objects: 99, done. remote: Compressing objects: 100% (90/90), done. remote: Total 99 (delta 33), reused 0 (delta 0) Receiving objects: 100% (99/99), 13.30 KiB, done. Resolving deltas: 100% (33/33), done.
私はdotfilesでgit submoduleを使っているため、次のコマンドを実行します
$ cd ~/project/dotfiles $ git submodule init $ git submodule update
用意してあるセットアップスクリプトを実行します。
$ cd ~/project/doftiles $ sh setup.sh
Macのシステム環境設定 > アカウント で、ユーザーのデフォルトシェルを/bin/zshに切り替えておきます。
鍵のアイコンをクリックして編集可能にしておいてから目的のユーザーで右クリック(opt+クリック)
brew install
以下自分がよく使いそうなツールをインストール
$ brew install readline mecab libjpeg giflib gmp groonga ffmpeg groonga
perlbrew
% curl -LO http://xrl.us/perlbrew % perl perlbrew install % ~/perl5/perlbrew/bin/perlbrew init % rm perlbrew
zshに環境変数を設定。私は.zsh_customというファイルに記述を行います。
各自でそれぞれにマッチした設定ファイルに追記をしてください。
% echo 'source $HOME/perl5/perlbrew/etc/bashrc' >> ~/.zshrc_custom % source ~/.zshrc_custom
JPAによると最新の安定版はは5.12.3らしいのでそうする
% perlbrew install perl-5.12.3 Attempting to load conf from /Users/okamura/perl5/perlbrew/Conf.pm Fetching perl-5.12.3 as /Users/okamura/perl5/perlbrew/dists/perl-5.12.3.tar.gz
ファイルを探しはじめるのでしばらくお待ちください。
しばらくするとtailでbuilt.logがみれますよと表示されるので退屈な場合はそいつをを眺めましょう
% tail -f $HOME/perl5/perlbrew/build.log
さておき、インストールが終わったらswitch
% pwerlbrew switch perl-5.12.3 % perl -v
cpanmをインストール
% brew instal cpanminus % which cpanm
アップグレード
% cpanm --self-upgrade
App::cpanoutdatedをインストール
% cpanm App::cpanoutdated
アップデート
% cpan-outdated | cpanm
Ruby
とりあえず最近記述した記事とほぼ同じ。
http://d.hatena.ne.jp/okamuuu/20110309/1299675532
ここだけ違う。--defaultを引数にしておくとシェルを再起動してもrvmのrubyを使い続けるようになる
% rvm use ruby-1.9.2 --default