2

I recently had to uninstall rvm and then reinstall rvm and reinstall rails --

It appears that rails didn't install correctly because I can't launch rails s. I'm working with ruby 2.3.0, and ran sudo gem install rails to get the latest version of rails.

After installing and running bundle install and bundle update, I got this error

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tmpdir.rb:85:in `mkdir': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)

    Permission denied - ./.gem.20160330-64997-1erpjjg

Gem files will remain installed in /Users/chloe/.rvm/gems/ruby-2.3.0@global/gems/nokogiri-1.6.7.2 for inspection.
Results logged to /Users/chloe/.rvm/gems/ruby-2.3.0@global/extensions/universal-darwin-14/2.0.0/nokogiri-1.6.7.2/gem_make.out
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tmpdir.rb:85:in `block in mktmpdir'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tmpdir.rb:142:in `create'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tmpdir.rb:85:in `mktmpdir'
    from /Library/Ruby/Site/2.0.0/rubygems/ext/ext_conf_builder.rb:14:in `build'
    from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:161:in `block (2 levels) in build_extension'
    from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:160:in `chdir'
    from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:160:in `block in build_extension'
    from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:159:in `synchronize'
    from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:159:in `build_extension'
    from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
    from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:in `each'
    from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:in `build_extensions'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1436:in `block in build_extensions'
    from /Library/Ruby/Site/2.0.0/rubygems/user_interaction.rb:45:in `use_ui'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1434:in `build_extensions'
    from /Library/Ruby/Site/2.0.0/rubygems/stub_specification.rb:60:in `build_extensions'
    from /Library/Ruby/Site/2.0.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:68:in `block in require'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:67:in `each'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:67:in `find'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:67:in `require'
    from /Users/chloe/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/bin/rails:9:in `<top (required)>'
    from /usr/bin/rails:22:in `load'
    from /usr/bin/rails:22:in `<main>'

I tried using the solution from this question, but got 'apt-get command not found' --- but I apologize if this requires a similar solution!

I'm using Mac OSX

EDIT ****

after updating gems with gem update ---system, I have a new error message:

=> Booting WEBrick
=> Rails 4.1.4 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
/Users/chloe/sites/bookshelf/config/environment.rb:7:in `<top (required)>': undefined local variable or method `config' for main:Object (NameError)
    from /Users/chloe/sites/bookshelf/config.ru:3:in `require'
    from /Users/chloe/sites/bookshelf/config.ru:3:in `block in <main>'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `instance_eval'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `initialize'
    from /Users/chloe/sites/bookshelf/config.ru:in `new'
    from /Users/chloe/sites/bookshelf/config.ru:in `<main>'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:49:in `eval'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:49:in `new_from_string'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:40:in `parse_file'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/rack-1.5.5/lib/rack/server.rb:277:in `build_app_and_options_from_config'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/rack-1.5.5/lib/rack/server.rb:199:in `app'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/railties-4.1.4/lib/rails/commands/server.rb:50:in `app'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/rack-1.5.5/lib/rack/server.rb:314:in `wrapped_app'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/railties-4.1.4/lib/rails/commands/server.rb:130:in `log_to_stdout'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/railties-4.1.4/lib/rails/commands/server.rb:67:in `start'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:81:in `block in server'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:76:in `tap'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:76:in `server'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/railties-4.1.4/lib/rails/commands.rb:17:in `<top (required)>'
    from /Users/chloe/sites/bookshelf/bin/rails:9:in `require'
    from /Users/chloe/sites/bookshelf/bin/rails:9:in `<top (required)>'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/spring-1.6.4/lib/spring/client/rails.rb:28:in `load'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/spring-1.6.4/lib/spring/client/rails.rb:28:in `call'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/spring-1.6.4/lib/spring/client/command.rb:7:in `call'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/spring-1.6.4/lib/spring/client.rb:28:in `run'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/spring-1.6.4/bin/spring:49:in `<top (required)>'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/spring-1.6.4/lib/spring/binstub.rb:11:in `load'
    from /Users/chloe/.rvm/gems/ruby-2.3.0/gems/spring-1.6.4/lib/spring/binstub.rb:11:in `<top (required)>'
    from /Users/chloe/sites/bookshelf/bin/spring:13:in `require'
    from /Users/chloe/sites/bookshelf/bin/spring:13:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'
  [1]: https://stackoverflow.com/questions/7645918/require-no-such-file-to-load-mkmf-loaderror

****SOLUTION****

the solution from this question appeared to fix it:

in your enviroment.rb file, cut any line starting with config and paste into your production.rb/development.rb/test.rb instead.

Community
  • 1
  • 1
user146303
  • 437
  • 1
  • 7
  • 20
  • It looks like you're using Ruby 2.0.0 in your environment. What do you get if you run `ruby -v`? – Anthony E Mar 30 '16 at 17:18
  • It says: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14] when I run ruby -v, but is it possible that I have both and rvm isn't working correctly? – user146303 Mar 30 '16 at 17:20
  • Just FYI, `apt-get` is a command specific to Debian Linux. Homebrew would be the equivalent on Mac. – Anthony E Mar 30 '16 at 17:21
  • @AnthonyE ohh of course thank you! Perhaps I should try: sudo brew install ruby2.3.0-dev --- ok this didn't work. I just got: No available formula with the name "ruby2.3.0-dev" – user146303 Mar 30 '16 at 17:22
  • No, I wouldn't recommend that. If you're using RVM you should stick to that to prevent conflicts. – Anthony E Mar 30 '16 at 17:24
  • Are you able update your Ruby gems? `gem update --system` – Anthony E Mar 30 '16 at 17:25
  • You've already installed your developer tools with XCode, right? (`xcode-select --install`) – Anthony E Mar 30 '16 at 17:26
  • @AnthonyE yes I believe I did that a while ago -- when I run xcode-select -p I get : /Applications/Xcode.app/Contents/Developer --- but after running gem update --system, rails will start to launch and then exit (see edit above) – user146303 Mar 30 '16 at 17:32

1 Answers1

1

This appeared to solve the problem:

For the first issue--

run

gem update --system

For second issue --

in your enviroment.rb file, cut any line starting with config and paste into your production.rb/development.rb/test.rb instead.

user146303
  • 437
  • 1
  • 7
  • 20