質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.51%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

RubyGems

RubyGemsはRubyによるプログラミングのためのパッケージマネジメントツールです。ユーザはこれを使用することで、Rubyライブラリのダウンロードやアップデートや、依存関係の自動解決が可能になります。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

4275閲覧

Ruby on Rails 環境構築の際に bundle installが使えず困っています

taro3014

総合スコア15

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

RubyGems

RubyGemsはRubyによるプログラミングのためのパッケージマネジメントツールです。ユーザはこれを使用することで、Rubyライブラリのダウンロードやアップデートや、依存関係の自動解決が可能になります。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2018/10/22 19:07

Ruby on Rails 環境構築の際に bundle initが使えません

初めに
rails: 5.2.1
ruby: 2.5.1
rbenv: 1.1.1
os: macOS Mojave

環境構築時にターミナル上で 'bundle install' を実行するとエラーが発生します

発生している問題・エラーメッセージ

$ bundle install --path vendor/bundle -j4 Fetching gem metadata from https://rubygems.org/.......... Fetching gem metadata from https://rubygems.org/. Resolving dependencies... Using rake 12.3.1 ~ Using activerecord 5.2.1 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/amaisuna/Desktop/test_app/vendor/bundle/ruby/2.5.0/gems/nokogiri-1.8.5/ext/nokogiri /Users/amaisuna/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20181023-9872-qzsad5.rb extconf.rb checking if the C compiler accepts ... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/Users/amaisuna/.rbenv/versions/2.5.1/bin/$(RUBY_BASE_NAME) --help --clean /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:574:in `block in try_compile' from /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:521:in `with_werror' from /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:574:in `try_compile' from extconf.rb:138:in `nokogiri_try_compile' from extconf.rb:162:in `block in add_cflags' from /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:632:in `with_cflags' from extconf.rb:161:in `add_cflags' from extconf.rb:410:in `<main>' To see why this extension failed to compile, please check the mkmf.log which can be found here: /Users/amaisuna/Desktop/test_app/vendor/bundle/ruby/2.5.0/extensions/x86_64-darwin-17/2.5.0-static/nokogiri-1.8.5/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /Users/amaisuna/Desktop/test_app/vendor/bundle/ruby/2.5.0/gems/nokogiri-1.8.5 for inspection. Results logged to /Users/amaisuna/Desktop/test_app/vendor/bundle/ruby/2.5.0/extensions/x86_64-darwin-17/2.5.0-static/nokogiri-1.8.5/gem_make.out An error occurred while installing nokogiri (1.8.5), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.8.5' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: rails was resolved to 5.2.1, which depends on actioncable was resolved to 5.2.1, which depends on actionpack was resolved to 5.2.1, which depends on actionview was resolved to 5.2.1, which depends on rails-dom-testing was resolved to 2.0.3, which depends on nokogiri Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/amaisuna/Desktop/test_app/vendor/bundle/ruby/2.5.0/gems/nio4r-2.3.1/ext/nio4r /Users/amaisuna/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20181023-9872-7v304t.rb extconf.rb checking for unistd.h... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/Users/amaisuna/.rbenv/versions/2.5.1/bin/$(RUBY_BASE_NAME) /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:590:in `try_cpp' from /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:1097:in `block in have_header' from /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:947:in `block in checking_for' from /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:350:in `block (2 levels) in postpone' from /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:320:in `open' from /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:350:in `block in postpone' from /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:320:in `open' from /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:346:in `postpone' from /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:946:in `checking_for' from /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/2.5.0/mkmf.rb:1096:in `have_header' from extconf.rb:14:in `<main>' To see why this extension failed to compile, please check the mkmf.log which can be found here: /Users/amaisuna/Desktop/test_app/vendor/bundle/ruby/2.5.0/extensions/x86_64-darwin-17/2.5.0-static/nio4r-2.3.1/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /Users/amaisuna/Desktop/test_app/vendor/bundle/ruby/2.5.0/gems/nio4r-2.3.1 for inspection. Results logged to /Users/amaisuna/Desktop/test_app/vendor/bundle/ruby/2.5.0/extensions/x86_64-darwin-17/2.5.0-static/nio4r-2.3.1/gem_make.out An error occurred while installing nio4r (2.3.1), and Bundler cannot continue. Make sure that `gem install nio4r -v '2.3.1' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: rails was resolved to 5.2.1, which depends on actioncable was resolved to 5.2.1, which depends on nio4r Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/amaisuna/Desktop/test_app/vendor/bundle/ruby/2.5.0/gems/websocket-driver-0.7.0/ext/websocket-driver /Users/amaisuna/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20181023-9872-vk74ic.rb extconf.rb creating Makefile current directory: /Users/amaisuna/Desktop/test_app/vendor/bundle/ruby/2.5.0/gems/websocket-driver-0.7.0/ext/websocket-driver make "DESTDIR=" clean xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun current directory: /Users/amaisuna/Desktop/test_app/vendor/bundle/ruby/2.5.0/gems/websocket-driver-0.7.0/ext/websocket-driver make "DESTDIR=" xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun make failed, exit code 1 Gem files will remain installed in /Users/amaisuna/Desktop/test_app/vendor/bundle/ruby/2.5.0/gems/websocket-driver-0.7.0 for inspection. Results logged to /Users/amaisuna/Desktop/test_app/vendor/bundle/ruby/2.5.0/extensions/x86_64-darwin-17/2.5.0-static/websocket-driver-0.7.0/gem_make.out An error occurred while installing websocket-driver (0.7.0), and Bundler cannot continue. Make sure that `gem install websocket-driver -v '0.7.0' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: rails was resolved to 5.2.1, which depends on actioncable was resolved to 5.2.1, which depends on websocket-driver

試したこと

$ gem install websocket-driver -v '0.7.0' --source 'https://rubygems.org/' ERROR: While executing gem ... (Errno::EACCES) Permission denied @ rb_sysopen - /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/websocket-driver-0.7.0/CHANGELOG.md
sudo gem install websocket-driver -v '0.7.0' --source 'https://rubygems.org/' Password: Building native extensions. This could take a while... ERROR: Error installing websocket-driver: ERROR: Failed to build gem native extension. current directory: /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/websocket-driver-0.7.0/ext/websocket-driver /Users/amaisuna/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20181023-10584-1x3vaa6.rb extconf.rb creating Makefile current directory: /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/websocket-driver-0.7.0/ext/websocket-driver make "DESTDIR=" clean xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun current directory: /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/websocket-driver-0.7.0/ext/websocket-driver make "DESTDIR=" xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun make failed, exit code 1 Gem files will remain installed in /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/websocket-driver-0.7.0 for inspection. Results logged to /Users/amaisuna/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-17/2.5.0-static/websocket-driver-0.7.0/gem_make.out

様々な文献を調べながら色々と試してみましたが,うまく実行されませんでした.
お力添えいただきますようお願いいたします.

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

つgem update --system
つxcode-select --install

投稿2018/10/22 22:14

hichon

総合スコア5737

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

taro3014

2018/10/22 22:25

すぐに解決しました!ありがとうございました!!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.51%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問