読者です 読者をやめる 読者になる 読者になる

c-bata web

@c_bata_ のメモ。python多め

HomeBrewでMacの環境構築 (追記@2016/1/8: 古くなってたのでbrew bundleを使うやり方に更新)

Macソフトウェア導入

きっかけ

BoxenはPuppetfileの書き方覚えないといけなかったり、一人で使うには結構面倒らしい。 以下のページを参考。

確かにhomebrew-caskとかを使ったほうがシンプルで自分に向いてそう。

やったこと (追記@2016/1/8: これより下は結構変わっていたので更新)

GitHub - Homebrew/homebrew-bundle: Bundler for non-Ruby dependencies from Homebrew を使う。

XCodeまわり

$ sudo xcodebuild -license
$ xcode-select --install

Homebrewをインストール

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew doctor
$ brew update
$ brew tap Homebrew/bundle

brew bundleによるインストール

移行前のPCで $ brew bundle dump してできたBrewfileを新しい環境に持ってきて、 brew bundle$ brew bundle dump の結果は以下のようになった。

tap 'c-bata/pym'
tap 'caskroom/cask'
tap 'caskroom/versions'
tap 'homebrew/binary'
tap 'homebrew/bundle'
tap 'peco/peco'
tap 'sanemat/font'
brew 'autoconf'
brew 'icu4c'
brew 'boost'
brew 'xz'
brew 'pkg-config'
brew 'libpng'
brew 'freetype'
brew 'fontconfig'
brew 'pixman'
brew 'gettext'
brew 'libffi'
brew 'glib'
brew 'cairo'
brew 'libsodium'
brew 'zeromq'
brew 'czmq'
brew 'dnsmasq'
brew 'libtool'
brew 'pcre'
brew 'git'
brew 'gobject-introspection'
brew 'harfbuzz'
brew 'pango'
brew 'jpeg'
brew 'libtiff'
brew 'fontforge'
brew 'gmp'
brew 'mpfr'
brew 'libmpc'
brew 'isl'
brew 'gcc'
brew 'gdbm'
brew 'go'
brew 'gradle'
brew 'heroku-toolbelt'
brew 'lua'
brew 'highlight'
brew 'httpie'
brew 'imagemagick'
brew 'oniguruma'
brew 'jq'
brew 'openssl'
brew 'libevent'
brew 'mercurial'
brew 'mongodb'
brew 'node'
brew 'peco'
brew 'readline'
brew 'postgresql'
brew 'ruby-build'
brew 'rbenv'
brew 'redis'
brew 'rmtrash'
brew 'sqlite'
brew 'tmux'
brew 'tree'
brew 'wget'
brew 'zsh'
brew 'c-bata/pym/pym'
brew 'caskroom/cask/brew-cask'
brew 'sanemat/font/ricty'
cask 'appcleaner'
cask 'bettertouchtool'
cask 'coteditor'
cask 'genymotion'
cask 'google-drive'
cask 'google-japanese-ime'
cask 'intellij-idea-ce'
cask 'iterm2'
cask 'java'
cask 'java7'
cask 'macdown'
cask 'macvim'
cask 'skim'
cask 'skype'
cask 'sourcetree'
cask 'texshop'
cask 'vagrant'
cask 'virtualbox'

以前はdotfilesでBrewfileを管理していたんですが、やめた。毎回必要になったらbrew bundle dumpする。

HomeBrewの普段使わないオプション

brew infobrew switch

$ brew info node
node: stable 6.2.0 (bottled), HEAD
Platform built on the V8 JavaScript runtime to build network applications
https://nodejs.org/
/usr/local/Cellar/node/5.0.0 (2,942 files, 28.7M)
  Poured from bottle on 2015-10-30 at 07:30:57
/usr/local/Cellar/node/5.4.0 (2,837 files, 34.4M)
  Poured from bottle on 2016-01-08 at 20:58:32
/usr/local/Cellar/node/5.6.0 (3,739 files, 35.5M)
  Poured from bottle on 2016-02-20 at 13:01:45
/usr/local/Cellar/node/5.10.1 (3,663 files, 35.7M) *
  Poured from bottle on 2016-04-16 at 14:04:32
/usr/local/Cellar/node/6.2.0 (3,979 files, 40.3M)
  Poured from bottle on 2016-05-27 at 11:23:27
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/node.rb
==> Dependencies
Build: xz ✔, pkg-config ✔
Optional: openssl ✔
==> Options
--with-debug
    Build with debugger hooks
--with-full-icu
    Build with full-icu (all locales) instead of small-icu (English only)
--with-openssl
    Build with openssl support
--without-completion
    npm bash completion will not be installed
--without-npm
    npm will not be installed
--HEAD
    Install HEAD version
==> Caveats
Please note by default only English locale support is provided. If you need
full locale support you should either rebuild with full icu:
  `brew reinstall node --with-full-icu`
or add full icu data at runtime following:
  https://github.com/nodejs/node/wiki/Intl#using-and-customizing-the-small-icu-build

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

切り替えるには

$ brew switch node 5.10.1
Cleaning /usr/local/Cellar/node/5.0.0
Cleaning /usr/local/Cellar/node/5.10.1
Cleaning /usr/local/Cellar/node/5.4.0
Cleaning /usr/local/Cellar/node/5.6.0
Cleaning /usr/local/Cellar/node/6.2.0
7 links created for /usr/local/Cellar/node/5.10.1
$ node --version
v5.10.1