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

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

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

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

Ruby

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

SQLite

SQLiteはリレーショナルデータベース管理システムの1つで、サーバーではなくライブラリとして使用されている。

Q&A

解決済

1回答

487閲覧

Ruby on Railsにsqliteがインストールできないことについて

springer

総合スコア24

Ruby on Rails 5

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

Ruby

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

SQLite

SQLiteはリレーショナルデータベース管理システムの1つで、サーバーではなくライブラリとして使用されている。

0グッド

0クリップ

投稿2018/05/30 07:22

前提・実現したいこと

Ruby on railsのチュートリアルを行っています。
rails newを実行する際にSQLite3をインストールすることができません。

どなたかご教示いただけますでしょうか。
よろしくお願い致します。

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

$ rails 5.1.4 new hello_app

Installing sqlite3 1.3.13 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /private/var/folders/x8/3rxt40rn6233kg9tqhdgty4w0000gp/T/bundler20180530-69462-oencyxsqlite3-1.3.13/gems/sqlite3-1.3.13/ext/sqlite3 /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20180530-69462-18gvz1g.rb extconf.rb checking for sqlite3.h... yes checking for pthread_create() in -lpthread... yes checking for sqlite3_libversion_number() in -lsqlite3... no sqlite3 is missing. Try 'brew install sqlite3', 'yum install sqlite-devel' or 'apt-get install libsqlite3-dev' and check your shared library search path (the location where your sqlite3 shared library is located). *** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME) --with-sqlite3-config --without-sqlite3-config --with-pkg-config --without-pkg-config --with-sqlite3-dir --without-sqlite3-dir --with-sqlite3-include --without-sqlite3-include=${sqlite3-dir}/include --with-sqlite3-lib --without-sqlite3-lib=${sqlite3-dir}/lib --with-pthreadlib --without-pthreadlib --with-sqlite3lib --without-sqlite3lib To see why this extension failed to compile, please check the mkmf.log which can be found here: /var/folders/x8/3rxt40rn6233kg9tqhdgty4w0000gp/T/bundler20180530-69462-oencyxsqlite3-1.3.13/extensions/universal-darwin-17/2.3.0/sqlite3-1.3.13/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /var/folders/x8/3rxt40rn6233kg9tqhdgty4w0000gp/T/bundler20180530-69462-oencyxsqlite3-1.3.13/gems/sqlite3-1.3.13 for inspection. Results logged to /var/folders/x8/3rxt40rn6233kg9tqhdgty4w0000gp/T/bundler20180530-69462-oencyxsqlite3-1.3.13/extensions/universal-darwin-17/2.3.0/sqlite3-1.3.13/gem_make.out An error occurred while installing sqlite3 (1.3.13), and Bundler cannot continue. Make sure that `gem install sqlite3 -v '1.3.13'` succeeds before bundling. In Gemfile: sqlite3 run bundle exec spring binstub --all bundler: command not found: spring Install missing gem executables with `bundle install`

試したこと、考えたこと

1.bundle install
エラーメッセージにあるようにbundle installを行いましたが、結果は上記と同じでした。

  1. brew install sqlite3
Updating Homebrew... ==> Auto-updated Homebrew! Updated 2 taps (homebrew/core, homebrew/cask). ==> Updated Formulae node ✔ emscripten gtk-mac-integration quicktype angular-cli ghc libgit2 rust chaiscript gimme packer skafos Warning: sqlite 3.23.1 is already installed and up-to-date To reinstall 3.23.1, run `brew reinstall sqlite`

brew reinstall sqlite

==> Reinstalling sqlite ==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.23.1.high_sierra.bottle.tar.gz Already downloaded: /Users/yarumaya0822/Library/Caches/Homebrew/sqlite-3.23.1.high_sierra.bottle.tar.gz ==> Pouring sqlite-3.23.1.high_sierra.bottle.tar.gz ==> Caveats This formula is keg-only, which means it was not symlinked into /usr/local, because macOS provides an older sqlite3. If you need to have this software first in your PATH run: echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.zshrc For compilers to find this software you may need to set: LDFLAGS: -L/usr/local/opt/sqlite/lib CPPFLAGS: -I/usr/local/opt/sqlite/include For pkg-config to find this software you may need to set: PKG_CONFIG_PATH: /usr/local/opt/sqlite/lib/pkgconfig ==> Summary ???? /usr/local/Cellar/sqlite/3.23.1: 11 files, 3MB

気になること

  • which rubyとうつと/usr/bin/rubyと出ます。調べると/usr/local/bin以下に通さないといけないみたいで、そこが関係あるのかなと思いました。

  • installされているsqliteのバージョンは3.23.1だが、railsのプロジェクトにインストールしようとしているバージョンは1.3.13なのはうまくいかない理由なのかなと思いました。

不足事項がありましたらご指摘いただけますと幸いです。
どうぞよろしくお願い致します。

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

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

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

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

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

guest

回答1

0

ベストアンサー

このバグのようですね

export ARCHFLAGS="-arch x86_64"

が解決策として挙がっています。

投稿2018/05/30 08:57

asm

総合スコア15147

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

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

springer

2018/05/30 14:23

ありがとうございます。 解決しました。 こちらのサイトをじっくり読んでみます。 半日ぐらい悩んでいたので本当に助かりました。 ありがとうございます!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問