Cocoa pods安装在用户目录中(没有sudo)

时间:2016-04-23 02:09:03

标签: ios xcode macos cocoapods

我只能访问我的目录,所以我想将cocoa pod安装到users目录。我怎样才能做到这一点? 我按照以下链接但无法正常工作。 Sudo-less installation 请帮助我如何实现这一目标。 如果有人为我提供一步一步的程序,我将非常感激。

我尝试了什么

gem install cocoapods --user-install

错误我正在

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:959:in `read': Permission denied - /Library/Ruby/Gems/2.0.0/specifications/terminal-notifier-1.6.0.gemspec (Errno::EACCES)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:959:in `load'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:644:in `block (2 levels) in each_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:643:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:643:in `block in each_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:642:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:642:in `each_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:658:in `each_normal'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:669:in `_all'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:822:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems.rb:431:in `map'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems.rb:431:in `find_files'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems.rb:942:in `load_plugins'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/gem_runner.rb:73:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/bin/gem:9:in `<main>'

提前致谢

1 个答案:

答案 0 :(得分:0)

我发布了形成我的步骤(如果有人需要的话)。

我使用了Homebrewbundler

安装自制软件: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装brew-gem: brew install brew-gem

安装捆绑包: brew gem install bundler bundler是一个包管理工具,它通过跟踪和安装所需的确切gem和版本,为Ruby项目提供一致的环境。

然后在cocoapod中添加gemfile(如果缺少gemfile,请使用bundle init创建gemfile)。

然后导航到您的项目目录并执行以下命令

bundle install --path vendor

以上命令将显示gemfile并安装vendor目录中的所有gem。

现在向前添加bundle exe前缀以添加cocoapod命令。 即

bundle exec pod install

bundle exec pod update