MacBookProを購入したけど、環境構築がダルいのでインストール関連だけでも自動化。
それにしても、世の中は進化してて、いろんなセットアップがお手軽に自動で行えるようになってた。
- brew caskがbrew本家に取り込まれて、何も設定せずに使える。
- brew caskのインストール先も/Applicationsに直接インストールされるようになってた。
- XCodeをインストールしなくても、brewの実行に必要な XCode Command Line Tools は自動でインストールしてくれる。
Ansibleを使う方法とか、完全自動化ともあったけど、お手軽さを重視。
WiFi設定、AppleID、省電力設定の変更
こればっかりは手動で設定。
自動インストールが止まらないように省電力設定を変更。(システム環境設定 > 省エネルギー)
各種コマンドやアプリのインストール
brewの設定
まずはターミナルを立ち上げて、brewをインストール。
コマンドラインで次の内容を実行。
/usr/bin/ruby -e " (curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
きちんとセットアップできてるかどうか確認
brew doctor
brew cask doctor
brew -v
インストールの実行
まずは、Brewfile というファイルを用意。
brew 'git' brew 'openssl' brew 'vim' brew 'peco' brew 'wget' brew 'openssl' brew 'nkf' brew 'mysql' brew 'yasm' brew 'jq' brew 'imagemagick' brew 'awscli' brew 'aws-elasticbeanstalk' brew 'ansible' cask 'google-japanese-ime' cask 'dropbox' cask 'vlc' cask 'google-chrome' cask 'vagrant' cask 'virtualbox' cask 'sourcetree' cask 'visual-studio-code' cask 'android-studio' cask 'mysqlworkbench' cask 'atom' cask 'skype' cask 'transmit' cask 'cd-to' cask 'appcleaner' cask 'kindle' cask 'nosleep' cask 'slack' cask 'the-unarchiver' cask 'google-photos-backup-and-sync' cask 'flash-player' cask 'gimp' cask 'Karabiner' cask 'xquartz' brew 'wine' # xquartz required brew 'winetricks' # xquartz required mas 'ToyViewer ', id: 414298354 mas 'The Unarchiver', id: 425424353 mas 'Disk Diag', id: 672206759 mas 'Xcode', id: 497799835
Brewfileがあるフォルダで次のコマンドを実行
brew bundle
途中で何度かパスワードを聞かれる。
masの実行時にAppleIDのパスワードを聞かれる。
不要なファイルを削除
終わったら不要なファイルを後始末。
brew cleanup brew cask cleanup
省電力設定も元に戻す。
コマンドラインで設定
finder
finderなどの設定もコマンドラインでできる。
# Automatically open a new Finder window when a volume is mounted # マウントされたディスクがあったら、自動的に新しいウィンドウを開く defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true # Set ` {HOME}` as the default location for new Finder windows # 新しいウィンドウでデフォルトでホームフォルダを開く defaults write com.apple.finder NewWindowTarget -string "PfDe" defaults write com.apple.finder NewWindowTargetPath -string "file:// {HOME}/" # Show Status bar in Finder (ステータスバーを表示) defaults write com.apple.finder ShowStatusBar -bool true # Show Path bar in Finder (パスバーを表示) defaults write com.apple.finder ShowPathbar -bool true # Show Tab bar in Finder (タブバーを表示) defaults write com.apple.finder ShowTabView -bool true # Show the ~/Library directory (ライブラリディレクトリを表示、デフォルトは非表示) chflags nohidden ~/Library # Show the hidden files (不可視ファイルを表示) defaults write com.apple.finder AppleShowAllFiles YES
その他の設定
# Avoid creating `.DS_Store` files on network volumes (ネットワークディスクで、`.DS_Store` ファイルを作らない) defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true # Disable the "Are you sure you want to open this application?" dialog # 未確認のアプリケーションを実行する際のダイアログを無効にする defaults write com.apple.LaunchServices LSQuarantine -bool false
手動でいろいろ設定
本体設定
Firefox
最新のFirefoxではVimperatorの一部機能が動かないので、Firefox 55.0.3をダウンロードしてインストール
アカウントを入力して、設定の同期
Google Chrome, Dropbox, Skype
アカウントを入力して同期
java
JDK8をダウンロードしてインストール
Google IMEを設定
LaunchpadでGoogle IMEのConfigDialogを起動
一般タブ > キー設定の選択 > 編集 > 左下の編集 > インポート > keymap.txt を選択
アクティビティモニタ
アクティビティモニタを起動
Dockバーのアイコンを右クリック > Docアイコン > CPU使用率を表示
ターミナル
設定変更
Vimperatorの設定
ホームフォルダに .vimperatorrc を作成し、Dropbox内の設定ファイルを読むようにさせる。
set titlestring='Firefox!!!' source! ~/Dropbox/_vimperatorrc
jFD2
jFD2本体をダウンロード
https://sites.google.com/site/ikemen/jfd2
jFD2_1.02c.dmgを開く
jFD2.app をアプリケーションフォルダに移動
Finder上で、jFD2.app に対して Ctrl を押しながら、右クリック > 開く
jFD2を実行するとJava6ランタイムがいると言われる。
Java6ランタイムをダウンロード
https://support.apple.com/kb/DL1572?viewlocale=ja_JP&locale=en_US
シンボリックリンクでDropbox内の設定を読むようにさせる。
cd ~ rm -rf ~/.jfd2 rm -rf ~/.jfd2_user ln -s "/Users/username/Dropbox/tools_mac/Application Support/.jfd2" ~/.jfd2 ln -s "/Users/username/Dropbox/tools_mac/Application Support/.jfd2_user" ~/.jfd2_user
Time Machine
TimeMachineを開く
「バックアップを自動作成」をチェック
「Time Machineをメニューバーに表示」をチェック
Atom
コマンドラインで次の内容を実行
apm install sync-settings atom
sync-settingsを設定
- Personal Access Tokenを設定
- Gist Idを設定
sync-settings の Restore を実行
Visual Studio Code
Settings Syncを設定
Settings Sync - Visual Studio Marketplace
Microsoft Office
以前にAmazonで購入しているので、ダウンロードしてインストール。
ダウンロードするときは、「ご利用方法はこちら」に書かれているMSのダウンロードURLからダウンロードしたほうが早い。
VLC
履歴を残さないように設定変更
【メモ】VLC for Macで、再生履歴を消す&残さないようにする - Marの人生の一片
キーリピートの高速化
ある程度の高速化でよければ、 システム環境設定 > キーボード で設定する。
もっと高速化する場合は、 Karabiner というツールで設定する。
詳細は、[Mac] キーボードの反応速度を速くする方法 | Developers.IO 参照