Cannot install any version of ruby on Mojave - internal ranlib command failed - ruby

I know there are a few silimar issues to this one, but I cannot find one that matches my issue.
I cannot install any version of ruby with either rvm nor rbenv. Both result in the same error. For example, here's an extract for the logs when installing ruby 2.5.3:
compiling loadpath.c
making srcs under enc
linking static-library libruby.2.5.3-static.a
make[1]: Nothing to be done for `srcs'.
generating transdb.h
/opt/local/bin/ranlib: object: libruby.2.5.3-static.a(dln.o) malformed object (unknown load command 1)
ar: internal ranlib command failed
make: *** [libruby.2.5.3-static.a] Error 1
make: *** Waiting for unfinished jobs....
transdb.h updated
The issue seems to be here:
/opt/local/bin/ranlib: object: libruby.2.5.3-static.a(dln.o) malformed object (unknown load command 1)
ar: internal ranlib command failed
make: *** [libruby.2.5.3-static.a] Error 1
What I've tried
Installing, reinstalling, uninstalling rvm, rbenv.
Updating, reinstalling XCode.
Deleting, installing, XCode command line tools.
What is causing this?
Update
gcc --version returns:
gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin18.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

For anyone else who steps on the same landmine, for me it was that there was an incompatible copy of ranlib from homebrew via the cctools package. To fix it, I just uninstalled it:
brew uninstall cctools

For those who find this and aren't helped by the above solution...
I ran into this issue as well. In my case it was due to MacPorts being outdated after I upgraded to (MacOS) Mojave.
I followed the steps listed on MacPorts' migration guide here:
https://trac.macports.org/wiki/Migration
Closed and reopened Terminal (just b/c)
ran rvm install ruby and got Install of ruby-2.6.0 - #complete, hooray!

So, I think the fix to this was running:
$ sudo xcodebuild -runFirstLaunch
Why? I'm not sure. My suspicion is I tried to build ruby before updating XCode. But once I had updated XCode I suspect the wrong/older command line tool was still being referenced somehow.
I don't know exactly what fixed this but I completely deleted XCode and ruby still didn't install.
Then I completely deleted command line tools and ruby still didn't install.
Then I reinstalled just the command line tools without XCode and ruby still didn't install.
Then I ran this runFirstLaunch command and ruby installed.

Related

How to install OS X 10.12 command line tools on 10.11?

I get this error when trying to brew install geckodriver
==> Installing geckodriver dependency: rust
==> Downloading https://static.rust-lang.org/dist/rustc-1.42.0-src.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/rust/1.42.0 --release-channel=stable
==> make
Last 15 lines from /Users/nilshaus/Library/Logs/Homebrew/rust/02.make:
2020-04-12 21:13:48 -0400
make
make: error: unable to find utility "make", not a developer tool or in PATH
xcodebuild: error: SDK "/Library/Developer/CommandLineTools/SDKs/MacOSX10.12.sdk" cannot be located.
clang: error: unable to find utility "clang", not a developer tool or in PATH
Do not report this issue to Homebrew/brew or Homebrew/core!
These open issues may also help:
Rust dependents that currently fail to build from source https://github.com/Homebrew/homebrew-core/issues/50815
Error: You are using macOS 10.11.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this old version.
Obviously 10.11 is no longer supported by Homebrew. The fact that it can't find make is weird, but I'm willing to bet that the real issue is that the rust build expects the 10.12 command line tools. Is there a way for me to install them on OS X 10.11? I have Xcode 8.
I encountered this same error message when brew upgrade installed a new version of clang and tcl-tk. Found a workaround here:
Xcode was overriding the command line tools install. After moving
Xcode to the trash I found the directory of the command line tools
install:
clang --version
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
/Library/Developer/CommandLineTools/usr/bin
https://github.com/pytorch/pytorch/issues/1139#issuecomment-302967251
Another possible workaround - instead of moving Xcode, choose one of the following to specify CLT version:
sudo xcode-select -s /Library/Developer/CommandLineTools
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
To display the current CLT path: xcode-select -p
https://github.com/pytorch/pytorch/issues/1139#issuecomment-303033942

How to install a new Ruby version on Mac OS [duplicate]

I know there are a few silimar issues to this one, but I cannot find one that matches my issue.
I cannot install any version of ruby with either rvm nor rbenv. Both result in the same error. For example, here's an extract for the logs when installing ruby 2.5.3:
compiling loadpath.c
making srcs under enc
linking static-library libruby.2.5.3-static.a
make[1]: Nothing to be done for `srcs'.
generating transdb.h
/opt/local/bin/ranlib: object: libruby.2.5.3-static.a(dln.o) malformed object (unknown load command 1)
ar: internal ranlib command failed
make: *** [libruby.2.5.3-static.a] Error 1
make: *** Waiting for unfinished jobs....
transdb.h updated
The issue seems to be here:
/opt/local/bin/ranlib: object: libruby.2.5.3-static.a(dln.o) malformed object (unknown load command 1)
ar: internal ranlib command failed
make: *** [libruby.2.5.3-static.a] Error 1
What I've tried
Installing, reinstalling, uninstalling rvm, rbenv.
Updating, reinstalling XCode.
Deleting, installing, XCode command line tools.
What is causing this?
Update
gcc --version returns:
gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin18.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
For anyone else who steps on the same landmine, for me it was that there was an incompatible copy of ranlib from homebrew via the cctools package. To fix it, I just uninstalled it:
brew uninstall cctools
For those who find this and aren't helped by the above solution...
I ran into this issue as well. In my case it was due to MacPorts being outdated after I upgraded to (MacOS) Mojave.
I followed the steps listed on MacPorts' migration guide here:
https://trac.macports.org/wiki/Migration
Closed and reopened Terminal (just b/c)
ran rvm install ruby and got Install of ruby-2.6.0 - #complete, hooray!
So, I think the fix to this was running:
$ sudo xcodebuild -runFirstLaunch
Why? I'm not sure. My suspicion is I tried to build ruby before updating XCode. But once I had updated XCode I suspect the wrong/older command line tool was still being referenced somehow.
I don't know exactly what fixed this but I completely deleted XCode and ruby still didn't install.
Then I completely deleted command line tools and ruby still didn't install.
Then I reinstalled just the command line tools without XCode and ruby still didn't install.
Then I ran this runFirstLaunch command and ruby installed.

