简体   繁体   English

可可豆荚安装在用户目录内(无须藤)

[英]Cocoa pods install inside user directory(without sudo)

I can only access my directory, so I want to install the cocoa pods to the users directory. 我只能访问我的目录,因此我想将可可豆荚安装到用户目录。 How can I achieve this? 我该如何实现? I follow the below link but is not working. 我点击以下链接,但无法正常工作。 Sudo-less installation Please assist me how to achieve this. 无须Sudo的安装,请协助我如何实现此目的。 I'll be very thankful if any one provide me step by step procedure to achieve this. 如果有人一步步为我实现这一目标,我将非常感激。

What I tried 我尝试了什么

gem install cocoapods --user-install

Error I'm getting 我收到错误

/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>'

Thanks in advance 提前致谢

I'm posting the steps which worked form me (In case any one need this). 我正在发布对我有用的步骤(以防任何人需要此步骤)。

I used Homebrew and bundler 我用Homebrewbundler

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

Install brew-gem: brew install brew-gem 安装brew-gem: brew install brew-gem

Install bundler: brew gem install bundler bundler is a package management tool which provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed. 安装捆绑程序: brew gem install bundler bundler是一个软件包管理工具,它通过跟踪和安装所需的确切gem和版本来为Ruby项目提供一致的环境。

Then add cocoapod in gemfile (if gemfile is missing then, use bundle init to create gemfile ). 然后在gemfile添加cocoapod (如果缺少gemfile ,则使用bundle init创建gemfile )。

Then naviaged to your project directory and execute following command 然后导航到您的项目目录并执行以下命令

bundle install --path vendor

The above command will look the gemfile and install the all the gems in the vendor directory. 上面的命令将查找gemfile并将所有gems安装在vendor目录中。

Now onward prefix the bundle exe to add the cocoapod commands. 现在开始为bundle exe加上前缀以添加cocoapod命令。 ie

bundle exec pod install

bundle exec pod update

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM