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

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

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

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

Q&A

解決済

1回答

2308閲覧

rvmを削除して、rbenvを再インストールしたらrails serverが動かなくなってしまいました。

yoshi9n4

総合スコア7

Ruby on Rails

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

0グッド

0クリップ

投稿2016/06/20 11:19

プログラミング初心者です。
rails tutorialを進めており、初期の段階でrvmをいれてrubyのバージョン管理をしていたのですが、rvmを削除したらterminalでrails serverのコマンドが使えなくなってしまいました。

混乱してしまったので、rvenbも下記のコマンドを使い再インストールしました。
コレがいけなかったのでしょうか?
ご教授いただけたら幸いです。
お願い致します。

% rm -rf ~/.rbenv % rm -rf /usr/local/bin/rbenv % rm -rf /usr/local/Cellar/rbenv

以下が私のGemfileの設定です。

source 'https://rubygems.org' gem 'rails', '4.2.2' gem 'bootstrap-sass', '3.2.0.0' gem 'bcrypt', '3.1.7' gem 'sass-rails', '5.0.2' gem 'uglifier', '2.5.3' gem 'coffee-rails', '4.1.0' gem 'jquery-rails', '4.0.3' gem 'turbolinks', '2.3.0' gem 'jbuilder', '2.2.3' gem 'sdoc', '0.4.0', group: :doc group :development, :test do gem 'sqlite3', '1.3.9' gem 'byebug', '3.4.0' gem 'web-console', '2.0.0.beta3' gem 'spring', '1.1.3' gem 'minitest-reporters' end group :production do gem 'pg', '0.17.1' gem 'rails_12factor', '0.0.2' gem 'puma', '2.11.1' end

エラーメッセージが下記になります。

bundle

