I see many, many instances of similar issues related to recent Mac OS/xCode updates with multitudes of proposed solutions that seem to work as often as not. So far, none have worked for me. Here’s what i’m seeing.
I have a long-standing xCode project with cocoapods. A second developer did some updates on a different system which resulted in build errors reading:
"The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation."
When I use the terminal to attempt "pod init, pod update, pod install, pod deintegrate etc… I get:
-bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory
The actual Ruby version that exists on my machine is 2.6, not 2.3
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby:
There is no folder on my machine located at
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby:
$ which ruby
says: /usr/bin/ruby
That file does exist.
Multiple sources say that ruby installed by HOMEBREW would be found at:
/usr/local/opt/ruby/bin/ruby
There is currently no alias for Ruby in that location.
/usr/local/opt is full of folder aliases but there is no "ruby" alias
I’ve deleted & reinstalled the xCode commandline tools but when I try to do basically anything with homebrew (brew doctor, brew update, brew upgrade etc…)I get errors like this:
Mainframe:~ username$ brew -v
Homebrew 0.9.5
Mainframe:~ username$ brew upgrade
Traceback (most recent call last):
4: from /usr/local/Library/brew.rb:31:in `<main>'
3: from /usr/local/Library/Homebrew/os/mac.rb:15:in `version'
2: from /usr/local/Library/Homebrew/os/mac.rb:15:in `new'
1: from /usr/local/Library/Homebrew/os/mac/version.rb:24:in `initialize'
/usr/local/Library/Homebrew/version.rb:176:in `initialize': Version value must be a string (TypeError)
All of this started (apparently) because something is different on the other developers machine. I’ve been chasing this issue around in circles for days and getting nowhere.
Having done all of this, I’m thinking the problem lies somewhere back at the beginning with my machine looking for a Ruby 2.3 that does not exist rather than the 2.6 that DOES exist but I have no clue how to tell for sure or how to fix it.
Any help would be greatly appreciated.
2
Answers
Solution: Hack the pod file
Short version: 1.) Open the file at usr/local/bin/pod 2.) Change 2.3 to 2.6 in the top line
Long version:
There is an executable file located at: usr/local/bin/pod The contents are as follows:
I opened the file at:
usr/local/bin/pod
and edited the first line to change 2.3 to 2.6.This had some effect. Now if I cd into my xcode project and try to run "pod update" I get a different error.
The pods now seem to be missing...
I ran:
It seems to have worked.
I ran:
It seems to have worked.
I opened the xCode project and ran a build. The error no longer occurred and the build succeeded.
Actually, that’s the source of the problem. Under no circumstances should you use the system ruby! Use rbenv to take control of your ruby versions.
Blap! Game over, thank you for playing. The fact that you have to say sudo is a major giveaway. This will lead to huge trouble later. Again, this is because you’re using the evil system ruby. This was always wrong. It is not intended for public use! Use rbenv and never say
sudo
again.