CocoaPods / CocoaPods

The Cocoa Dependency Manager.
https://cocoapods.org/
Other
14.57k stars 2.63k forks source link

Running pod install | Permission denied @ dir_s_rmdir #11522

Closed muathkhatib closed 1 year ago

muathkhatib commented 2 years ago

Report

What did you do?

Run pod install

What did you expect to happen?

What do you expect to happen?
Install all pod dependencies correctly.

What happened instead?

I received this error message

Error

Adding a custom script phase for Pod RNFBApp: [RNFB] Core Configuration
Adding a custom script phase for Pod RNFBCrashlytics: [RNFB] Crashlytics Configuration
Auto-linking React Native modules for target `Hera`: RNCAsyncStorage, RNCCheckbox, RNCPicker, RNDateTimePicker, RNFBApp, RNFBCrashlytics, RNGestureHandler, RNLocalize, RNPermissions, RNScreens, RNVectorIcons, react-native-config, react-native-device-country, react-native-geolocation, react-native-heap, react-native-image-picker, react-native-maps, react-native-onesignal, react-native-restart, react-native-safe-area-context, and react-native-webview
Analyzing dependencies
touch: ../../React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h: Permission denied
touch: ../../React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm: Permission denied
Downloading dependencies

Stack

   CocoaPods : 1.11.3
        Ruby : ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.x86_64-darwin21]
    RubyGems : 3.0.3.1
        Host : macOS 12.5.1 (21G83)
       Xcode : 13.4.1 (13F100)
         Git : git version 2.32.1 (Apple Git-133)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Plugins

cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0

Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'

target 'Hera' do
  # React Native Maps dependencies
  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path
  config = use_native_modules!
  pod 'react-native-restart', :path => '../node_modules/react-native-restart'

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

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  )

  target 'HeraTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
  end
end

target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
end

Error

Errno::EACCES - Permission denied @ dir_s_rmdir - /Users/macbook/Desktop/work/hera/Hera-Mobile-App/ios/Pods/Headers/Private/CocoaAsyncSocket
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1432:in `rmdir'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1432:in `block in remove_dir1'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1443:in `platform_support'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1431:in `remove_dir1'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1424:in `remove'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:760:in `block in remove_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1481:in `ensure in postorder_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1481:in `postorder_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:758:in `remove_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:610:in `block in rm_r'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:606:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:606:in `rm_r'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/pathname.rb:589:in `rmtree'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/sandbox/headers_store.rb:88:in `implode_path!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:451:in `block in clean_sandbox'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:450:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:450:in `clean_sandbox'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:299:in `generate_pods_project'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:180:in `integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:167:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
rishiankush commented 2 years ago

sudo pod install --allow-root worked for me

muathkhatib commented 2 years ago

sudo pod install --allow-root worked for me

FpKCz

I tried to run it with root permission after that, I face a problem on XCode Couldn't load project Pods.xcodeproj

DmitrySemenyk commented 2 years ago

@muathkhatib are you solved your issue ? I have the same issue

Errno::EACCES: Permission denied @ rb_sysopen - /Users/dmitriy.semenyuk/Desktop/Work/demo-app/.mbuild/demo-app-ios/ide/xcode_project/Pods/Ads-Global/SDK/BUFoundation.framework/Versions/A/Headers/BUPersistence.h
/Users/dmitriy.semenyuk/.rvm/gems/ruby-3.0.2/gems/mbuild2-1.15.0/lib/mbuild/commands.rb:216:in `block in cp_smart'
/Users/dmitriy.semenyuk/.rvm/gems/ruby-3.0.2/gems/mbuild2-1.15.0/lib/mbuild/commands.rb:203:in `each'
/Users/dmitriy.semenyuk/.rvm/gems/ruby-3.0.2/gems/mbuild2-1.15.0/lib/mbuild/commands.rb:203:in `cp_smart'
/Users/dmitriy.semenyuk/.rvm/gems/ruby-3.0.2/gems/mbuild2-1.15.0/lib/mbuild.rb:297:in `block in new_top_level'
salimsea commented 1 year ago

I have this issue too, has anyone solved it yet?

salimsea commented 1 year ago

I have this issue too, has anyone solved it yet?

Alhamdulillah, i have managed to solve this problem

