Skip to content

Instantly share code, notes, and snippets.

@alloy
Created November 3, 2014 15:17
Show Gist options
  • Select an option

  • Save alloy/62326fcbc5b8ef987c17 to your computer and use it in GitHub Desktop.

Select an option

Save alloy/62326fcbc5b8ef987c17 to your computer and use it in GitHub Desktop.
Fix Apple’s broken 10.9.0-10.9.2 default Ruby gems installation.

On Mac OS X 10.9.0 through 10.9.2, Apple shipped a Ruby and RubyGems installation that was missing specifications for the libraries that are included with Ruby by default, which leads to the user having to install a gem like the JSON gem even though the user already has that library installed.

(This is even more problematic if you want users to be able to install gems without having to have a properly configured compiler toolchain. I.e. where you do not want users to have to install gems with C extensions, such as the JSON gem.)

This was fixed starting from Mac OS X 10.9.3.

What it should look like

The following libraries are installed by default and should have their specifications installed:

$ ls -l /Library/Ruby/Gems/2.0.0/specifications/default
-rw-r--r--  1 eloy  staff   766 Oct 28 13:26 bigdecimal-1.2.0.gemspec
-rw-r--r--  1 eloy  staff   601 Oct 28 13:26 io-console-0.4.2.gemspec
-rw-r--r--  1 eloy  staff   537 Oct 28 13:26 json-1.7.7.gemspec
-rw-r--r--  1 eloy  staff   341 Oct 28 13:26 minitest-4.3.2.gemspec
-rw-r--r--  1 eloy  staff  4836 Oct 28 13:26 psych-2.0.0.gemspec
-rw-r--r--  1 eloy  staff  1481 Oct 28 13:26 rake-0.9.6.gemspec
-rw-r--r--  1 eloy  staff  2758 Oct 28 13:26 rdoc-4.0.0.gemspec
-rw-r--r--  1 eloy  staff   762 Oct 28 13:26 test-unit-2.0.0.0.gemspec

The fix

To fix, for instance, the JSON gem, perform the following steps:

$ sudo mkdir /Library/Ruby/Gems/2.0.0/specifications/default
$ sudo curl -o /Library/Ruby/Gems/2.0.0/specifications/default/json-1.7.7.gemspec \
               https://raw.githubusercontent.com/flori/json/v1.7.7/json.gemspec

After which you should have the following:

$ ls -l /Library/Ruby/Gems/2.0.0/specifications/default
-rw-r--r--  1 root  wheel  4842 Nov  3 13:32 json-1.7.7.gemspec
@Sangza
Copy link

Sangza commented Jan 9, 2024

y/Gems/2

did you later fix this.if yes please share how

@SoNaphen
Copy link

@SoNaphen
Copy link

@Navin5790
Copy link

How possible update

@RovanolWomo
Copy link

Bonjour ! j'ai un problème avec l'utilisation de CocoaPods, j'ai pu installer mais je n'arrive pas à utiliser. j'utilise un MacBoock pro 13inch IOS v13.7.6. voici mon erreur :

valere@valeres-MBP ~ % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.32.4, on macOS 13.7.6 22H625 darwin-x64, locale
fr-CM)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
[!] Xcode - develop for iOS and macOS (Xcode 14.3.1)
! Flutter recommends a minimum Xcode version of 15.
Download the latest version or update via the Mac App Store.
✗ CocoaPods installed but not working.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with
is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods.
For re-installation instructions, see
https://guides.cocoapods.org/using/getting-started.html#installation
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] VS Code (version 1.101.1)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 1 category.

@Abduliscode
Copy link

Bonjour ! j'ai un problème avec l'utilisation de CocoaPods, j'ai pu installer mais je n'arrive pas à utiliser. j'utilise un MacBoock pro 13inch IOS v13.7.6. voici mon erreur :

valere@valeres-MBP ~ % flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.32.4, on macOS 13.7.6 22H625 darwin-x64, locale fr-CM) [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1) [!] Xcode - develop for iOS and macOS (Xcode 14.3.1) ! Flutter recommends a minimum Xcode version of 15. Download the latest version or update via the Mac App Store. ✗ CocoaPods installed but not working. You appear to have CocoaPods installed but it is not working. This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it. This can usually be fixed by re-installing CocoaPods. For re-installation instructions, see https://guides.cocoapods.org/using/getting-started.html#installation [✓] Chrome - develop for the web [✓] Android Studio (version 2024.3) [✓] VS Code (version 1.101.1) [✓] Connected device (3 available) [✓] Network resources

! Doctor found issues in 1 category.

use this first sudo gem uninstall cocoapods -ax

Then this
brew install cocoapods

@romfix65
Copy link

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment