Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
428 views
in Technique[技术] by (71.8m points)

ruby - OS X Mountain Lion: gcc-4.2 No such file or directory

Tried to install a gem on Mountain Lion and make couldn't find gcc-4.2:

kamil$ gem install posix-spawn -v '0.3.6'
Building native extensions.  This could take a while...
ERROR:  Error installing posix-spawn:
    ERROR: Failed to build gem native extension.

        /Users/kamil/.rbenv/versions/1.9.3-p0/bin/ruby extconf.rb
creating Makefile

make
compiling posix-spawn.c
make: gcc-4.2: No such file or directory
make: *** [posix-spawn.o] Error 1
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you have Xcode installed, gcc should be available. Check where it is with:

kamil$ which gcc
/usr/bin/gcc

Then make a user-land symbolic link from gcc-4.2 to plain gcc:

kamil$ sudo ln -s ~/bin/gcc /usr/bin/gcc-4.2

(Ensure the user-land bind folder is in your path via export PATH=...:$HOME/bin in your .bash_profile or .zshrc.)

Gem installed fine afterwards.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...