MacBook Air 2010 の再インストール
MacBookAirを年末に大掃除をしたので記録しておく
準備
- .ssh以下のKeyをバックアップしておきます。
- インストールする事がわかっていて、ダウンロードに時間がかかるものを予め用意しておきます。
これらをUSBディスクを買ってきて、MacOSのインストーラと一緒にまとめておくとよいでしょう。
以下インストールする事がわかっているものなのでUSBに入れて保存しておく
ディスク削除(30min)
インストーラが入っているUSBディスクを差し込みます。
ユーティリティからディスクを削除してからOSを再インストール
アプリケーションインストール(30min)
以下、入れておきたいもの。ほかにおすすめがあれば教えて下さい。
- xcode
- Google Chrome
- ATOK
- DropBox
- SugarSync
- HandBrake
- Growl
- VLC media player
- The Unarchiver
- Adium
Google Chromeのプラクインはアカウントで管理されているので自動的に復元されます。便利。
DropBox, SugarSyncを使っておけば、こういう時に便利。
クラウドってやつですね。
あの、まだこれらを使ってない場合は、ここから加入してみませんか?
250 MBのボーナスがつきます。あなにも。
- https://www.dropbox.com/referrals/NTEzOTY4MDY0OQ?src=global0
- https://www.sugarsync.com/referral?rf=fjh2hi4idpof4
ちなみに私はDropBoxにはドキュメント保存しておいてSugarSyncにはiTunesを丸っと保存しています。ほかに便利な使い方を知ってる方はぜひ教えてください。
homebrew
brew本体をインストール
http://mxcl.github.com/homebrew/
次のコマンドを実行します。
シェルはデフォルトのbash
$ ruby -e "$(curl -fsSL 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
$ brew search git $ brew install git ==> Downloading http://kernel.org/pub/software/scm/git/git-1.7.3.4.tar.bz2 ######################################################################## 100.0% ==> make prefix=/usr/local/Cellar/git/1.7.3.4 install ==> Downloading http://kernel.org/pub/software/scm/git/git-manpages-1.7.3.4.tar.bz2 ######################################################################## 100.0% ==> Downloading http://kernel.org/pub/software/scm/git/git-htmldocs-1.7.3.4.tar.bz2 ######################################################################## 100.0% /usr/local/Cellar/git/1.7.3.4: 965 files, 18M, built in 86 seconds
keyを設定。バックアップしておいた~/.ssh/*をコピー
git configを設定
$ git config --global user.name "my name" $ git config --global user.email myemailaddress@example.com
dotfiles
あらかじめ用意しておいたdotfilesをgit clone。公開用ではなく、git@github.com:okamuuu/dotfiles.gitへアクセスする必要がある
$ mkdir ~/project $ git clone git@github.com:okamuuu/dotfiles.git ~/project/dotfiles
間違えてgit@github.com:okamuuu/dotfiles.gitではなく、https://github.com/okamuuu/dotfiles.gitでcloneするとpushするときにうんざりするのでこの段階で主要なリポジトリを全部git cloneしておく
捨てスクリプトを書いてclone。私のリポジトリは数が少ないのでこれで十分です。
#!/usr/bin/perl use strict; use warnings; for my $name ( @ARGV ) { `git clone git\@github.com:okamuuu/$name.git ~/project/$name`; } $ perl hoge.pl Hoge Fuga Piyo
私はdotfilesでgit submoduleを使っているため、次のコマンドを実行します
$ cd ~/project/dotfiles $ git submodule init $ git submodule update
dotfilesへのシンボリックリンクを生成します。自分用のシェルスクリプトを用意しているのでこれを使います
$ cd ~/project/doftiles $ sh setup.sh
デフォルトシェルを/bin/zshに変更する。パスワードを答えて、Shell: /bin/bash を /bin/zsh に変更します。
$ chsh
brew install(60min)
あとは適当に使っているformulaをいれておく。ここで結構時間がかかる
$ brew install readline mecab libjpeg giflib gmp groonga ffmpeg groonga
libxml2はリンクせよと言われるので従う
$ brew install libxml2 $ brew link libxml2
brew install mysql
% brew install mysql % mysql_install_db % mysql.server start % mysql_secure_installation
my.cnfを作成
% sudo vi /etc/my.cnf [mysqld] max_allowed_packet=64M socket = /usr/local/var/mysql/mysql.sock character-set-server = utf8 default-character-set = utf8 innodb_file_per_table [mysql] default-character-set = utf8 [client] socket = /usr/local/var/mysql/mysql.sock default-character-set=utf8
再起動、確認
% mysql.server restart % mysql -u root -p mysql> show variables like 'char%'; +--------------------------+------------------------------------------------------+ | Variable_name | Value | +--------------------------+------------------------------------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/local/Cellar/mysql/5.1.54/share/mysql/charsets/ | +--------------------------+------------------------------------------------------+ 8 rows in set (0.00 sec) mysql> show variables like 'socket'; +---------------+---------------------------------+ | Variable_name | Value | +---------------+---------------------------------+ | socket | /usr/local/var/mysql/mysql.sock | +---------------+---------------------------------+ 1 row in set (0.00 sec) mysql> show variables like 'version'; +---------------+--------+ | Variable_name | Value | +---------------+--------+ | version | 5.1.54 | +---------------+--------+ 1 row in set (0.00 sec) mysql> exit Bye
perlbrew(30min)
インストール開始
% curl -LO http://xrl.us/perlbrew % perl perlbrew install % ~/perl5/perlbrew/bin/perlbrew init % rm perlbrew
.zshrcに追記し設定を反映します。
% echo 'source $HOME/perl5/perlbrew/etc/bashrc' >> ~/.zshrc % source ~/.zshrc
パスが通っていることを確認。
% where perlbrew ~/perl5/perlbrew/bin/perlbrew
安定かつ最新版をインストール。JPAみると5.12.2らしいのでそれにする
% perlbrew install perl-5.12.2
待っている間退屈な場合はログを眺めてみる。
% tail -f $HOME/perl5/perlbrew/build.log
インストールが終わったらswitch
% pwerlbrew switch perl-5.12.2 % perl -v
cpanmをインストール
% brew instal cpanminus % which cpanm
アップグレード
cpanm --self-upgrade