Recently learning Ruby,ruby is an object-oriented programming language, and rails is the framework of Ruby, just like ssh in Java. It's just that rails is an MVC pattern. The following is a procedure for installing an environment.
The main reference for installing the Ruby on Rails environment is the tutorial sticker above Ruby-china, linked here: https://ruby-china.org/wiki/install_ruby_guide
In addition, it is best to use the Linux kernel, so make sure you have a Linux kernel machine or virtual machine or dual system before starting the installation.
1. Install Ruby
Now the ruby version should be 2. X, it is recommended not to install version 1.9, because 2:1.9 adds a lot of new features. The following are all performed on the command line
1. Install the package required by the system
Ruby-e "$ (curl-fssl https://raw.github.com/mxcl/homebrew/go/install)"
2. Install RVM. RVM is a virtual machine run by Ruby, similar to a JVM.
Curl-l Https://get.rvm.io | Bash-s Stable
Then, load into the RVM environment (new open termal will not do so, will automatically reload)
Source ~/.RVM/SCRIPTS/RVM
Check to see if the installation is correct
Rvm-v
If the installation is correct, you should see a response similar to the one in the command line after the previous sentence is entered:
RVM 1.22.17 (Stable) by Wayne E. Seguin <[email Protected]>, Michal Papis <[email protected]> [htt ps://rvm.io/]
The important thing is RVM 1.22.17, this is the version of RVM you installed.
3 Installing the ruby environment with RVM
RVM Install 2.0.0
So the Ruby,ruby gem is installed. What is Ruby Gem, which is a ruby tool for managing a variety of library packages.
4 Setting up a Ruby version
After the RVM is installed, you need to execute the following command to set the specified version of Ruby to the system default version
RVM 2.0.0--default
Also, you can use a different version number if you have a RVM install installed that version
This time you can test whether it is correct
$ ruby-v
Ruby 2 . 0.0p247 (2013-06-27 revision 41674) [x86_64-darwin13.0.0]
$ gem-v
2.1.6
$ gem source-r https://rubygems.org/(This sentence is to remove the gem's default download source, changed to Taobao Source.) Because the foreign site sometimes may not be so stable connection
$ gem source-a https://ruby.taobao.org
2. Load Rails
After the 3 steps above, the Ruby environment is installed, and the next step is to install Rails
$ gem Install Rails
Then test that the installation is correct
$ rails-v
Rails 3.2.13
If you are prompted for a missing XX package during installation, follow the command-line prompts to execute the gem install XXX.
Attached: If you are sure that you have installed Ruby,rvm,rails, but ruby-v,rails-v do not see the version number, you can first enter/bin/bash--login on the command line, and then ruby-v try
3. Loading RubyMine
RubyMine is the IDE that develops Ruby, if you like to write code in a text editor, skip the following.
First to the official website to download, the link will not give, Baidu's bar.
Then, pay attention to this software is charged, so go to get a registration code God horse, Baidu a bunch, in order to try just fine.
Install RubyMine to install the JDK environment first, this write Java has been installed, skip the Write ~
Then, to write the project, you need to install the bundle first, this means to follow the configuration file of your project, to bind the various library files you need. The concrete method is Tools--bundler--install. The bundle may fail, prompting you to make sure that the XX package is installed before the bundle, because you do not have to install a package written in a configuration file or a dependent package, and follow the prompts to execute the gem install xx at the command line (the xx here refers to the package name).
Ruby on Rails Environment building and rubymine installation