1年ぶりにbrew updateした時のメモ
どんな時のため
きっかけ
開発はVagrantでしたりするけど、ローカルでサクッとrubyの動作をチェックしたいときに、rubyのバージョンを変更しようと、 brew upgrade rbenv ruby-build
をしようと思ったら、エラーとなった
手順概要
- brew updateとupgrade
- rbenvのupdate
- bundler のupdate
brew updateとupgrade
$ brew update Error: The /usr/local directory is not writable. Even if this directory was writable when you installed Homebrew, other software may change permissions on this directory. Some versions of the "InstantOn" component of Airfoil are known to do this. You should probably change the ownership and permissions of /usr/local back to your user account. sudo chown -R $(whoami):admin /usr/local Kernel.exit $ sudo chown -R $(whoami):admin /usr/local
$ brew update Could not restore untracked files from stash Error: Failure while executing: git stash pop $ cd /usr/local && git stash pop --quiet $ brew update $ brew upgrade rbenv ruby-build $ sudo chown root:wheel /usr/local
rbenvのupdate
- ruby 2.3.3をインストールする場合
$ rbenv install --list $ rbenv install 2.3.3 $ rbenv versions $ rbenv global 2.3.3 $ rbenv rehash $ ruby -v
bundler のupdate
- 特定バージョン以上のrubyをサポートしているgemをインストールする際に、なぜか
bundle install
時にエラーになった - bundlerが利用しているバージョンが違ったためのよう
rubyとbundlerのパスを確認
$ which ruby $ which bundle
違っている場合には以下を実行
$ rbenv exec gem install bundler $ rbenv rehash $ which bundle