Mac OS X Lion에서 Ruby 1.9.3을 어떻게 설치할 수 있습니까?
Ruby 1.9.3을 설치하려고하는데 문제가 있습니다. RVM을 설치하고 다음을 입력했습니다.
rvm install 1.9.3
출력 내용은 다음과 같습니다.
ERROR: Error running ' ./configure....
로그 내용 :
configure: WARNING: unrecognized options: --with-libyaml-dir
checking build system type... x86_64-apple-darwin11.2.0
checking host system type... x86_64-apple-darwin11.2.0
checking target system type...x86_64-apple-darwin11.2.0
checking whether the C compiler works... no
configure: error: in `/Users/myuser/.rvm/src/ruby-1.9.3-p0':
configure: error: C compiler cannot create executables See `config.log' for more details
App Store에서 새 XCode를 다운로드하여 설치했습니다.
기본값 대신 clang 컴파일러를 사용해보십시오.
rvm install 1.9.3 --with-gcc=clang
RVM은 루비 1.9.3을 설치하기 위해 gcc-4.2가 필요합니다. 불행히도 Lion에는 더 이상 gcc-4-2가 포함되지 않고 llvm 버전 만 포함됩니다.
lrwxr-xr-x 1 root wheel 12 15 feb 17:21 /usr/bin/gcc -> llvm-gcc-4.2
Lion이 있지만 Snow Leopard에서 업그레이드 한 경우 여전히 gcc-4.2가있을 가능성이 높습니다. Lion을 새로 설치 한 경우 gcc-4.2를 다운로드해야합니다. 이 패키지를 다운로드하는 것이 좋습니다.
https://github.com/kennethreitz/osx-gcc-installer
지금 gcc-4.2가 설치되어 있는지 확인하십시오.
-rwxr-xr-x 1 root wheel 113024 16 may 2011 /usr/bin/gcc-4.2
lrwxr-xr-x 1 root wheel 12 15 feb 17:21 /usr/bin/gcc -> llvm-gcc-4.2
이제 평소와 같이 루비 1.9.3을 설치할 수 있습니다.
rvm install 1.9.3
rvm use 1.9.3 --default
단순히 최신 버전의 Ruby를 설치하고 최신 상태로 유지하려는 경우 (루비의 다른 버전간에 전환하는 대신) homebrew 를 통해 ruby를 설치할 수 있습니다 .
brew install ruby
먼저 시도해보십시오.
rvm get latest
이것이 내가 일하는 것입니다.
rvm:
version: "rvm 1.9.2 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]"
ruby:
interpreter: "ruby"
version: "1.9.3p0"
date: "2011-10-30"
platform: "x86_64-darwin11.2.0"
patchlevel: "2011-10-30 revision 33570"
full_version: "ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]"
실제로 ruby-1.9.3-p125
이제 gcc-llvm
. 그러나 현재 안정된 / 최신 릴리스는 rvm
(아직)하지 않습니다. 그러나 그것은 단지 rvm
조심 스러웠으며 이제 .NET의 마스터 브랜치에서 해당 해결 방법에 대한 수정 사항이 rvm
있습니다.
간단히 rvm
마스터 브랜치로 업그레이드하고 설치 / 업그레이드하십시오 ruby
.
GT-MBP:~ gthiruva$ rvm upgrade ruby-1.9.3-p0 1.9.3
Are you sure you wish to upgrade from ruby-1.9.3-p0 to ruby-1.9.3-p125? (Y/n): Y
Installing new ruby ruby-1.9.3-p125
Fetching yaml-0.1.4.tar.gz to /Users/gthiruva/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/gthiruva/.rvm/src
Configuring yaml in /Users/gthiruva/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/gthiruva/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/gthiruva/.rvm/usr
The autodetected CC(/usr/bin/gcc-4.2) is LLVM based, it is not yet fully supported by
ruby and gems, please read `rvm requirements`, and set CC=/path/to/gcc .
Unable to install ruby ruby-1.9.3-p125. Please install it manually to continue.
GT-MBP:~ gthiruva$ rvm get head
Original installed RVM version:
rvm 1.10.2 by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis
<mpapis@gmail.com>`enter code here` [https://rvm.beginrescueend.com/]
...
RVM reloaded!
GT-MBP:~ gthiruva$ rvm reload
RVM reloaded!
GT-MBP:~ gthiruva$ exec bash
rvm 1.10.2 by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com>
[https://rvm.beginrescueend.com/]
GT-MBP:~ gthiruva$ rvm upgrade ruby-1.9.3-p0 1.9.3
Are you sure you wish to upgrade from ruby-1.9.3-p0 to ruby-1.9.3-p125? (Y/n): Y
Installing new ruby ruby-1.9.3-p125
...
Successfully migrated ruby-1.9.3-p0 to ruby-1.9.3-p125
Upgrade complete!
- Xcode 열기
- Xcode 환경 설정 열기
- 다운로드 탭 열기
- 명령 줄 도구 확인
- Uninstall/remove all traces of manually installed old ruby versions and extras (sqlite3, libxml2-x.x.x, libxslt-x.x.x) from your /usr/local/ or wherever you installed them.
- Download and install JewlryBox http://unfiniti.com/software/mac/jewelrybox which is a RVM GUI interface for managing your rubies and gemsets.
- In JewlryBox, click "Add Ruby" and choose the version of ruby you want to install (I chose 64 bit, Enabled Shared and didn't check/tick the "Use clang" option).
Worked with OS X Lion 10.7.3 and Xcode 4.3 Command Line Tools installed.
Type following commands
- ~ $: source ~/.rvm/scripts/rvm
- ~ $: type rvm | head -n 1
rvm is a function
~ $: vi ~/.bash_profile add this line into bash_profile "source ~/.rvm/scripts/rvm"
~ $: rvm install 1.9.3
- ~ $: rvm use 1.9.3
Clang wasn't cutting any rubies for me and rvm install rubies failed no matter what with single user rvm. Sudo combined with some permission & $PATH changes to my user made it happen. Here's what I did:
sudo bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )</pre>
sudo rvm pkg install readline
sudo rvm install 1.9.3
Installing rvm from root user makes a shell script at /usr/local/rvm/scripts/rvm Pulled code from this executable and placed it in my .bash_profile so that .bash_profile was saved as:
[ -s "/usr/local/rvm/scripts/rvm" ]] ;
true ${rvm_path:="/usr/local/rvm"}
source "/usr/local/rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
The user group RVM was created during root user rvm install. Last thing I did was go to my preferences pane in OSX 10.7 and added my user to the new rvm group. Finally I reloaded my terminal and was able to install 1.9.3 through rvm single user.
Using rvm, ruby 1.9.3, and attempting to use gcc, I couldn't get Ruby to build cleanly with yaml. While there are a variety of hacks to get yaml compilation to work, none of them seemed to work with rvm. I was troubleshooting late at night and I didn't retain my errors, so I'm working from memory here -- I would appreciate if someone else with a clean environment could test these steps.
Using the --with-gcc=clang
solution produced the mildly infamous error about the yaml parser:
It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby.
Since I need yaml for what I'm going to be doing, and libyaml compiled fine when not being run by rvm, and I even had it installed in /usr/lib after building it by hand, I can't understand why rvm couldn't find and use that version of libyaml, even with the --shared-libs
option.
Using CC=/usr/bin/gcc rvm install 1.9.3
produced errors. In the .rvm/log/ruby-1.9.3-p385/configure.log, I found the following:
configure: error: C compiler cannot create executables
See `config.log' for more details
That error was also present in .rvm/log/libyaml-0.14/configure.log.
The solution for me ended up being to run the rvm command with sudo. Running a compile as root seems to remove Apple's GCC toolchain's disapproval of users doing anything as dirty as compiling software.
So sudo CC=/usr/bin/gcc rvm install 1.9.3 --disable-binary
gave me a clean compile of ruby+yaml in the rvm folder. I then needed to sudo chown -R username ~/.rvm && sudo chgrp -R staff ~/.rvm
to get things back in my user and running with my permissions.
I do not recommend compiling things as root, as I see it as a security risk (especially with the vulnerabilities found in the ruby stack and rubygems.org recently) -- but this produced a clean installation of ruby under rvm and might help someone with more talent or time figure out the root cause of the issue with Apple's gcc.
With the new Feb 2012 Command Line Tools for Xcode, using RVM 1.10.3 (and JweleryBox for Mac) Ruby 1.9.3-p125 compiles fine, without "Use clang" and with shared linking and 64 bit architecture. More over, the "gem install rails" command works flawlessly without the warning about libyaml support.
ReferenceURL : https://stackoverflow.com/questions/8139138/how-can-i-install-ruby-1-9-3-in-mac-os-x-lion
'IT TIP' 카테고리의 다른 글
Twitter Bootstrap은 li에 활성 클래스를 추가합니다. (0) | 2020.12.27 |
---|---|
int 대 const int & (0) | 2020.12.26 |
Android에서 TextView 내부의 텍스트를 정렬하는 방법은 무엇입니까? (0) | 2020.12.26 |
jquery 유효성 검사 적어도 하나의 확인란 (0) | 2020.12.26 |
XML 문서에서 인터넷을 통해 바이너리 콘텐츠를 보내기위한 Base64 대 HEX (0) | 2020.12.26 |