Install ruby1.9.3 on Mac OSX10.7.3

Source: Internet
Author: User
Tags macbook

!!! Be sure to check the version number on the title.
Which, we can see that Mac OS x 10.7.3 is pre-installed with ruby-1.8.7, but it seems that as a Unix system, there is no gcc or make, so I started to toss my macbook.
In fact, it is easy to install Xcode if you want gcc. But here is a pitfall. I installed Xcode from the AppStore, Which is 1.7G large, although I don't need Xcode, however, since I need to use it this time and I may be interested in seeing Xcode, I drive my Macbook and go to bed, so that the AppStore can install Xcode on its own.

This morning, I saw that the software has been installed, but which is still running out of gcc. I started to fall into the abyss of tossing. I used the find command to locate gcc, and then in. when bash_profile is added with its path, an error is still reported during ruby installation. The executable C command cannot be found.
Well, now we need to be on the right track. We can't do it without taking it seriously.
 
Install
I don't think the necessary tools are installed for me during Automatic AppStore installation.

After Xcode is installed through AppStore, Open Xcode, choose Xcode> Open Developer Tool> More Developer Tools. Then Safari appears, register and enter the information, and enter the download site of Apple Developer, the first result after searching for "Unix" is that Command Line Tools downloads it. We recommend that you use thunder for mac to download and install it, it will provide us with command line tools, including the gcc and make tools I want. You don't need to re-open Terminal. which gcc and make both have them.
At this time, there was another problem. The gcc for mac was Apple-specific. It was said that it was optimized for compilation in llvm, but this was a problem in ruby, ruby does not support llvm-gcc. Well, besides gcc, there is also a clang compilation tool.
Now you can start to install ruby, which is the same as installing ruby normally, but add -- with-gcc = clang during configuration to specify the compiler.
 
Java code
./Configuration -- prefix =/opt/ruby-1.9.3 -- with-gcc = clang
I will not list other commands.

Edit after installation ~ /. Bash_profile: After adding environment variables, restart Terminal. Now, not only ruby has been successfully installed, but other software can be installed. Here, we will remind you that gcc can be used for system gcc, that is to say, add the -- with-gcc = clang parameter only when necessary.
 
I still don't know if there are other problems after the installation, because I saw a lot of Warning during the installation, and now it's midnight. I only read ruby, gem, ri and other command versions. We hope there will be no problems in future use. However, it is easy to delete the compilation and installation. Just in case, I found some other installation methods.

Install through RVM and reference the link. Here, we will remind you that, in stackoverflow, rvm install 1.9.3 -- with-gcc = clang
This command is not necessarily correct and may be caused by the RVM version. You can try rvm install 1.9.3-C -- with-gcc = clang, -- prefix =/opt/ruby-1.9.3

Install macports on the macport homepage.



Author jashawn



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.