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

I have a gcc compiler in "/ Developer / usr / bin / gcc", but when I enter gcc into the terminal, it says it cannot be found, I assume that this is because it is not in the directory " / usr / bin ", So I can: a) move gcc from the first directory to the second or set some shortcut pointing gcc to" / Developer / usr / bin / gcc "

+2
source share
5 answers

Two options:

  • Edit ~/.bashrc or ~/.bash_profile (or equivalent system files) and add /Developer/usr/bin/gcc to $PATH : export PATH="$PATH:/Developer/usr/bin/"
  • Create a link (a symbolic link in this example) in the /usr/bin 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

+6
source

The tip associated with me worked for me! I installed Xcode 4.3.3 through the App Store. I didn’t have to install Xcode “again”, it seems that Apple solved it. I needed to take the following simple steps:

  • Open xcode
  • Go to Settings> Downloads
  • Install command line tools

Thanks to Guy and his message fooobar.com/questions/659140 / ...

+8
source

Use ln -s to create a symbolic link in /usr/bin or add /Developer/usr/bin to $PATH .

+2
source

You can theoretically rigidly tie it to the right place.

The official way to do this is to install additional command line tools using the Xcode installer. This takes several hundred megabytes when installing a new copy of the same compiler.

I wrote a shell script once to compare the installation trees of the "Xcode" installation and the "command line" installation and merge all the files that were identical. It worked fine, but the next update turned it off.

Another alternative is to load the GCC source from their CVS (not much more than loading the massive Xcode installer) and embed it in usr/bin/ yourself. Then you have the latest and best (or your choice of many newer and better versions).

+1
source

If you installed Xcode from the App Store, check out this thread:

Problems with Xcode Mac OS X using RVM

Apparently, “installing” Xcode from the application store does not actually install it, you must manually run the installer (find “Install Xcode” in the spotlight).

0
source

Source: https://habr.com/ru/post/912010/


All Articles