MeuMySQL Blog is now at http://blog.mdnsolutions.com/.

Sunday, December 16, 2012

Installing Ruby on Rails on MAC OS X


Hi fellas! Today I felt to get started with Ruby on Rails and with those steps below I've set up my environment. So, I'm on a MAC OS X 10.7.5 64 bits and it worked pretty well for me.




Installing 

First of all I did the download of the RVM and run it on my machine.

$ \curl -L https://get.rvm.io | bash -s stable --ruby



Errors 
In case you get any error like this http://pastebin.com/z6N1q6Jh all you need to do is to install a c or gcc compiler. They are necessary to compile open source projects in Mac OS X. The problem is Mac OS X doesn’t install the gcc compiler by default.
If you try to install or compile some projects that required c/gcc compiler, following errors message will be logged:  
 configure: error: C compiler cannot create executables
 configure: error: no acceptable C compiler found in $PATH  
To get those c or gcc compilers working in your machine install the Command Line Tools for Xcode (how to do so you can find here). Once you have it installed type the command below to check out if it worked. 
$ gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

At this point you should have the RVM working in your machine.

Testing


Now to check or Ruby installation open up IRB (which stands for Interactive Ruby).

  • If you’re using Mac OS X open up Terminal and type irb, then hit enter;
  • If you’re using Linux, open up a shell and type irb and hit enter;
  • If you’re using Windows, open fxri from the Ruby section of your Start Menu.

Now type "Hello World", you should see something like this:

1.9.3p327 :002 > "Hello World"
 => "Hello World"


Well, this is a start, isn't it? You can work now with mathematic expressions and so on. Soon I'm writing about other things you can do with our new tool. =)

Enjoy yourself!


References:
http://www.ruby-lang.org/en/documentation/quickstart/
https://developer.apple.com/downloads/index.action#
http://www.ruby-lang.org/en/downloads/
http://www.mkyong.com/mac/how-to-install-gcc-compiler-on-mac-os-x/

No comments:

Post a Comment