try this :

  1. remove Folder CocoaPods (cd ~/Library/Caches/CocoaPods)
  2. try add new mkdir CocoaPods (dont forget allow root : sudo chmod 777 CocoaPods)
  3. go to cd CocoaPods, create mkdir Pods (dont forget allow root : sudo chmod 777 Pods)
  4. back to project open cmd, check current user (command : whoami)
  5. finally, sudo chown -R ownerName: node_modules/
  6. try again in project cd ios && pod install
muathkhatib commented 1 year ago

@muathkhatib are you solved your issue ? I have the same issue

Errno::EACCES: Permission denied @ rb_sysopen - /Users/dmitriy.semenyuk/Desktop/Work/demo-app/.mbuild/demo-app-ios/ide/xcode_project/Pods/Ads-Global/SDK/BUFoundation.framework/Versions/A/Headers/BUPersistence.h
/Users/dmitriy.semenyuk/.rvm/gems/ruby-3.0.2/gems/mbuild2-1.15.0/lib/mbuild/commands.rb:216:in `block in cp_smart'
/Users/dmitriy.semenyuk/.rvm/gems/ruby-3.0.2/gems/mbuild2-1.15.0/lib/mbuild/commands.rb:203:in `each'
/Users/dmitriy.semenyuk/.rvm/gems/ruby-3.0.2/gems/mbuild2-1.15.0/lib/mbuild/commands.rb:203:in `cp_smart'
/Users/dmitriy.semenyuk/.rvm/gems/ruby-3.0.2/gems/mbuild2-1.15.0/lib/mbuild.rb:297:in `block in new_top_level'
Screen Shot 2022-12-29 at 19 08 19

Yes, Give your project folder permission read & write and apply it for enclosed items

zero19124 commented 8 months ago

I have this issue too, has anyone solved it yet?

Alhamdulillah, i have managed to solve this problem

try this :

  1. remove Folder CocoaPods (cd ~/Library/Caches/CocoaPods)
  2. try add new mkdir CocoaPods (dont forget allow root : sudo chmod 777 CocoaPods)
  3. go to cd CocoaPods, create mkdir Pods (dont forget allow root : sudo chmod 777 Pods)
  4. back to project open cmd, check current user (command : whoami)
  5. finally, sudo chown -R ownerName: node_modules/
  6. try again in project cd ios && pod install

worked here

rony-rr commented 7 months ago

I have this issue too, has anyone solved it yet?

Alhamdulillah, i have managed to solve this problem

try this :

  1. remove Folder CocoaPods (cd ~/Library/Caches/CocoaPods)
  2. try add new mkdir CocoaPods (dont forget allow root : sudo chmod 777 CocoaPods)
  3. go to cd CocoaPods, create mkdir Pods (dont forget allow root : sudo chmod 777 Pods)
  4. back to project open cmd, check current user (command : whoami)
  5. finally, sudo chown -R ownerName: node_modules/
  6. try again in project cd ios && pod install

Worked for me!

felipeshipeezi commented 5 months ago

I have this issue too, has anyone solved it yet?

Alhamdulillah, i have managed to solve this problem

try this :

  1. remove Folder CocoaPods (cd ~/Library/Caches/CocoaPods)
  2. try add new mkdir CocoaPods (dont forget allow root : sudo chmod 777 CocoaPods)
  3. go to cd CocoaPods, create mkdir Pods (dont forget allow root : sudo chmod 777 Pods)
  4. back to project open cmd, check current user (command : whoami)
  5. finally, sudo chown -R ownerName: node_modules/
  6. try again in project cd ios && pod install

Worked for me!

kalemayur8 commented 3 months ago

I have this issue too, has anyone solved it yet?

Alhamdulillah, i have managed to solve this problem

try this :

  1. remove Folder CocoaPods (cd ~/Library/Caches/CocoaPods)
  2. try add new mkdir CocoaPods (dont forget allow root : sudo chmod 777 CocoaPods)
  3. go to cd CocoaPods, create mkdir Pods (dont forget allow root : sudo chmod 777 Pods)
  4. back to project open cmd, check current user (command : whoami)
  5. finally, sudo chown -R ownerName: node_modules/
  6. try again in project cd ios && pod install

This one is perfect solution

axelvillamil commented 3 months ago

sudo pod install --allow-root worked for me

Works but this sadly messes up your Xcode project

marvin-kolja commented 2 months ago

Using Flutter which automatically installs pods when running flutter build ios etc. The following worked for me:

sudo chown -R $(shell whoami) ~/Library/Caches/CocoaPods
sudo chown -R $(shell whoami) ~/.cocoapods