覚え書き: Macの環境構築

(これまでの関連記事)

Macの環境構築のために、次のようなbrewfileを作って実行しました。

update || true
# tap repositories
tap caskroom/cask
tap homebrew/versions
tap homebrew/binary
# packages
install brew-cask
install curl || true
install git || true
install jq || true
install rbenv || true
install ruby-build || true
install tmux || true
install wget || true
install --disable-etcdir zsh || true
# cask packages
cask install alfred || true
cask install appcleaner || true
cask install clipmenu || true
cask install cyberduck || true
cask install java || true
cask install google-chrome || true
cask install hyperswitch || true
cask install iterm2 || true
cask install keyremap4macbook || true
cask install evernote || true
cask install scroll-reverser || true
cask install skitch || true
cask install skype || true
cask install sourcetree || true
cask install sublime-text || true
cask install the-unarchiver || true
cask install vagrant || true

インストールするアプリケーションは、次の記事を参考にしました。

発生した問題

その1: brew bundleはもう古い
$ brew bundle ~/brewfile
Warning: brew bundle is unsupported and will be replaced with another,
incompatible version at some point.
Please feel free volunteer to support it in a tap.

ガーン。まあまだ動いたけど。次の記事のように対応するのがよさそう。

その2: パスワード入力待ち

alfredとVagrantのインストール中に、OSユーザのパスワードを聞かれた。大した話じゃないけど、放置してると進まないので注意。

その3: keyremap4macbookのリネーム

keyremap4macbookbrew caskで入らなかった。

Error: No available cask for keyremap4macbook
Error: nothing to install

調べたら、名前がKarabinerに変わったとのこと。

KeyRemap4MacBook has been renamed to "Karabiner".

https://github.com/tekezo/Karabiner/blob/master/NEWS.md

次のようにしたらインストールできた。

$ brew cask install karabiner

==> Downloading https://pqrs.org/osx/karabiner/files/Karabiner-10.1.0.dmg

######################################################################## 100.0%

==> Running installer for karabiner; your password may be necessary.

==> Package installers may write to any location; options such as --appdir are i

Password:

==> installer: Package name is Karabiner 10.1.0

==> installer: Installing at base path /

==> installer: The install was successful.

==> Symlinking Binary 'warp-mouse-cursor-position' to '/usr/local/bin/warp-mouse

==> Symlinking Binary 'blueutil' to '/usr/local/bin/blueutil'

🍺 karabiner installed to '/opt/homebrew-cask/Caskroom/karabiner/10.1.0' (3.3M)

その4: ruby-buildの依存パッケージ

ruby-buildの依存パッケージであるpkg-configがすんなりと入らなかった。

...
==> Installing ruby-build dependency: pkg-config

==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/pkg-config-

###########################################################               82.3%

curl: (56) Recv failure: Connection reset by peer

Error: Failed to download resource "pkg-config"

Download failed:
https://downloads.sf.net/project/machomebrew/Bottles/pkg-config-0.28.mavericks.bottle.2.tar.gz

Warning: Bottle installation failed: building from source.

==> Downloading http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz


curl: (28) Resolving timed out after 5000 milliseconds

Trying a mirror...

==> Downloading http://fossies.org/unix/privat/pkg-config-0.28.tar.gz

######################################################################## 100.0%

curl: (22) The requested URL returned error: 410 Gone

Error: Failed to download resource "pkg-config"

Download failed: http://fossies.org/unix/privat/pkg-config-0.28.tar.gz
...

後からbrewコマンドを直接実行して、ruby-buildのインストールをもう一度試みたら、入った。

さっきはエラーだった場所からダウンロードできてる。依存関係の問題だったのかネットワークの問題だったのかは、調べてない。最初のリクエストはタイムアウトだからネットワークの問題か。410エラーになった方は消滅してたのかも。

$ brew install ruby-build

==> Installing ruby-build dependency: pkg-config

==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/pkg-config-

######################################################################## 100.0%

==> Pouring pkg-config-0.28.mavericks.bottle.2.tar.gz

🍺  /usr/local/Cellar/pkg-config/0.28: 10 files, 604K

==> Installing ruby-build

==> Downloading https://github.com/sstephenson/ruby-build/archive/v20140702.tar.

######################################################################## 100.0%

==> ./install.sh

🍺  /usr/local/Cellar/ruby-build/20140702: 122 files, 524K, built in 3 seconds

その他

zshを入れたので、csshコマンドでシェルをzshに変更。

$ brew doctor

Please note that these warnings are just used to help the Homebrew maintainers

with debugging if you file an issue. If everything you use Homebrew for is

working fine: please don't worry and just ignore them. Thanks!


Warning: /usr/bin occurs before /usr/local/bin

This means that system-provided programs will be used instead of those

provided by Homebrew. The following tools exist at both paths:


    git

    git-cvsserver

    git-receive-pack

    git-shell

    git-upload-archive

    git-upload-pack


Consider setting your PATH so that /usr/local/bin

occurs before /usr/bin. Here is a one-liner:

    echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile

というわけで、~/.zshenvに

export PATH=/usr/local/bin:$PATH

を追加。