表題の件で困っており、投稿いたしました。
詰まっていること
rbenv install 2.7.5をinstallする際に以下のようなエラーが表示されてしまっていました。
% rbenv install 2.7.5 Downloading ruby-2.7.5.tar.bz2... -> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.5.tar.bz2 Installing ruby-2.7.5... ruby-build: using readline from homebrew BUILD FAILED (macOS 12.2.1 using ruby-build 20211124) Inspect or clean up the working tree at /var/folders/vc/187y8gb56xg50jr7ntbpd3cw0000gn/T/ruby-build.20220514102216.36117.rchhIk Results logged to /var/folders/vc/187y8gb56xg50jr7ntbpd3cw0000gn/T/ruby-build.20220514102216.36117.log Last 10 log lines: tool/config.guess already exists tool/config.sub already exists checking build system type... aarch64-apple-darwin21.3.0 checking host system type... aarch64-apple-darwin21.3.0 checking target system type... aarch64-apple-darwin21.3.0 checking whether the C compiler works... no configure: error: in `/var/folders/vc/187y8gb56xg50jr7ntbpd3cw0000gn/T/ruby-build.20220514102216.36117.rchhIk/ruby-2.7.5': configure: error: C compiler cannot create executables See `config.log' for more details make: *** No targets specified and no makefile found. Stop.
以下の記事を参考に、
https://github.com/rbenv/ruby-build/issues/1691
設定内容を以下のように書き換えました。
// Homebrew export PATH=/opt/homebrew/bin:$PATH export PATH="/opt/homebrew/sbin:$PATH" // rbenv export RBENV_ROOT=/opt/homebrew/opt/rbenv export PATH=$RBENV_ROOT/bin:$PATH eval "$(rbenv init -)" // openssl export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH" export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib" export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include" export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig" export RUBY_CONFIGURE_OPTS="--with-openssl-dir=/opt/homebrew/opt/openssl@1.1"
すると、rbenv install 2.7.5でinstallできたのですが
rails cを使用しようと以下のようにコマンドを押下すると
次にまた別のエラーが....
% bundle exec rails c /Users/Name/develop/project/api/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/dependencies.rb:332:in `require': dlopen(/Users/Name/develop/project/api/vendor/bundle/ruby/2.7.0/gems/puma-5.6.1/lib/puma/puma_http11.bundle, 0x0009): Library not loaded: /Users/Name/.rbenv/versions/2.7.5/lib/libruby.2.7.dylib (LoadError) Referenced from: /Users/Name/develop/project/api/vendor/bundle/ruby/2.7.0/gems/puma-5.6.1/lib/puma/puma_http11.bundle Reason: tried: '/Users/Name/.rbenv/versions/2.7.5/lib/libruby.2.7.dylib' (no such file), '/usr/local/lib/libruby.2.7.dylib' (no such file), '/usr/lib/libruby.2.7.dylib' (no such file) - /Users/Name/develop/project/api/vendor/bundle/ruby/2.7.0/gems/puma-5.6.1/lib/puma/puma_http11.bundle
installでき、一歩前進できたもののまた詰まっており、
このポイントも見た方が良いなどあればご教示いただけますと幸いです。
さらに追記
以下のエラーメッセージからPATHがおかしそうなので、以下を試してみました。
Library not loaded: /Users/Name/.rbenv/versions/2.7.5/lib/libruby.2.7.dylib
- /Users/Name/.rbenv/versions/の中身を見てみる
% ls [~/.rbenv/versions] 2.5.9/
2.5.9の元々入れていた古いものしか存在していません。
しかし、rbenv install 2.7.5でinstallはできています。
% rbenv versions system * 2.7.5 (set by /Users/Name/.ruby-version) % ruby -v ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [arm64-darwin21]
PATHを変更しないといけないことはわかったのですが
どこの設定を変えれば良いのかいまいち分からず手が止まっている状況です。。

回答1件
あなたの回答
tips
プレビュー