GCC installed but not showing on OSX 10.9.5 - xcode

I had a working gcc/g++(2 month back;can't remember) from terminal of my mavericks with Xcode & Command Line Tools 6.0.1(6A317) but its not working now(might be due to minor OS upgrade). I tried all the commands gcc, g++, clang but neither of them works. Again, I tried installing using MacPorts using sudo port install gcc49 and it completed successfully but still any of the commands doesn't works(even after restarting terminal).
Additional Information- When I look for gcc/g++ in /usr/bin/, there is only alias present.
But clang++ and clang are present in /usr/bin/.

Related

cannot run gdb on mac's terminal even after codesign

I'm trying to install gdb on my Mac. I downloaded it with brew and code signed it according to the instructions on https://sourceware.org/gdb/wiki/BuildingOnDarwin
However, when I run gdb in the terminal, it still doesn't work and output the following error message:
dyld: Library not loaded: /usr/local/opt/mpfr/lib/libmpfr.6.dylib
Referenced from: /usr/local/bin/gdb
Reason: image not found
Trace/BPT trap: 5
Does anyone know what it means? My Mac version is 10.11.5, by the way
I ran into the same issue on macOS 10.11.6, I'm guessing (and this is just speculation; I don't actually know how Homebrew works) that Homebrew installed a pre-compiled version of gdb which depended on a library that existed on the machine it was compiled with, but did not exist on my machine.
At any rate, I was able to get a working version of gdb by downloading & unzipping version 7.12 (8.1 failed to compile on my machine) from http://ftp.gnu.org/gnu/gdb/gdb-7.12.tar.gz, then compiling & installing with (IIRC) the commands:
./configure
make
sudo make install
I blogged about this and the subsequent steps (getting the executable code-signed so that macOS would allow it to debug other processes, etc) here: http://prust.github.io/posts/2018-02-24-interactively-debugging-c-in-sublime-text-3.html
I get this problem too. And I find solution in https://qiita.com/yoshixj/items/698d94337ca447e9b9de
Since we don't have /usr/local/opt/mpfr/lib/libmpfr.6.dylib
we can simply install it. Use this command:
brew install gawk
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.zshrc
I had the same error message when running gdb after installing it from Homebrew (gdb v8.1) on a Mac OS X El Capitan v10.11.6. However, installing it via Homebrew using its Python binary solved the issue:
brew install gdb --with-python
Beaware that this may take some time, since you'd be compiling gdb from scratch. After it's done, you still need to create a certificate and codesign gdb.

Install GCC 5.X on Xcode 6

I need to use/integrate GCC 5.X (in my case 5.3, and it is already installed) on Xcode 6.2.
I've found a lot of outdated tutorials about GCC 4.X and Xcode 5 (or lower), but all of them are outdated and do not work anymore.
I've also found this tutorial, but I have not the 5.3.xcplugin file that the tuto recommend to copy.
I am still on Mac OS X Maverick, and I can install Xcode 7 if necessary.
Anybody would know how to do it?
MacPorts still has an installer for Mavericks. It will likely add /opt/local/bin:/opt/local/sbin to your $PATH in .profile, or whatever shell startup file you use, and leave a backup of the old file you can probably get rid of once you're satisfied.
I would suggest upgrading to the latest Xcode release - and to El Capitan unless you have some specific reason not to. AFAIK, if you can run Mavericks, you can run the latter. I will avoid any arguments about the merits of Brew vs. MacPorts here. There's plenty of documentation on the MacPorts pages.
Make sure the package database is up to date:
sudo port -v selfupdate`
Have a look at the existing gcc ports:
port list | grep gcc
note: you might as well install the stable gcc6 (6.1.0) package.
Install the package - this may also install dependency packages:
sudo port install gcc6 [-universal]
This may take a while, as it might need to build from source. For most packages, the -universal flag says that you don't care about 32-bit (IA32) builds, etc.
You can see various package versions with port select ... options, e.g.,
port select --list gcc
And enable the installed gcc:
sudo port select --set gcc mp-gcc6
You may need to rehash so the shell adds the new binaries to its search. Or just start a new shell. gcc -v should yield something like:
gcc version 6.1.0 (MacPorts gcc6 6.1.0_0)

GCC is installed on mac but can't find it in command line

I'm using OS X with Yosemite 10.10.5 and I know I have XCode and the Command Line Tools installed. If I run
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
and
$xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
But then
$ gcc --version
-bash: gcc: command not found
It is entirely possible, the I deleted something I shouldn't have. Anyone have any clue on what I'm missing?
Note: I think the native XCode was installed, but I also successfully ran:
brew install gcc
brew link gcc
Still can't find gcc.
To add more details from questions:
$ which gcc
$
Gives no answer whatsoever and I DON'T have usr/bin/gcc or any similar folder (gcc4.9 or else). I tried reinstalling XCode without success and also tried reinstalling gcc through homebrew. It compiles and links just fine, but can't find the gcc.

Downgrade or remove GCC 4.8 from Mac OS X Mountain Lion

I am in the process of trying to essentially start from scratch with getting homebrew, GCC and RVM 1.9.3 on to my mac OS x 10.8.2 after determining that my problems with RVM were "related to a messy environment which can not be fixed automatically without what we plan for RVM2" in a thread that began here on SO and ended as a github for ticket RVM.
I had XCode 4.6 with Command Line Tools installed as was recommended here but at this point have completely deleted XCode (by trashing it- due to the version sudo /Developer/Library/uninstall-devtools --mode=all did not work), I uninstalled homebrew by running
cd `brew --prefix`
brew install libtool
rm -rf Cellar
rm `git ls-files`
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
rm -rf .git
rm -rf ~/Library/Caches/Homebrew
and imploded my rvm. However, I am not sure how to go about 'refreshing' my GCC situation. Which is as follows:
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-apple-darwin12.2.0
Configured with: ../gcc-4.8-20130113/configure --enable-languages=c++,fortran
Thread model: posix
gcc version 4.8.0 20130113 (experimental) (GCC)
I have Time Machine backups from various stages of my undoing and made a bootable USB of Mountain Lion but was hoping to try reinstalling a fresh copy of Xcode or running the GCC-10.7 program installer before using either of those methods. However, I don't know if I can or how I would rectify the GCC situation before doing so.
From reading Change to GCC 4.7.., it seems that there might be a way of pointing/directing my system to a different version of GCC, but I don't know how to do that without MacPorts or homebrew.
Is there a way to get rid of the experimental GCC 4.8 so it doesn't come back in the future?
I have run a VM of my system with a copy of /usr/local/ from before I had ever installed XCode CLT or any of these other libraries, but my $ gcc -v still came back with gcc version 4.8.0
Sorry if I omitted and/or added necessary/unnecessary information and thank you in advance for any help.
This is a confusing dump of information. You don't want to use MacPorts or Homebrew? I seriously recommend you go with Homebrew. That should get the latest GCC 4.8 onto OR OFF OF your box with ease. If you can't figure out where your current gcc 4.8 is, try typing "which gcc" and that will tell you where it's located. It's not coming back. Clearly you never removed it if typing gcc brings up gcc. It's probably in /usr/local/opt.
If you insist on wiping out ALL the homebrew stuff manually, you COULD just zap /usr/local/opt to get rid of the symlinks, and /usr/local/Cellar to get rid of the real stuff, but I don't recommend it. Why? Zapping directories by hand could cause you to lose data especially if you're prone to making mistakes. Use MacPorts or Homebrew to REMOVE whatever you used it to install.

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

Resources