Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move GCC in osx from xcode to /usr/bin

I have the gcc compiler in "/Developer/usr/bin/gcc" but when i type in gcc into terminal it says can not be found, i assume this is because its not in the "/usr/bin" dir. So can i a) move gcc from the first dir to the second, or set some kind of shortcut pointing gcc to "/Developer/usr/bin/gcc"

like image 900
kjones1876 Avatar asked Dec 31 '25 09:12

kjones1876


2 Answers

The tip thewoolleyman linked to worked for me! I have installed Xcode 4.3.3 via the App Store. I did not have to install Xcode "again", seems Apple solved that. What I had to do are the following easy steps:

  1. Open Xcode
  2. Go To Preferences > Downloads
  3. Install the Command Line Tools

Thanks to Guy and his post https://stackoverflow.com/a/9377095/1451903

like image 127
esco_ Avatar answered Jan 02 '26 02:01

esco_


Two choices:

  1. Edit your ~/.bashrc or ~/.bash_profile (or equivalent system files) and add /Developer/usr/bin/gcc to $PATH: export PATH="$PATH:/Developer/usr/bin/"
  2. Create a link (symlink in this example) in your /usr/bin directory pointing to the real file: ln -s /Developer/usr/bin/gcc /usr/bin/gcc

Note: in XCode 4.5 on MacOS 10.8 the path is now: /Applications/Xcode.app/Contents/Developer/usr/bin

like image 39
Tarka Avatar answered Jan 02 '26 01:01

Tarka