Ruby on rails 正在使用Rails应用程序,但我的Mac OSX 10.6.8上缺少一些软件

Ruby on rails 正在使用Rails应用程序,但我的Mac OSX 10.6.8上缺少一些软件,ruby-on-rails,ruby,rvm,clang,Ruby On Rails,Ruby,Rvm,Clang,我是作为网络开发课程的一部分来学习的,所以我相信我以后会完全理解每一部分的作用,但现在我只是按照它所说的去做,并根据我所知道的去弄清楚我能做的一切。上一章(创建一个应用程序)是成功的,但现在我却遇到了挫折。我无法编辑该行,因为它不存在。这是Gemfile,在TextEdit中查看: source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails',

我是作为网络开发课程的一部分来学习的,所以我相信我以后会完全理解每一部分的作用,但现在我只是按照它所说的去做,并根据我所知道的去弄清楚我能做的一切。上一章(创建一个应用程序)是成功的,但现在我却遇到了挫折。我无法编辑该行,因为它不存在。这是
Gemfile
,在TextEdit中查看:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use jdbcsqlite3 as the database for Active Record
gem 'activerecord-jdbcsqlite3-adapter'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyrhino'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
应用程序运行良好,服务器运行良好(尽管它不一定要为此运行,所以我猜它没有那么重要)。这本指南很可能有问题,但它是什么?现在构建它有什么意义吗?或者我应该继续学习,等我对Rails和Ruby本身有了更多的了解后再继续学习它吗

编辑:我在
Gemfile
的末尾添加了这些行,并运行了
bundle安装
(谢谢@antar-Byrd!),但我收到了一条错误消息。我正在发布整个日志,以防万一:

Mac-2:test_app mac$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies.............
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.5.1
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.1
Using builder 3.2.2
Using erubis 2.7.0
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.6
Using loofah 2.0.1
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.1
Using rack 1.6.0
Using rack-test 0.6.3
Using actionpack 4.2.1
Using globalid 0.3.3
Using activejob 4.2.1
Using mime-types 2.4.3
Using mail 2.6.3
Using actionmailer 4.2.1
Using activemodel 4.2.1
Using arel 6.0.0
Using activerecord 4.2.1
Using activerecord-jdbc-adapter 1.3.15
Using jdbc-sqlite3 3.8.7
Using activerecord-jdbcsqlite3-adapter 1.3.15
Using bundler 1.9.1
Using coffee-script-source 1.9.1
Using execjs 2.4.0
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.2.1
Using coffee-rails 4.1.0
Using hike 1.2.3
Using multi_json 1.11.0
Using jbuilder 2.2.12
Using jquery-rails 4.0.3

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/mac/.rvm/rubies/jruby-1.7.19/bin/jruby -r ./siteconf20150329-367-1xqntht.rb extconf.rb 
NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS.

   (root) at /Users/mac/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/mkmf.rb:8
  require at org/jruby/RubyKernel.java:1071
   (root) at /Users/mac/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1
   (root) at extconf.rb:2

extconf failed, uncaught signal 1