Installing gphoto2 on mac os x Yosemite - issue with ./configure

I am trying to install gphoto2 on my macbook pro. I installed the tar.gz from their website and from terminal I cd Downloads and run ./configure as the README file recommends doing. I keep receiving this error:
checking for pkg-config... false
configure: error:
*** Build requires pkg-config
***
*** Possible solutions:
*** - set PKG_CONFIG to where your pkg-config is located
*** - set PATH to include the directory where pkg-config is installed
*** - get it from http://freedesktop.org/software/pkgconfig/ and install it
I have Xcode 6 installed, as well as Command Line tools (tested it by running gcc in terminal). What am I doing wrong? What should I do?
Also, should I install gphoto2 or libgphoto2?
I wouldn't bother faffing around with building it yourself. I would install homebrew from here.
Then you can simply do
brew install gphoto2
and you will also have a decent package manager if you want to install other cool stuff later on - e.g. ImageMagick, gawk, GNU sed, swatch, youtube-downloader, wxWidgets, vips, redis, sox, ffmpeg. To find other cool stuff that can be managed with homebrew just do
brew search

fontforge building in brew, terminal cant find gcc error

This is my first time trying to compile source code in terminal (I installed gimp using macPorts but this could be part of the problem...?)
I want to install fontforge and I was following these instructions how to install fontforge.
I got this warning while installing brew:
Warning: The following *evil* dylibs exist in /usr/local/lib
They may break builds or worse. You should consider deleting them:
/usr/local/lib/libssl.0.9.8.dylib
I could not find usr/local/lib and the only libssl file was in opt/local/lib called libssl.1.0.0.dylib which is supposed to be hidden apparently...
I made it to the "brew install cairo --use-clang" step, then when I try the "brew install fontforge --use-gcc" step I get the following warning:
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
==> Installing fontforge dependency: gettext
Error: GCC could not be found
when I check gcc version I get:
:~ me$ gcc --V
i686-apple-darwin11-llvm-gcc-4.2: no input files
Do I need to uninstall macports (then re-install gimp?)
I read gcc comes with xcode, I have xcode 4.3 (upgraded after this issue but didn't fix it) so do I have gcc or not? is there another way to check etc.
Can anyone tell me what I am doing wrong (what I broke etc)?
NOTE I also have flashbuilder which has a program called gcc as well (I dont know if this broke the other gcc...)

Xcode - configure: error: no acceptable C compiler found in $PATH

rebuilding a mac from scratch. Installed xcode and rvm then trying to install rubies but they are all giving me:
Error running ' ./configure --prefix=/Users/durrantm/.rvm/rubies/ruby-1.9.3-p125
--enable-shared --disable-install-doc --with-libyaml
--with-opt-dir=/Users/durrantm/.rvm/usr ',
please read /Users/durrantm/.rvm/log/ruby-1.9.3-p125/configure.log
There has been an error while running configure. Halting the installation.
Michaels-MacBook-Air:~ durrantm$
The log has:
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/durrantm/.rvm/src/ruby-1.9.2-p290':
configure: error: no acceptable C compiler found in $PATH
Do I need the gcc C compliler? How do I install it ?
The critical step is actually installing the Xcode command line tools after the download completes and Xcode is installed
After downloading and installing Xcode from the app store, you need to actually install the command line tools it provides.
To do this open Xcode, go to preferences then downloads. There is an "Install" link to add the command line tools.
Once this has been completed, make sure to re-open your terminal window.
Either you install Xcode from the App store or if you have a registered free developer account you can download the XCode command line tools from http://developer.apple.com/downloads
Once you have that installed you can go ahead and install your rubies with rvm.
rbenv install error :
configure: error: in `/tmp/ruby-build.20130911002344.31969/ruby-2.0.0-p0':
configure: error: no acceptable C compiler found in $PATH
...brought me here,
I am currently installing Ruby on rails, ruby through rbenv on a brand new Debian,
Original command is :
rbenv install 2.0.0-p0
As a solution :
sudo apt-get install build-essential
Cheers !
[Sorry for the Xcode ppl]
Read rvm requirements it shows what you need to compile ruby.

Resources