LoginSignup
2
0

More than 1 year has passed since last update.

icu4cがアップデートされ、rbenvが起動しなくなった時の対処

Last updated at Posted at 2022-04-04

エラー内容

ある時、何気なくrails sとして、railsサーバーを起動した際に以下のようなエラーが発生しました。

Library not loaded: /opt/homebrew/opt/icu4c/lib/libicudata.69.dylib

原因

どうやらicu4cのバージョンがbrewをいじっている間に勝手に上がってしまい、エラーになったようです。
実際、rbenvが見ているバージョンが69なのに対し、70となっていました。

$ brew info icu4c
icu4c: stable 70.1 (bottled) [keg-only]

実際/opt/homebrew/opt/icu4c/libの中身を見てみると、

$ ls /opt/homebrew/opt/icu4c/lib
libicui18n.70.dylib ... ←バージョンが70になっている。

対処

参考文献のicu4c がバージョンアップされたせいでphpが動作しなくなったときの解決策をもとにicu4cをダウングレードしました。
一部、ファイルがインストールされているパスが異なり変えた場所があるので、あとからわかるようにメモを残します。

以下のようにしてコマンドを操作して対処しました。

# Formulaに移動
# homebrew/Libraryから以下は一緒だが、そこまでのパスが異なるので、調べる必要があり
$ cd /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula

# バージョンが変わるコミットを探す
$ git log --oneline icu4c.rb
commit *************
Author: ************
Date:   ************

    icu4c 70.1

    * icu4c 70.1
    * icu4c: update 70.1 bottle.

commit ************* ←ここのコミットIDをコピーする
Author: ************
Date:   ************

    icu4c: update 69.1 bottle. ←バージョンが69になっている

commit ************
Author: ************
Date:   ************

    icu4c: update 69.1 bottle.


# コミットを戻す
$ git checkout *********(先程コピーしたコミットID) icu4c.rb

# icu4cをインストールし直す
$ brew reinstall icu4c

ここまでやると、以下のようにicu4cのバージョンが69に戻っています。

# バージョンの確認
$ brew info icu4c
icu4c: stable 69.1 (bottled) [keg-only] ← 69となっている

# icu4cの中身のバージョンが変わっているか確認
$ ls /opt/homebrew/opt/icu4c/lib
libicui18n.69.dylib ← バージョンが69となっている

その後、rails sをすると、無事に起動できました。
Calling DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call DidYouMean.correct_error(error_name, spell_checker)' insteadとかrspecのときに大量のwarningを履いているけどとりあえず放置...

参考文献

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0