CocoaPods folder does not exist / permissions error

被刻印的时光 ゝ 提交于 2019-12-08 04:18:08

问题


I'm new to CocoaPods, I tried running 'pod install' on my Mac to install my pod, but I'm getting a permissions error with the folder /Users/username/Library/Caches/CocoaPods. That folder doesn't even exist! Did I accidentally delete it at one point? How do I restore it? There is however a folder called /Library/Caches but its not under my username, its at the root.

I'm a little confused. If someone can just direct me in the right direction, I would really appreciate it.

Here is the full error message:

Errno::EACCES - Permission denied @ dir_s_mkdir - /Users/nachshonfertel/Library/Caches/CocoaPods

回答1:


Are you using system Ruby or have you installed Ruby with sudo?

You basically have 2 options:

  • use sudo pod install

    • Probably the easiest/fastest way for you go forward
    • This typically causes more problems than Ruby being owned by non-root
    • When you install packages they will have sudo access!
  • Install Ruby, non-sudo; you can try

    • github.com/postmodern/ruby-install together with github.com/postmodern/chruby (my personal favourite), rvm.io is also very popular
    • The benefit of this approach is that you also can switch Ruby version whenever you like (and as mentioned above; more secure less insecure..)



回答2:


Turns out it was a permissions error. And the folder I thought didn't exist, was hidden in finder > Go > (Hold Down Option Key) Library

Took me 2 full days to finally figure it out!




回答3:


I had been struggling with this issue for a while. For some reason, in my case the problem was that the folder ~/Library/Caches/CocoaPods was not there, and cocoapods wasn't able to create it when running 'pod install'. Hence the permission error.

After trying several things, I created that folder manually (which prompted for my password), ran 'pod update' and my problem was fixed!

Hope this saves someone some trouble.




回答4:


I solved the problem creating the missing folder Users (in my case the error was Permission denied @ dir_s_mkdir - /Users/Users) and give full permission to all users.




回答5:


You can solve this in 2 ways.

  1. Add CocoaPods folder on ~/Library/Caches/CocoaPods then try

pod install

OR

  1. Give full permission on you project
  1. cd your-project
  2. chmod -R 777 .
  3. cd ios
  4. pod install


来源:https://stackoverflow.com/questions/51181915/cocoapods-folder-does-not-exist-permissions-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!