èæ¯
æç¨ãã¦ãã MBP15" ãä¸ã¶æã»ã©åã«çªç¶äº¡ããªããæ¥é½ MBP13" ãè²·ã£ã¦ç°å¢æ§ç¯ãè¡ã£ãã®ã§è¨é²ãã¦ããã
(ãã®å¾åã®èãã¦è»½ãã¦æ°ãã Macbook ãåºãã ãã§ãªã MBP13" ã¾ã§ãã¤ãã¼ã¢ãããã¼ãããããããããæããã¯ãªããæããã¯ãªããï¼ï¼)
Brewfile ãªã¯ã³ã³åé¡
éçºç°å¢ã®æ§ç¯ã¯ Homebrew 㨠Homebrew Cask ãå
¥ã㦠Brewfile ãæ¸ãã brew bundle
ããã°çµãããã¨æãããããã Brewfile ã¯ãªã¯ã³ã³ã«ãªã£ã¦ãã¾ã£ããããã
(3/25 追è¨) Brewfile ããªã¯ã³ã³ãªã®ã§ã¯ãªã Homebrew æ¬ä½ãã bundle ã³ãã³ããå¤ãããã ãã§ã å ã¨ãªã£ã brewdle ã³ãã³ãã¯å¥å¨ã§ããã£ã¨ä¾¿å©ãª brew-file ãããã¨ã®ãã¨ã§ãã åè: Brewfileã¯ãªã¯ã³ã³ã§ã¯ãªã
Ansible ã§ã§ãã?
ãããéçºç°å¢ã®æ§ç¯ã¯å¯è½ãªéãæä½æ¥ãæ¸ãããããBrewfile ç¸å½ã®ã·ã§ã«ã¹ã¯ãªãããæ¸ãã¦ãè¯ãããå°ã調ã¹ã¦ã¿ã㨠Ansible ã« homebrew ã¢ã¸ã¥ã¼ã« ãããã Ansibleã§homebrewã管çãã ãã¨ãã§ããããããå®éã« Macã®ç°å¢æ§ç¯ãAnsibleã§ãããã¨ã«ãã æ¹ãããããã ã
ãã㦠hnakamur ããã Ansibleã§Homebrew, Cask, Atomã¨ãã£ã¿ã¼ã®ããã±ã¼ã¸ã管çãã èªååã¿ã¹ã¯ãåå©ç¨å¯è½ãªå½¢ã§ Ansible Galaxy ã«å ¬éããã¦ãããã¨ãããã£ãã ä»ã«ã osxc - simple configuration tool for os x ã¨ãããã¼ã«ãããããã (ããã Ansible ãã¼ã¹)ãããããè¸ã¾ãã¦ãèªååã«åãçµãã§ã¿ãã
èªååã®åã«æã§å ¥ãã(å ¥ãã¦ãã¾ã£ã)ãã®
ãªããä¸è¨ã®ã¢ããªã¯ä»äºä¸ããã«å¿ è¦ã ã£ãã®ã§ãå¾è¿°ã®èªååã®ä»çµã¿ã«å ¥ããã«æã§å ¥ãã¦ãã¾ã£ãã
- dropbox
- 1Password
èªååæºå
XCode
Homebrew ãå ¥ããããã«ã¾ã Mac App Store ãã XCode ãã¤ã³ã¹ãã¼ã«ãé·ãæéå¾ ã£ã¦ãã¦ã³ãã¼ããçµãã£ããä¸åº¦ç«ã¡ä¸ããã©ã¤ã»ã³ã¹ã«åæãã¦ãããå¾ã«ããã£ããã¨ã ã Mac Yosemite Rails ææ°ç°å¢ 詳解 æ§ç¯æé ã«ããã¨ãç«ã¡ä¸ããã¨ãä¸è¨ã³ãã³ãã§ã©ã¤ã»ã³ã¹åæã§ããããã (æªç¢ºèª)ã
sudo xcodebuild -license
Homebrew
Xcode ã® Command Line Tool ãå ¥ãããã®å¾ãã homebrew ãã¯ã³ã©ã¤ãã¼ã§å ¥ããã
xcode-select --install ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Homebrew ã¤ã³ã¹ãã¼ã«å¾ã« brew doctor
ã³ãã³ããå©ããå¤ãã¨è¨ãããå ´å㯠brew update
ããã
brew doctor brew update
Ansible
Ansible ã§ãããã¸ã§ãã³ã°ãè¡ããã python 㨠ansible ãå ¥ãããäºã¤ã¨ã Homebrew ã§å ¥ãã
brew install python brew install ansible
èªååéå§
ãããã¸ã§ãã³ã°ç¨ã®ãã£ã¬ã¯ããªãä½ããååã¯ä½ã§ãè¯ãã .macbook-provisioning
ã¨ãã¦ããã
mkdir .macbook-provisioning cd .macbook-provisioning/
以éã®ä½æ¥ã¯ .macbook-provisioning
ãã£ã¬ã¯ããªã§è¡ãã
inventory ãã¡ã¤ã«ä½æ
ansible ç¨ã® inventory ãã¡ã¤ã« (å®è¡å¯¾è±¡ãã¹ãæå®ãã¡ã¤ã«) ãä½ããä»åã¯æå
ãã·ã³ã®ãããã¸ã§ãã³ã°ãªã®ã§ localhost ã ãããã°è¯ãããã¡ã¤ã«å㯠hosts
ã¨ããã
echo 'localhost' > hosts
playbook ãã¡ã¤ã«ä½æ
次㫠playbook (ãããã¸ã§ãã³ã°ã®å
容) ãæ¸ãããã¡ã¤ã«å㯠localhost.yml
ã¨ããã(ãã®ãã¡ã¤ã«ãå«ã github ã«ç½®ãã¦ããã¾ãã twada/macbook-provisioning)
- hosts: localhost connection: local gather_facts: no sudo: no vars: homebrew_taps: - homebrew/binary - homebrew/dupes - caskroom/cask - railwaycat/emacsmacport - sanemat/font homebrew_packages: - { name: readline } - { name: openssl } - { name: openssl, state: linked, install_options: force } - { name: python } - { name: ansible } - { name: coreutils } - { name: git } - { name: zsh, install_options: disable-etcdir } - { name: wget } - { name: curl } - { name: cmake } - { name: autoconf } - { name: automake } - { name: pkg-config } - { name: ctags } - { name: tree } - { name: lv } - { name: nkf } - { name: jq } - { name: go } - { name: direnv } - { name: peco } - { name: hub } - { name: tig } - { name: fish } - { name: rbenv } - { name: ruby-build } - { name: tofrodos } - { name: lha } - { name: flow } - { name: mysql } - { name: sqlite } - { name: redis } - { name: imagemagick } - { name: mercurial } - { name: packer } - { name: xz } - { name: socat } - { name: rlwrap } - { name: w3m } - { name: tmux } - { name: reattach-to-user-namespace } - { name: phantomjs } - { name: graphviz } - { name: autojump } - { name: gibo } - { name: source-highlight } homebrew_cask_packages: - { name: emacs-mac } - { name: iterm2 } - { name: firefox } - { name: google-chrome } - { name: adobe-reader } - { name: java } - { name: skype } - { name: slack } - { name: sourcetree } - { name: gitx } - { name: karabiner } - { name: seil } - { name: flux } - { name: dash } - { name: skitch } - { name: seashore } - { name: atom } - { name: kobito } - { name: webstorm } - { name: phpstorm } - { name: intellij-idea } - { name: vagrant } - { name: virtualbox } tasks: - name: homebrew ã® tap ãªãã¸ããªã追å homebrew_tap: tap={{ item }} state=present with_items: homebrew_taps - name: homebrew ãã¢ãããã¼ã homebrew: update_homebrew=yes # brew - name: brew ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã« homebrew: > name={{ item.name }} state={{ item.state | default('latest') }} install_options={{ item.install_options | default() | join(',') if item.install_options is not string else item.install_options }} with_items: homebrew_packages register: brew_result - name: brew ããã±ã¼ã¸ã®æ å ±ä¿åå ãã£ã¬ã¯ããªãä½æ file: path=brew_info state=directory - name: brew ããã±ã¼ã¸ã®æ å ±ãä¿å shell: brew info {{ item }} > brew_info/{{ item }} with_items: brew_result.results | selectattr('changed') | map(attribute='item') | map(attribute='name') | list # cask - name: homebrew-cask ã®ã¤ã³ã¹ãã¼ã« homebrew: name=brew-cask state=latest - name: cask ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã« homebrew_cask: name={{ item.name }} state={{ item.state|default('installed') }} with_items: homebrew_cask_packages register: cask_result - name: cask ããã±ã¼ã¸ã®æ å ±ä¿åå ãã£ã¬ã¯ããªãä½æ file: path=cask_info state=directory - name: cask ããã±ã¼ã¸ã®æ å ±ãä¿å shell: brew cask info {{ item }} > cask_info/{{ item }} with_items: cask_result.results | selectattr('changed') | map(attribute='item') | map(attribute='name') | list # oh-my-zsh - name: oh-my-zsh ã®ã¤ã³ã¹ãã¼ã« shell: curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh args: creates: ~/.oh-my-zsh/ # Ricty - name: xquartz ã®ã¤ã³ã¹ãã¼ã« (for Ricty) homebrew_cask: name=xquartz - name: fontforge ã®ã¤ã³ã¹ãã¼ã« (for Ricty) homebrew: name=fontforge - name: Ricty ã®ã¤ã³ã¹ãã¼ã« homebrew: name=ricty - name: çæããããã©ã³ããã¡ã¤ã«ãã³ãã¼ shell: cp -f $(brew --cellar ricty)/*/share/fonts/Ricty*.ttf ~/Library/Fonts/ args: creates: ~/Library/Fonts/Ricty-Bold.ttf notify: run fc-cache handlers: - name: run fc-cache shell: fc-cache -vf
å®è¡
ãã¨ã¯ ansible-playbook ã³ãã³ããå©ãã°ã localhost.yml ã®å
容ã次ã
ã«å®è¡ãããã¢ããªã大éã«ã¤ã³ã¹ãã¼ã«ããããåºåã®é㯠-vv
ãªãã·ã§ã³ããããã¡ããã©è¯ãæ°ããã¦ããã
HOMEBREW_CASK_OPTS="--appdir=/Applications" ansible-playbook -i hosts -vv localhost.yml
ãã ãå®éã«ã¯ cask ããã±ã¼ã¸ã®ããã¤ãã§ãã¹ã¯ã¼ããèãããã®ã§ãå ¨èªåã¨ã¾ã§ã¯ãããªãã
(追è¨) Homebrewã¨Ansibleã§Macã®éçºç°å¢æ§ç¯ãèªååãã | mawatari.jp ã«ããã¨ãã³ãã³ãå®è¡æã« HOMEBREW_CASK_OPTS="--appdir=/Applications"
ãæå®ããæ¹ãããããããªãã·ã§ã³ãæå®ããªãã¨ãã¢ããªã±ã¼ã·ã§ã³ã«ãã£ã¦ /Applications
ã ã£ããã ~/Applications
ã ã£ããã«ã·ã³ããªãã¯ãªã³ã¯ãªã³ã¯ãä½ããã¦ãã¾ãã¨ã®ãã¨ã
localhost.yml ã軽ã説æ
- æ§é ãå 容㯠hnakamur ããã® Qiita ã¨ã³ã㪠ãã¨ã¦ãã¨ã¦ãåèã«ãã¤ã¤ãä½ãèµ·ããããèªåã§ææ¡ãããã®ã§ãã¾ãã¤ã³ã¹ãã¼ã«å¾ã®å¦çã cask ã®ãªãã·ã§ã³ãå¾ã æ示çã«æå®ã§ããããã«ãããã£ãã®ã§ãçµå±ã»ã¼åãå 容ã1ãã¡ã¤ã«ã§æ¸ãã (hnakamur ãããã¿ã¾ãã)ãåæ§ã®çç±ã§ osxc ãçµå±ä½¿ããªãã£ãã
- Ansible ã® homebrew ã¢ã¸ã¥ã¼ã«ã®ãªãã·ã§ã³ã«ä½ãæå®ã§ããã㯠æ¬å®¶ããã¥ã¡ã³ã 㨠Ansibleã§homebrewã管çãã - çç³»å¦çæ¥è¨ ãåèã«ãªãã
- åããã±ã¼ã¸ã®ããã©ã«ãã®
state
ãlatest
ã«ãã¦ããã®ã§ãæ¢ã«ã¤ã³ã¹ãã¼ã«ããã¦ããããã±ã¼ã¸ã§ãæ°ãããã¼ã¸ã§ã³ãããå ´åã¯ã¢ãããã¼ããããã - Ricty ãã©ã³ãã®ã¤ã³ã¹ãã¼ã«ã¯ xquartz (cask), fontforge (brew), ricty (brew) ã®é ã«å ¥ããªããã°ãªããªãã®ã§ãä¸çºã§å ¥ãã試è¡é¯èª¤ãããã¨ã«ãªã£ã (ããã«æ¸ããå®ç¾©ã«ã¯ããã£ã¨ãã©ãçãã)ã
- oh-my-zsh ã Ricty ã®ã¤ã³ã¹ãã¼ã«å®ç¾©ã®ã¨ããã¯ãã¡ã¤ã«ã®åå¨ãã§ãã¯ãè¡ã creates ãªãã·ã§ã³ ã使ç¨ãã¦ããã®ã§ãä¸åº¦ã¤ã³ã¹ãã¼ã«ãçµãã£ãã次ã®åããã¯ã¹ããããããã
- ATOK æ´¾ãªã®ã§
google-japanese-ime
ãå ¥ãã¦ããªã - Emacs æ´¾ãªã®ã§
vim
(ry - Emacs ã¯
railwaycat/emacsmacport
ã tap ã«å ã㦠homebrew-cask 㧠emacs-mac-port ãã¤ã³ã¹ãã¼ã«ãã¦ããã - ansible ã§å®è¡ããã¨ã homebrew ã使ã£ã¦ãã人ã«ã¯ããªãã¿ã®
brew install
å¾ã®åºåããªãã®ã§ä¸å®ãè¦ããããã®åºåå 容ã¯brew info
ã§è¦ããã®ã§ããã¡ã¤ã«ã«ãã³ããã¦ãã(æ¬å½ã¯ã¤ã³ã¹ãã¼ã«æã®æ¨æºåºåããã¡ã¤ã«ã«åºãã¦ããããã詳ãã人æãã¦ãã ãã)ã - (3/24 追è¨) mawatari ããã« ãã«ãªã¯ã¨ã¹ãããã ã㦠ããã¤ãã®åé¡ç¹ãä¿®æ£ãã¾ããã mawatari ãããããã¨ããããã¾ã! åè: Homebrewã¨Ansibleã§Macã®éçºç°å¢æ§ç¯ãèªååãã | mawatari.jp
homebrew-cask ã®ä¸å®ãªç¹ã«ã¤ãã¦
ä»å homebrew ã ãã§ãªã homebrew-cask ã使ãã¢ããªã±ã¼ã·ã§ã³ã®ã¤ã³ã¹ãã¼ã«ã¾ã§èªååãããããã¾ãåããªããã®ãéåæãè¦ãããã®ããããã¨ãè¨ãã¦ããããã¨ãã° Chrome ã® info ã«ã¯æ¬¡ã®ããã«åºã¦ããã
$ brew cask info google-chrome google-chrome: latest google-chrome https://www.google.com/chrome/ /opt/homebrew-cask/Caskroom/google-chrome/latest (389 files, 367M) https://github.com/caskroom/homebrew-cask/blob/master/Casks/google-chrome.rb ==> Contents Google Chrome.app (app) ==> Caveats The Mac App Store version of 1Password won't work with a Homebrew-Cask-linked Google Chrome. To bypass this limitation, you need to either: + Move Google Chrome to your /Applications directory (the app itself, not a symlink). + Install 1Password from outside the Mac App Store (licenses should transfer automatically, but you should contact AgileBits about it). $
ãããå®éã«ä½¿ã£ã¦ã¿ã㨠Max App Store ã§å ¥ãã 1Password ã¨çµã¿åããã¦ãæå¾ éãåããããã¦ããã®ã§ãå®éã«ãã£ã¦ã¿ãªãã¨ä½ã¨ããããªãã¨ãããããã®ãããããªããä»ã«ã調ã¹ã¦ã¿ã㨠homebrew-cask ã§ãã¾ãåããã«ä½¿ãã®ããããããããã¯ãã¦éç¨ã§åé¿ããçã¯ãããããããªã®ã§ãä¸è¨ãªã³ã¯ã¯åèã«ãªã£ã(ç§ã®å ´åå ¥ãã¦ãã¾ã£ãå¾ãªã®ã ã)
- homebrew-caskã§ããããã㨠- Qiita
- homebrew-caskã使ããã¨ãã¦ãããã話 - Wakotech Blog
å ¥ããã¢ããªã«ãããã ããããã¾ã ã¾ã ãã¾ããããªãã¨ãããããã®ã ããããã®ãããã¯èªå·±è²¬ä»»ã¨ãªãããã ã
ghq + peco
ä»äºã§ãå人ã§ã大éã®ã½ã¼ã¹ã³ã¼ãã®èªã¿æ¸ããæå ã§çµ±ä¸çã«æ±ãããã®ã§ ghq ãå ¥ããããã£ã¬ã¯ããªæ§æãããã®æ©ä¼ã« lestrrat / antipop / miyagawa æ¹å¼ã«ããã
- ghq + peco/percol
- ghqã使ã£ããã¼ã«ã«ãªãã¸ããªã®çµ±ä¸çã»å¹ççãªç®¡çã«ã¤ã㦠- delirious thoughts
- pecoãghqãgh-openã®çµã¿åãããæã - Webtech Walker
ã¾ã .zshrc ã«ä»¥ä¸ã®è¨å®ã追å
export GOPATH=$HOME export PATH=$PATH:$GOPATH/bin
ghq ãã¤ã³ã¹ãã¼ã«
go get github.com/motemen/ghq
以ä¸ã®ã³ãã³ã㧠.gitconfig ã«è¨å®ã追å
git config --global user.name "ã¦ã¼ã¶ã¼å" git config --global user.email "ã¡ã¼ã«ã¢ãã¬ã¹" git config --global ghq.root "~/src"
ããã§
cd $(ghq list -p | peco)
ãããã
ghq get twada/power-assert
ãããã§ããããã«ãªã£ããããã¯æãï¼ï¼
ãããã«
ãã¨ã¯ç§ä¼ã®ã¿ã¬ç³»ã® dotfiles ãæã£ã¦ãããããã°çµããããã ããã dotfiles ããã®éã«ææ¨é¢ããæ¹ãè¯ãããªã¨æã£ã¦ããã
ããã¾ã§æ¸ãã¦ãããªã¬ãªã¬ shell ã¹ã¯ãªããçã«æ¯ã¹ãã¨ããã¯ãåªçæ§ã®ãããããã¸ã§ãã³ã°ãã¼ã«ã¯äºå¨ç®ä»¥éã«å¼·ãã¨æãããåªçæ§ãããã¨ãè¨å®ã«æ¸ãããç¶æ ã«åãã£ã¦åæããããã«åä½ããããã®ç¿æ§ããã¼ã«ã«ã®éçºç°å¢æ§ç¯ã«ã使ããã¨ããã®ã¯ç²ç¹ã ã£ããä»åä½æããä»çµã¿ã¯ä½åã§ãèµ°ãããããã®ã§ã追å ãããããã±ã¼ã¸ãããã¨ãã¯è¿½è¨ãã¦å®è¡ããã°ãããããã§ãªãã¨ãå®æçã«å®è¡ãã¦ããã°ç°å¢ãæ°ãããã¦ãããã®ã§ãããªã便å©ã ã
ã¨ãããã¨ã§ã
Mac ã®éçºç°å¢æ§ç¯èªååã«ãããå®çªã§ãã Brewfile ããªã¯ã³ã³ã«ãªã£ã¦ããã Ansible ã使ã£ã¦ã¾ãã¾ãèªååã§ãã話
ã§ããã