YosemiteにするとHomebrewが動かないらしい。というか動かない。


$ brew
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 23: /usr/local/Library/brew.rb: Undefined error: 0

こんなん出るので、色々とググるとyosemiteにすると動かないらしい。
下記の参考ページに設定方法があるので、1.8 -> Currentにすると動くようになる。

良かった。
参考:http://rrt.hateblo.jp/entry/2014/10/19/031312
 Mac の Vagrant 上に apache+passengerで仮想本番環境のRails4を作っていてどうにもエラーが出ていて困っていた。久々に起動してググると大した理由ではなかったのでメモ。

bundle install
すると以下の用になる

$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.2
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.6
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.6
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.6
Using mime-types 2.4.3
Using mail 2.6.1
Using actionmailer 4.1.6
Using activemodel 4.1.6
Using arel 5.0.1.20140414130214
Using activerecord 4.1.6

Errno::EACCES: Permission denied @ rb_sysopen - /home/vagrant/.anyenv/envs/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bcrypt-3.1.7/.gitignore
An error occurred while installing bcrypt (3.1.7), and Bundler cannot continue.
Make sure that `gem install bcrypt -v '3.1.7'` succeeds before bundling.

 Gemfileに以下の記述がある。結論から言うと bcryptのバージョンが3.1.7 ではなくて3.1.9にしないとインストール出来ないというものだった。
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'

変更
gem 'bcrypt', '~> 3.1.9'

で行けるようになると思うけど、実際には試行錯誤しているので以下の手順をたどった。

[vagrant@cakephp winds]$ gem install bcrypt
Fetching: bcrypt-3.1.9.gem (100%)
Building native extensions. This could take a while...
Successfully installed bcrypt-3.1.9
Parsing documentation for bcrypt-3.1.9
Installing ri documentation for bcrypt-3.1.9
Done installing documentation for bcrypt after 1 seconds
1 gem installed

ここでバージョンが違うことに気づいた。orz

[vagrant@cakephp winds]$ vi Gemfile
[vagrant@cakephp winds]$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
You have requested:
bcrypt ~> 3.1.9

The bundle currently has bcrypt locked at 3.1.7.
Try running `bundle update bcrypt`

バージョンがロックされてるしアップデートしろと

[vagrant@cakephp winds]$ bundle update bcrypt
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.2
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.6
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.6
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.6
Using mime-types 2.4.3
Using mail 2.6.1
Using actionmailer 4.1.6
Using activemodel 4.1.6
Using arel 5.0.1.20140414130214
Using activerecord 4.1.6
Using bcrypt 3.1.9 (was 3.1.7)
Using bundler 1.7.6
Using coffee-script-source 1.8.0
Using execjs 2.2.2
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.6
Using coffee-rails 4.0.1
Using orm_adapter 0.5.0
Using responders 1.0.0
Using warden 1.2.3
Using devise 3.4.0
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.2.3
Using jquery-rails 3.1.2
Using libv8 3.16.14.7
Using pg 0.17.1
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.2.0
Using rails 4.1.6
Using rdoc 4.1.2
Using ref 1.0.5
Using sass 3.2.19
Using sass-rails 4.0.3
Using sdoc 0.4.1
Using spring 1.1.3
Using therubyracer 0.12.1
Using turbolinks 2.4.0
Using uglifier 2.5.3
Your bundle is updated!
Gems in the group production were not installed.

以降はbundle install 通るようになった。
[vagrant@cakephp winds]$ bundle install
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.2
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.6
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.6
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.6
Using mime-types 2.4.3
Using mail 2.6.1
Using actionmailer 4.1.6
Using activemodel 4.1.6
Using arel 5.0.1.20140414130214
Using activerecord 4.1.6
Using bcrypt 3.1.9
Using coffee-script-source 1.8.0
Using execjs 2.2.2
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.6
Using coffee-rails 4.0.1
Using orm_adapter 0.5.0
Using responders 1.0.0
Using warden 1.2.3
Using devise 3.4.0
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.2.3
Using jquery-rails 3.1.2
Using libv8 3.16.14.7
Using pg 0.17.1
Using bundler 1.7.6
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.2.0
Using rails 4.1.6
Using rdoc 4.1.2
Using ref 1.0.5
Using sass 3.2.19
Using sass-rails 4.0.3
Using sdoc 0.4.1
Using spring 1.1.3
Using therubyracer 0.12.1
Using turbolinks 2.4.0
Using uglifier 2.5.3
Your bundle is complete!
Gems in the group production were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

とりあえず動くように成ったよと。
余り、資料がないので忘備録
 vagrant 上のCentos6の時刻がUTCで設定されているため、rails4の日時がずれるのを修正するためntpをインストールし設定。

 ファイルを変えないとJSTには変わらないのね。

ソース
# rm -f /etc/localtime && cp -p /usr/share/zoneinfo/Japan /etc/localtime


参考
http://www.shinobe.org/2013/07/02/centos%E3%81%AE%E3%82%BF%E3%82%A4%E3%83%A0%E3%82%BE%E3%83%BC%E3%83%B3%E3%81%AE%E5%A4%89%E6%9B%B4%E6%96%B9%E6%B3%95/
centos7が少し前に出たのが気になってました。でそろそろ共有サーバの入れ替えがしたいと思ってたので、入れて見ることにしました。
 でいきなりネットワークの設定ではまったのでメモ。

DNSの設定をインストール時に間違ったのが原因かつながらなかったので調べてみると以下のファイルが自動で書き変わらないのが原因のようでした。

/etc/resolve.conf

このファイルにDNSをちゃんと入れるとうまく行くようです。