1Fetching gem metadata from https://rubygems.org/ 2Fetching version metadata from https://rubygems.org/ 3Fetching dependency metadata from https://rubygems.org/ 4Using rake 11.2.2 5Using i18n 0.7.0 6Using json 1.8.3 7Using minitest 5.9.0 8Using thread_safe 0.3.5 9Using builder 3.2.2 10Using erubis 2.7.0 11Using mini_portile2 2.1.0 12Using pkg-config 1.1.7 13Using rack 1.6.4 14Using mime-types-data 3.2016.0521 15Using arel 6.0.3 16Using ansi 1.5.0 17Using bcrypt 3.1.7 18Using debug_inspector 0.0.2 19Using sass 3.4.22 20Using columnize 0.9.0 21Using debugger-linecache 1.2.0 22Using slop 3.6.0 23Using coffee-script-source 1.10.0 24Using execjs 2.7.0 25Using thor 0.19.1 26Using concurrent-ruby 1.0.2 27Using multi_json 1.12.1 28Using ruby-progressbar 1.8.1 29 30 31Your user account isn't allowed to install to the system Rubygems. 32 You can cancel this installation and run: 33 34 bundle install --path vendor/bundle 35 36 to install the gems into ./vendor/bundle/, or you can enter your password 37 and install the bundled gems to Rubygems using sudo. 38 39 Password: 40Installing pg 0.17.1 with native extensions 41 42Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 43 44 current directory: /private/var/folders/zy/jy2_1r6n7g105mvl7q53z3wr0000gn/T/bundler20160620-84021-15rbwonpg-0.17.1/gems/pg-0.17.1/ext 45/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20160620-84021-dhbkom.rb extconf.rb --with-pg-config=/usr/pgsql-9.3/bin/pg_config 46Using config values from /usr/pgsql-9.3/bin/pg_config 47sh: /usr/pgsql-9.3/bin/pg_config: No such file or directory 48sh: /usr/pgsql-9.3/bin/pg_config: No such file or directory 49checking for libpq-fe.h... yes 50checking for libpq/libpq-fs.h... yes 51checking for pg_config_manual.h... yes 52checking for PQconnectdb() in -lpq... no 53checking for PQconnectdb() in -llibpq... no 54checking for PQconnectdb() in -lms/libpq... no 55Can't find the PostgreSQL client library (libpq) 56*** extconf.rb failed *** 57Could not create Makefile due to some reason, probably lack of necessary 58libraries and/or headers. Check the mkmf.log file for more details. You may 59need configuration options. 60 61Provided configuration options: 62 --with-opt-dir 63 --without-opt-dir 64 --with-opt-include 65 --without-opt-include=${opt-dir}/include 66 --with-opt-lib 67 --without-opt-lib=${opt-dir}/lib 68 --with-make-prog 69 --without-make-prog 70 --srcdir=. 71 --curdir 72 --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby 73 --with-pg 74 --without-pg 75 --with-pg-config 76 --with-pg-dir 77 --without-pg-dir 78 --with-pg-include 79 --without-pg-include=${pg-dir}/include 80 --with-pg-lib 81 --without-pg-lib=${pg-dir}/ 82 --with-pqlib 83 --without-pqlib 84 --with-libpqlib 85 --without-libpqlib 86 --with-ms/libpqlib 87 --without-ms/libpqlib 88 89To see why this extension failed to compile, please check the mkmf.log which can be found here: 90 91 /var/folders/zy/jy2_1r6n7g105mvl7q53z3wr0000gn/T/bundler20160620-84021-15rbwonpg-0.17.1/extensions/universal-darwin-15/2.0.0/pg-0.17.1/mkmf.log 92 93extconf failed, exit code 1 94 95Gem files will remain installed in /var/folders/zy/jy2_1r6n7g105mvl7q53z3wr0000gn/T/bundler20160620-84021-15rbwonpg-0.17.1/gems/pg-0.17.1 for inspection. 96Results logged to /var/folders/zy/jy2_1r6n7g105mvl7q53z3wr0000gn/T/bundler20160620-84021-15rbwonpg-0.17.1/extensions/universal-darwin-15/2.0.0/pg-0.17.1/gem_make.out 97Using bundler 1.12.5 98Using rails_serve_static_assets 0.0.5 99Using rails_stdout_logging 0.0.5 100Using tilt 1.4.1 101Using spring 1.1.3 102Using sqlite3 1.3.9 103Using rdoc 4.2.2 104Using tzinfo 1.2.2 105Using nokogiri 1.6.8 106Using rack-test 0.6.3 107Installing puma 2.11.1 with native extensions 108 109Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 110 111 current directory: /private/var/folders/zy/jy2_1r6n7g105mvl7q53z3wr0000gn/T/bundler20160620-84021-rtr08jpuma-2.11.1/gems/puma-2.11.1/ext/puma_http11 112/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20160620-84021-al1bw0.rb extconf.rb 113checking for BIO_read() in -lcrypto... yes 114checking for SSL_CTX_new() in -lssl... yes 115creating Makefile 116 117To see why this extension failed to compile, please check the mkmf.log which can be found here: 118 119 /var/folders/zy/jy2_1r6n7g105mvl7q53z3wr0000gn/T/bundler20160620-84021-rtr08jpuma-2.11.1/extensions/universal-darwin-15/2.0.0/puma-2.11.1/mkmf.log 120 121current directory: /private/var/folders/zy/jy2_1r6n7g105mvl7q53z3wr0000gn/T/bundler20160620-84021-rtr08jpuma-2.11.1/gems/puma-2.11.1/ext/puma_http11 122make "DESTDIR=" clean 123 124current directory: /private/var/folders/zy/jy2_1r6n7g105mvl7q53z3wr0000gn/T/bundler20160620-84021-rtr08jpuma-2.11.1/gems/puma-2.11.1/ext/puma_http11 125make "DESTDIR=" 126compiling http11_parser.c 127compiling io_buffer.c 128io_buffer.c:119:21: warning: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign] 129 return rb_str_new(b->top, b->cur - b->top); 130 ^~~~~~ 131/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/intern.h:674:29: note: passing argument to parameter here 132VALUE rb_str_new(const char*, long); 133 ^ 1341 warning generated. 135io_buffer.c:119:21: warning: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign] 136 return rb_str_new(b->top, b->cur - b->top); 137 ^~~~~~ 138/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/intern.h:674:29: note: passing argument to parameter here 139VALUE rb_str_new(const char*, long); 140 ^ 1411 warning generated. 142compiling mini_ssl.c 143In file included from mini_ssl.c:3: 144/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/backward/rubyio.h:2:2: warning: use "ruby/io.h" instead of "rubyio.h" [-W#warnings] 145#warning use "ruby/io.h" instead of "rubyio.h" 146 ^ 147mini_ssl.c:4:10: fatal error: 'openssl/bio.h' file not found 148#include <openssl/bio.h> 149 ^ 1501 warning and 1 error generated. 151make: *** [mini_ssl.o] Error 1 152 153make failed, exit code 2 154 155Gem files will remain installed in /var/folders/zy/jy2_1r6n7g105mvl7q53z3wr0000gn/T/bundler20160620-84021-rtr08jpuma-2.11.1/gems/puma-2.11.1 for inspection. 156Results logged to /var/folders/zy/jy2_1r6n7g105mvl7q53z3wr0000gn/T/bundler20160620-84021-rtr08jpuma-2.11.1/extensions/universal-darwin-15/2.0.0/puma-2.11.1/gem_make.out 157Using mime-types 3.1 158Using binding_of_caller 0.7.3.pre1 159Using bootstrap-sass 3.2.0.0 160Using byebug 3.4.0 161Using coffee-script 2.4.1 162Using uglifier 2.5.3 163Using sprockets 3.6.1 164Using minitest-reporters 1.1.9 165An error occurred while installing pg (0.17.1), and Bundler cannot continue. 166Make sure that `gem install pg -v '0.17.1'` succeeds before bundling. 167

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

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

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

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

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

guest

回答1

0

ベストアンサー

まずは、エラーメッセージをチェックしましょう。

checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)

と エラーがでているので、PostgreSQL のライブラリが、見つからないようです。

その次の行に「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.0/usr/bin/ruby --with-pg --without-pg --with-pg-config --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/ --with-pqlib --without-pqlib --with-libpqlib --without-libpqlib --with-ms/libpqlib --without-ms/libpqlib

あと、システムの ruby が、使われているようですが、使用する予定なのは、この ruby で正しいですか?

投稿2016/06/20 12:21

CHERRY

総合スコア25171

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

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

yoshi9n4

2016/06/20 12:26

迅速な回答ありがとうございます。 PostgresSQLのライブラリをオプションで指定するということでしょうか(??) $ rbenv versions system * 2.0.0-p648 (set by /Users/myname/.rbenv/version) で一応インストールしたrubyを指定したつもりなんですが、systemのrubyになってしまっていますね・・・。もう一度設定してみます!
CHERRY

2016/06/20 12:39 編集

gem install pg --with-pg-config=pg_configのパス という感じで、gem コマンドでインストールします。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問