LoadError - library not found for class Digest::SHA1 -- digest/sha1

Peter G. picture Peter G. · Nov 25, 2019 · Viewed 18.2k times · Source

When running pod install it runs into a problem when installing yoga. Seems to be a problem with my ruby environment?

$ pod install
Analyzing dependencies
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `Permission-Camera` from `../node_modules/react-native-permissions/ios/Camera.podspec`
Fetching podspec for `Permission-LocationAlways` from `../node_modules/react-native-permissions/ios/LocationAlways.podspec`
Fetching podspec for `Permission-LocationWhenInUse` from `../node_modules/react-native-permissions/ios/LocationWhenInUse.podspec`
Fetching podspec for `RNPermissions` from `../node_modules/react-native-permissions`
Fetching podspec for `React` from `../node_modules/react-native/`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`

Command

/Users/User/.rbenv/versions/2.3.1/bin/pod install

Stack

   CocoaPods : 1.5.3
        Ruby : ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
    RubyGems : 2.5.1
        Host : Mac OS X 10.15.1 (19B88)
       Xcode : 11.2.1 (11B500)
         Git : git version 2.24.0
Ruby lib dir : /Users/User/.rbenv/versions/2.3.1/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 7f8d90dc76a619c74dfe5b8d17317599f6175fc3

Plugins

cocoapods-deintegrate : 1.0.2
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.3.1
cocoapods-try         : 1.1.0

Podfile

# Uncomment the next line to define a global platform for your project
 platform :ios, '9.0'

target 'default' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Your 'node_modules' directory is probably in the root of your project,
  # but if not, adjust the `:path` accordingly
  pod 'React', :path => '../node_modules/react-native/'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  # Pods for default
  pod 'GoogleIDFASupport'

  # Pods for ReactPushNotifications - Add these lines
  pod 'Firebase/Core'
  pod 'Firebase/Messaging'
  pod 'Firebase/Storage'

  # Pods for react-native-permissions
  pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
end

Error

LoadError - library not found for class Digest::SHA1 -- digest/sha1
/Users/User/.rbenv/versions/2.3.1/lib/ruby/2.3.0/digest.rb:16:in `const_missing'
/Users/User/.rvm/gems/ruby-2.4.1/gems/cocoapods-core-1.5.3/lib/cocoapods-core/specification.rb:566:in `checksum'
/Users/User/.rvm/gems/ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:641:in `block in generate_version_locking_dependencies'
/Users/User/.rvm/gems/ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:640:in `reject'
/Users/User/.rvm/gems/ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:640:in `generate_version_locking_dependencies'
/Users/User/.rvm/gems/ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:87:in `analyze'
/Users/User/.rvm/gems/ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:243:in `analyze'
/Users/User/.rvm/gems/ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:154:in `block in resolve_dependencies'
/Users/User/.rvm/gems/ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:64:in `section'
/Users/User/.rvm/gems/ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:153:in `resolve_dependencies'
/Users/User/.rvm/gems/ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:116:in `install!'
/Users/User/.rvm/gems/ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/command/install.rb:41:in `run'
/Users/User/.rvm/gems/ruby-2.4.1@global/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Users/User/.rvm/gems/ruby-2.4.1/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:in `run'
/Users/User/.rvm/gems/ruby-2.4.1/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
/Users/User/.rbenv/versions/2.3.1/bin/pod:23:in `load'
/Users/User/.rbenv/versions/2.3.1/bin/pod:23:in `<main>'

Answer

fguillen picture fguillen · Dec 16, 2019

For the me problem started after an unsolicited system update.

Uninstalling ruby and installing it again solved the issue:

rbenv uninstall 2.5.1
rbenv install 2.5.1