user567665
user567665

Reputation:

ROR - Unable to create a new directory

(side note: my mac crashed a couple of weeks ago due to some os problem; the apple people at the store took care of it, and it's back to "normal" - just stating this in case it's related to the current problem)

today, i decided to practice some ruby after having not done it in a while (following hartl's tutorial)

when trying to generate a new application, after a pause and seemingly normal files, it comes up with this: (for the record - when I created my previous directories - I never had a problem with it until today)

 Installing json (1.7.5) with native extensions 
 Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/name_withheld/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb 
 creating Makefile

 make
 sh: make: command not found


 Gem files will remain installed in /Users/name_withheld/.rvm/gems/ruby-1.9.3-p0/gems/json-1.7.5     for   inspection.
  Results logged to /Users/name_withheld/.rvm/gems/ruby-1.9.3-p0/gems/json-1.7.5/ext/json/ext/generator    /gem_make.out
  An error occured while installing json (1.7.5), and Bundler cannot continue.
 Make sure that `gem install json -v '1.7.5'` succeeds before bundling.

Tried to install json. This is what it comes up with:

Building native extensions.  This could take a while...
ERROR:  Error installing json:
ERROR: Failed to build gem native extension.

    /Users/name_withheld/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb
creating Makefile

make
sh: make: command not found


Gem files will remain installed in /Users/name_withheld/.rvm/gems/ruby-1.9.3-p0/gems/json-1.7.5 for     inspection.
Results logged to /Users/name_withheld/.rvm/gems/ruby-1.9.3-p0/gems/json-1.7.5/ext/json/ext/generator    /gem_make.out

Anyway, it seems the problem may be related to gcc? or xcode?

I'm confused, and I never had a problem until today! Hence why I think it may be do something with the reset that the people at apple store may have done, maybe?

For the record, when I try to download command line for xcode which everyone says it's free, it's not. You have to register and pay some sort of licensing fee.

Help? Can anyone sort out my confusion on what I should do here?

Edit Am on 10.6.8 version (ie Snow Leopard?)

Edit 2 Have added this to comments beneath, but also adding it here for further trouble-shooting if it helps.

This is what my path shows: "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/name_withheld/.rvm/bin"

Upvotes: 0

Views: 891

Answers (1)

likethesky
likethesky

Reputation: 846

You should also make sure you have Rails 3.x (ideally at least 3.2.y)... You can check which Rails you are running by doing:

$ rails -v

Use:

$ gem install rails

to get the latest version of Rails. Once you do a 'rails -v' and know you're running Rails 3, then a 'rails new foo' should create an app (and directory) called foo.

Also, Mischa had a typo, the command is:

$ gem update rails  # *Not* gem rails update ...

I would also run the following to 'start over' with rvm:

$ rvm implode

Then reinstall rvm, per the instructions here.

You may also find this much easier: http://railsinstaller.org/#osx

Btw, homebrew and rvm are two totally separate things. brew is used to download, build (compile), and install packages using a local (on your Mac) compiler (gcc or CLI tools, put there via Xcode or the Kenneth Reitz gcc installer). rvm is Ruby Version Manager, it's only used to manage the different Ruby versions you might install. To use it, you just say 'rvm 1.9.3' (assuming you've installed Ruby 1.9.3 already) to make sure you're using that version of ruby.

Similar to Rails, you can check which version of Ruby you're using by doing:

$ ruby -v

Also, rvm will tell you which one you're using (if it says 'system' then try the 'rvm 1.9.3' or 'rvm 1.9.2' command to change the one you're using):

$ rvm list

The one in use will have a '=*' or '=>' next to the one you're using (if you have a fairly recent version of rvm installed).

Good luck--let me know if any of this helps.

Upvotes: 1

Related Questions