cocoaPods pod install 权限被拒绝 [英] cocoaPods pod install Permission denied

查看:59
本文介绍了cocoaPods pod install 权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是简短的版本:

当我跑步时

pod install 

在 Xcode 项目中我得到了

in an Xcode project I get

[!] Pod::Executable pull 错误:无法打开 .git/FETCH_HEAD:权限被拒绝

[!] Pod::Executable pull error: cannot open .git/FETCH_HEAD: Permission denied

如果我跑步

sudo pod install

我没有收到任何错误,但我安装的文件归 root 所有,无法编译,我必须将这些文件 chown 给普通用户才能使用 Xcode 编译器.

I get no error, but my files installed are owned by root and can't compile and I have to chown those files to a normal user to use the Xcode compiler.

我正在运行 Lion OSX.

I am running Lion OSX.

我安装了 cocoaPods 使用

I installed cocoaPods using

sudo gem install cocoaPods

我不得不使用 sudo 因为没有它我得到了

I had to use sudo because without it I got

错误:执行 gem 时 ... (Gem::FilePermissionError)

ERROR: While executing gem ... (Gem::FilePermissionError)

您没有对/Library/Ruby/Gems/1.8 目录的写入权限.

You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.

所以现在我有一个 root 安装版本的 cocoaPods,它可以下载 root 拥有的 Xcode 库.

so now I have a root installed version of cocoaPods that downloads root owned Xcode libraries.

sudo安装cocoaPods是错误的方式还是正常的方式?

Is sudo installation of cocoaPods the wrong way or normal way?

如果正常,有没有办法解决 pod install 问题?

If normal, is there a way to fix the pod install problem?

推荐答案

我通过运行以下命令解决了这个问题:

I solved this problem by running the following command:

sudo chown -R $USER ~/Library/Caches/CocoaPods

sudo chown -R $USER ~/.cocoapods

请将 usernamegroupname 替换为您的 Mac 登录用户名/组名.

Please replace username and groupname with your Mac login username/groupname.

这篇关于cocoaPods pod install 权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