Cannot install ruby-1.9.2 in Mac OSX 10.8.1 due to symlink error

◇◆丶佛笑我妖孽 提交于 2019-12-14 03:49:53

问题


First, I tried the common rvm install.

rvm install 1.9.2

However, the following error was shown:

The provided compiler '/usr/bin/gcc' is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.

Then I run

rvm requirements

and find these following part of output useful

Right now Ruby requires gcc to compile, but Xcode 4.2 and later no longer ship with gcc. Instead they ship with llvm-gcc (to which gcc is a symlink) and clang, neither of which are supported for building Ruby. Xcode 4.1 was the last version to ship gcc, which was /usr/bin/gcc-4.2.

Xcode 4.1 and earlier:
- Ruby will build fine.

Xcode 4.2 and later (including Command Line Tools for Xcode):
- If you have gcc-4.2 (and friends) from an earlier Xcode version, Ruby will build fine.
- If you don't have gcc-4.2, you have two options to get it:
 * Install apple-gcc42 from Homebrew
 * Install osx-gcc-installer

Homebrew:
If you are using Homebrew, you can install the apple-gcc42 and required libraries from homebrew/dupes:
 brew update
 brew tap homebrew/dupes
 brew install autoconf automake apple-gcc42 
 rvm pkg install openssl

This can live side by side with an existing Xcode 4.2+ install or Command Line Tools for Xcode.

so I tried:

brew update
brew tap homebrew/dupes
brew install autoconf automake apple-gcc42 

However, I got the following error

Warning: Could not link apple-gcc42. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link apple-gcc42'
==> Summary
/usr/local/Cellar/apple-gcc42/4.2.1-5666.3: 104 files, 75M, built in 23 seconds
kanitw:shell.venturelab.com kanitw$ brew link apple-gcc42
Linking /usr/local/Cellar/apple-gcc42/4.2.1-5666.3... Warning: Could not link apple-gcc42. Unlinking...
Error: Could not symlink file: /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/include/gcc
/usr/local/include is not writable. You should change its permissions.

What would be my best solution? I kinda remember from somewhere that I should not use sudo with brew since I will mess up the whole installation.


回答1:


You can change /usr/local directory owner

sudo chown -R `whoami` /usr/local

But, if you have mysql installed, you mast fix its owner

sudo chown -R mysql:mysql /usr/local/mysql



回答2:


You should run brew doctor and then change the permissions accordingly. There might be other issues.




回答3:


Change the permissions of your /usr/local directory and try again.



来源:https://stackoverflow.com/questions/12578220/cannot-install-ruby-1-9-2-in-mac-osx-10-8-1-due-to-symlink-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!