Gem files will remain installed in /Users/mac/.rvm/gems/jruby-1.7.19/gems/pg-0.18.1 for inspection.
Results logged to /Users/mac/.rvm/gems/jruby-1.7.19/extensions/universal-java-1.6/1.9/pg-0.18.1/gem_make.out
An error occurred while installing pg (0.18.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.1'` succeeds before bundling.
gem安装pg-v'0.18.1'
也给我带来了麻烦

Mac-2:test_app mac$ gem install pg -v '0.18.1'
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /Users/mac/.rvm/rubies/jruby-1.7.19/bin/jruby -r ./siteconf20150329-383-1d9a2xw.rb extconf.rb
NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS.

   (root) at /Users/mac/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/mkmf.rb:8
  require at org/jruby/RubyKernel.java:1071
   (root) at /Users/mac/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1
   (root) at extconf.rb:2

extconf failed, uncaught signal 1

Gem files will remain installed in /Users/mac/.rvm/gems/jruby-1.7.19/gems/pg-0.18.1 for inspection.
Results logged to /Users/mac/.rvm/gems/jruby-1.7.19/extensions/universal-java-1.6/1.9/pg-0.18.1/gem_make.out
我被这些错误信息难住了。如果有人能至少解释一下发生了什么以及如何修复它,我会非常感激

编辑2:我尝试将Ruby更新到2.2,它说我需要clang 3.0或更高版本,我确实有。这与我今天早些时候尝试安装Python3时遇到的问题相同,但我仍然不知道我做错了什么

Mac-2:~ mac$ rvm install 2.2
ruby-2.2.0 - #removing src/ruby-2.2.0..
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.6/i386/ruby-2.2.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx_brew.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/mac/.rvm/rubies/ruby-2.2.0, this may take a while depending on your cpu(s)...
ruby-2.2.0 - #downloading ruby-2.2.0, this may take a while depending on your connection...
ruby-2.2.0 - #extracting ruby-2.2.0 to /Users/mac/.rvm/src/ruby-2.2.0....
ruby-2.2.0 - #applying patch /Users/mac/.rvm/patches/ruby/2.2.0/fix_installing_bundled_gems.patch.
ruby-2.2.0 - #configuring.
Error running './configure --prefix=/Users/mac/.rvm/rubies/ruby-2.2.0 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --disable-install-doc --enable-shared',
showing last 15 lines of /Users/mac/.rvm/log/1427607081_ruby-2.2.0/configure.log
[2015-03-29 02:31:46] ./configure
current path: /Users/mac/.rvm/src/ruby-2.2.0
GEM_HOME=/Users/mac/.rvm/gems/jruby-1.7.19
PATH=/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/mac/.rvm/gems/jruby-1.7.19/bin:/Users/mac/.rvm/gems/jruby-1.7.19@global/bin:/Users/mac/.rvm/rubies/jruby-1.7.19/bin:/usr/local/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin/python:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/X11/bin:/Users/mac/.rvm/bin
GEM_PATH=/Users/mac/.rvm/gems/jruby-1.7.19:/Users/mac/.rvm/gems/jruby-1.7.19@global
command(5): ./configure --prefix=/Users/mac/.rvm/rubies/ruby-2.2.0 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --disable-install-doc --enable-shared
config.guess already exists
config.sub already exists
checking build system type... i386-apple-darwin10.8.0
checking host system type... i386-apple-darwin10.8.0
checking target system type... i386-apple-darwin10.8.0
i686-apple-darwin10-gcc-4.2.1: error trying to exec 'cc1': execvp: No such file or directory
configure: error: clang version 3.0 or later is required
There has been an error while running configure. Halting the installation.
Mac-2:~ mac$ ruby -v
jruby 1.7.19 (1.9.3p551) 2015-01-29 20786bd on Java HotSpot(TM) 64-Bit Server VM 1.6.0_65-b14-462-10M4609 +jit [darwin-x86_64]
Mac-2:~ mac$ which clang
/usr/bin/clang
Mac-2:~ mac$ clang -v
Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin10.8.0
Thread model: posix
编辑3:修复了它,而无需更新LLVM或Clang或任何东西。我只是摆脱了jruby,改用Ruby 2.2

Mac-2:rubies mac$ rm -rf jruby-1.7.19/
Mac-2:rubies mac$ brew install ruby
Mac-2:test_app mac$ gem install pg -v '0.18.1'
Mac-2:test_app mac$ bundle install

尽管我对Heroku本身有一些问题,但这是成功的,所以我接受了Antar Byrd的答案。

只需将其添加到您的Gemfile中,然后进行
捆绑安装即可。

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use jdbcsqlite3 as the database for Active Record
gem 'activerecord-jdbcsqlite3-adapter'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyrhino'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

group :development, :test do
  gem 'sqlite3'
end

group :production do
  gem 'pg'
  gem 'rails_12factor'
end

如果数据库是sqlite,则需要添加

group :development, :test do
  gem 'sqlite3'
end

group :production do
  gem 'pg'
  gem 'rails_12factor'
end

如果是mysql,只需将gem“sqlite3”替换为gem“mysql2”

几个注意事项/问题/想法:

1) 您的问题主题暗示这与Heroku有关,但您的所有日志/输出都来自本地Mac。应该编辑以反映未来的答案寻求者


2) 您正在使用JRuby 1.7运行,对于第一个应用程序来说,这是一个有点奇怪的选择。看看你说你在关注的Railsbridge文档,他们让你使用Ruby 2.2,这是一个更常见的平台。我会按照他们的指南安装2.2版本的RVM,然后再试一次。

我收到一条错误消息,这很奇怪,因为我认为你的答案很有道理。我会在一分钟后发布日志。修复了标题,我现在要看看它是否适用于2.2。谢谢。关于未能建立pg gem-你有安装postgres吗?(例如,通过自制?)我安装了它,但我收到了相同的错误消息。我不知道我是否有任何他们认为我刚刚开始与此。这两条线都不起作用。