LoginSignup
0
0

More than 1 year has passed since last update.

Ruby on railsインストール opensslでハマった話※Mac

Last updated at Posted at 2022-11-22

1.rbenvインストール

brew install rbenv
rbenv install 3.1.2

テスト用フォルダ作成

mkdir ~/ruby-test
cd ~/ruby-test

テストフォルダへruby反映

rbenv local 3.1.2
rbenv rehash  

反映確認

ruby -v

rails インストール※bundlerはインストール済み

gem install rails

しかし、、

ERROR:  While executing gem ... (Gem::Exception)
    OpenSSL is not available. Install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources

opensslが利用できないとのことなので

brew link openssl --force

しかし、

Warning: Refusing to link macOS provided/shadowed software: openssl@3
If you need to have openssl@3 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/openssl@3/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@3 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@3/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@3/include"

For pkg-config to find openssl@3 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig"

言う通りに実行

echo 'export PATH="/usr/local/opt/openssl@3/bin:$PATH"' >> ~/.zshrc
export LDFLAGS="-L/usr/local/opt/openssl@3/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@3/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig"

再度実行するが変わらない。。

brew link openssl --force

Warning: Refusing to link macOS provided/shadowed software: openssl@3
If you need to have openssl@3 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/openssl@3/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@3 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@3/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@3/include"

For pkg-config to find openssl@3 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig"

色々試したがわからなかったので、再度rubyインストール

rbenv install 3.1.2

別ディレクトリを作成

mkdir ruby-test2
cd ruby-test2

今度はディレクトリ指定ではなく、globalにしrailsインストール

rbenv global 3.1.2
gem install rails 

おっ!

Fetching thor-1.2.1.gem
Fetching method_source-1.0.0.gem
Fetching concurrent-ruby-1.1.10.gem
Fetching tzinfo-2.0.5.gem
Fetching i18n-1.12.0.gem
・
・
・
Installing ri documentation for rails-7.0.4
Done installing documentation for zeitwerk, thor, method_source, concurrent-ruby, tzinfo, i18n, activesupport, nokogiri, crass, loofah, rails-html-sanitizer, rails-dom-testing, rack, rack-test, erubi, builder, actionview, actionpack, railties, mini_mime, marcel, activemodel, activerecord, globalid, activejob, activestorage, actiontext, mail, actionmailer, actionmailbox, websocket-extensions, websocket-driver, nio4r, actioncable, rails after 45 seconds
35 gems installed

インストールできた!

原因は特定できていないけど、一旦これでテストアプリ開発しようと思います。

。。。続く

0
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
0
0