在 Rails 应用程序上工作并在我的 Mac OSX 10.6.8 上缺少一些软件

Working on a Rails app and missing some software on my Mac OSX 10.6.8

我正在关注 this guide as part of a web development curriculum, so I'm sure I'll fully understand what each part does later on, but for now I'm just doing what it says and figuring out everything I can based on what I know. The previous chapter (creating an app) was a success, but now I've stumbled against this instruction。我无法编辑该行,因为它不存在。这是 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 install 的末尾添加了行(感谢@Antarr 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 install 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 或更高版本,我确实有。这与我今天早些时候尝试安装 Python 3 时遇到的问题相同,但我仍然无法弄清楚我做错了什么。

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 本身存在一些问题,但这是成功的,所以我接受 Antarr Byrd 的回答。

只需将它添加到您的 Gemfile 中并执行 bundle install

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'

一对notes/questions/ideas:

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

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