orta / cocoapods-keys

A key value store for storing per-developer environment and application keys
MIT License
1.55k stars 93 forks source link

Late installation problems despite following instructions #225

Closed houmie closed 2 years ago

houmie commented 2 years ago

Dear all,

➜ gem install cocoapods-keys
Successfully installed cocoapods-keys-2.2.1
Parsing documentation for cocoapods-keys-2.2.1
Done installing documentation for cocoapods-keys after 0 seconds
1 gem installed

➜  pod install
[!] Your Podfile requires that the plugin `cocoapods-keys` be installed. Please install it and try installation again.

As you can see despite the gem being installed, Pod can't be installed.

➜  rbenv install -l
2.6.9
2.7.5
3.0.3
jruby-9.3.2.0
mruby-3.0.0
rbx-5.0
truffleruby-21.3.0
truffleruby+graalvm-21.3.0

➜  which ruby
/Users/houmie/.rbenv/shims/ruby

➜  ruby -v
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-darwin21]

Please help me, I hate Ruby. I'm completely stuck.

ashfurrow commented 2 years ago

Are you using a Gemfile in your project directory? You may need to add cocoapods-keys as a dependency there.

houmie commented 2 years ago

Hi @ashfurrow

Thank you for your reply.

No Gemfile in my project file.

Here is my .zshrc in case I did something wrong:

export ZPLUG_HOME=/usr/local/opt/zplug
source $ZPLUG_HOME/init.zsh
export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/usr/local/share/zsh-syntax-highlighting/highlighters
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
export PATH="$HOME/.pyenv/bin:$PATH"
export PATH="/usr/local/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/zlib/lib -L/usr/local/opt/bzip2/lib -L/usr/local/opt/openssl@3/lib -L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include -I/usr/local/opt/openssl@3/include -I/usr/local/opt/ruby/include"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
export PATH="/usr/local/opt/openssl@3/bin:$PATH"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig"
export PATH="/usr/local/opt/ruby/bin:$PATH"
eval "$(rbenv init -)"
ashfurrow commented 2 years ago

Gotcha, that context is helpful.

So you basically have two options for how to proceed. You can either dig deeper into your system's Ruby installation and gems and whatnot, which you don't sound keen on, or you can use a Gemfile. Ruby uses a tool called Bundler to kind of scope a set of gems (at specific versions) to a project. After setup, you use bundle exec pod install instead of just pod install to force the Gemfile's gems to get used.

The steps I would take are:

gem install bundler # Install Bundler globally
bundle init # Generate a Gemfile
echo "gem 'cocoapods'" >> Gemfile # Add CocoaPods
echo "gem 'cocoapods-keys'" >> Gemfile # Add CocoaPods-Keys
bundle install # Install the gems
bundle exec pod install

This will also create a Gemfile.lock file that locks the gems to their current versions.

Of course, there's not guarantee this will work, but it's what I would suggest trying next. Using a Gemfile is very conventional on Ruby projects and, in my experience, helps avoid the kinds of problems you've reported.

Good luck and let us know 👍

houmie commented 2 years ago

Yes, it works!!!! Thank you so much!

Is there any chance this could be done via brew in future instead of gem, just an idea to ease the pain, not sure if possible. :-)

ashfurrow commented 2 years ago

Awesome, glad it worked 👍 It's unlikely we could replicate this setup with homebrew because CocoaPods is a Ruby gem, and gems are the right tool for CocoaPods plugins. I promise that Ruby isn't so bad! It can just be intimidating at first.