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

妖精的绣舞 提交于 2019-11-28 04:54:59

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.

Install simply apple-gcc42 with brew. It generate gcc-4.2 .

brew install apple-gcc42

So we do not need symlinks, which apple update may remove.

Homebrew

As @Artur Bodera mentioned modern OSX will refuse to let you create the symlink in the systems /bin folder.

To avoid this simply create the symlink to your users bin folder

ln -s ~/bin/gcc /usr/bin/gcc-4.2

Don't forget to add the bin folder to your .zshrc or .bash_profile - e.g.

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