简体   繁体   中英

Install gcc in Mountain Lion

I need GCC for some Ruby gems. And I need LLVM as well for iOS development using Xcode 4.4. I already have LLVM installed through Xcode.

How can I install GCC in Mountain Lion without affecting any of LLVM binaries?

The fact is that because you have Xcode you already have GCC installed on your system. If you're trying to run GCC from the terminal and getting "command not found" then the reason is, starting with OS X 10.8 (Mountain Lion), the GCC "command line tools" are not installed by default with Xcode. The install procedure depends on your version of OS X and Xcode:

Installing the GCC command line tools in OS X 10.8 (Xcode 4.4):
Xcode -> Preferences -> Download -> Components -> Command Line Tools -> install

Installing the GCC command line tools in OS X 10.9 (Xcode 5.02):
I have not tried these instructions myself, but I'll move them here if someone tries them and they work:
http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/

Had the same issue after upgrading to Mountain Lion.

My fix, I found make and gcc etc in /Developer/usr/bin .

setenv PATH $PATH":/Developer/usr/bin"

Puts them back in the path.

Oh yeah, I was on Xcode 3.x.

Install macports and run:

$ sudo port install gcc

from the command line. There are about 20 different versions of gcc available as Macports .

I had Homebrew. So I did this.

brew install --enable-all-languages https://raw.github.com/Homebrew/homebrew-dupes/master/gcc.rb

It worked!

The easiest way to install anything on a Mac is by using Homebrew . There is a package for this very purpose:

brew tap homebrew/dupes
brew install apple-gcc42

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM