I followed the instructions as verbatim on https://github.com/google/EarlGrey/blob/master/docs/install-and-run.md#cocoapods-installation and I when I run pod install, I get:
LoadError - cannot load such file -- earlgrey
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:121:in `require'
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:121:in `require'
What am I missing?
EarlGrey uses the the earlgrey gem in order to download any Swift or CocoaPods dependencies as stated here in the doc. It seems like the gem wasn't installed correctly.
Remember that gems are installed in /usr/local/bin, which you might need to provide access to. To do so, do sudo gem install earlgrey or sudo gem install -n /usr/local/bin and you should be ready to go!
I'm running exactly the same issue and I couldn't fix it using sudo gem install earlgrey or sudo gem install -n /usr/local/bin. I couldn't find any solution yet - fix doesn't work because of latest update to macOS Sierra (just guessing)?
LoadError - cannot load such file -- earlgrey
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
#edit:
Found a solution.
1. Download and place configure_earlgrey.rb file in the same folder where yours Podfile is.
https://raw.githubusercontent.com/google/EarlGrey/master/gem/lib/earlgrey/configure_earlgrey.rb
2. Replace require 'earlgrey' with load 'configure_earlgrey.rb' in post_install part inside Podfile.
3. Do pod install again.
sudo arch -x86_64 gem install ffi
Then
arch -x86_64 pod install
Related
I just start a react-native project. However, this question had me for a day.
I tried all possible way to solve it. For example,
sudo gem uninstall cocoapods
rvm uninstall
brew install cocoapods
However, there is no luck for me.
I would like to point out that I can pod --version under other path but issue occur when I try to pod under my project path. I also tried to set rvm default version to 2.7.5 but issue still happen.
Also, I am not using Apple M1
Traceback (most recent call last):
4: from /Users/nicholas/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `<main>'
3: from /Users/nicholas/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `eval'
2: from /Users/nicholas/.rvm/gems/ruby-2.7.5/bin/pod:23:in `<main>'
1: from /Users/nicholas/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems.rb:296:in `activate_bin_path'
/Users/nicholas/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems.rb:277:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)
Try running bundle install in the root of your project. Then either go to ios and run pod install or use npx pod-install from the project root.
This issue is due to the difference in your default ruby version and ruby version specified in Gemfile . To install multiple ruby version you have to install rvm on your system and then install multiple rub versions. after install the ruby version specified in you gem file. you have to run the bundle install command . link
bundle install is a command we use to install the dependencies specified in your Gemfile.
Gemfile
Simply put, Gemfile is a format for describing gem dependencies for Ruby programs. Or you can say it contains the gems you need in this project.
After this you can install run npx pod-install or cd ios and pod install
Bundle install prior to pod install works.
To answer Bundle Install, what happens is, when generating react native project the configuration is set to default mac gem version. If you have updated gem version on your mac the project configuration could not pick the correct gem version. thats why it throws the can't find gem cocoapods.
by doing Bundle install, It will update the project config according to the mac gem version.
Remove cocoapods:
sudo gem uninstall cocoapods
Then instal again:
sudo gem install -n /usr/local/bin cocoapods
I'm working on a jekyll site on Ubuntu 15.04 and when i try jekyll serve (or any other jekyll command, with or without sudo) i receive the following:
/var/lib/gems/2.1.0/gems/jekyll-3.1.2/bin/jekyll:9:in `<top (required)>': undefined method `require_from_bundler' for Jekyll::PluginManager:Class (NoMethodError)
from /usr/local/bin/jekyll:23:in `load'
from /usr/local/bin/jekyll:23:in `<main>'
I have worked on jekyll sites on this computer recently without this issue, and I'm not certain how the configuration changed to generate this error. I've tried gem uninstall jekyll and reinstalling it, same issue happens. I'm not a Ruby dev and I'm a bit at a loss for how to troubleshoot this.
Well, I suggest you to run Jekyll with Bundler, which is an awesome dependency manager. It will make sure you have all the gems you need.
1st. Uninstall Jekyll 2.2.0. This version is too old and requires Python to run some dependencies. Jekyll 3.x does not require Python anymore.
So, run sudo gem uninstall jekyll --version 2.2.0. (or gem uninstall jekyll -v 2.2.0)
2nd. Now, install Bundler:
gem install bundler (or sudo gem install bundler)
3rd. Add a Gemfile (don't give it any extension) to your site root with the following content:
source "https://rubygems.org"
gem 'jekyll', '3.1.2'
This will make sure you will have installed Jekyll 3.1.2 and all its dependencies.
If you will deploy your site to GitHub, the Gemfile must be different:
source "https://rubygems.org"
gem 'github-pages'
This will include the Jekyll version running at GitHub pages at the time.
4th. Using the terminal, cd path/to/path to your site root and run bundle install there. Bundler will install all the dependencies for you and create a new file called Gemfile.lock, which will have a list of all dependencies installed for that project.
5th. Run bundle exec jekyll serve
Done!
NOTE 1: I recommend you to use Jekyll 3.0.3, as I think it's better then 3.1.2 (it seems there are some bugs on 3.1.2 which don't have in 3.0.3). Anyway, opinion based tip - it's up to you.
NOTE 2: If you don't have openssl installed to your computer, replace the protocol in your Gemfile:
source "https://rubygems.org"
replace for
source "http://rubygems.org"
For reference:
Jekyll 2x-to-3x
Jekyll on GitHub
That's it! Hope to have helped!
I installed CocoaPods and it says Successfully installed cocoapods-0.33.1, but whatever I would try to do with pod command, like pod install, I get the following console output:
Max$ pod install
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin14/rbconfig.rb:213: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- xcodeproj/prebuilt/universal.x86_64-darwin14-2.0.0/xcodeproj_ext (LoadError)
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 /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj/ext.rb:6:in `rescue in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj/ext.rb:3: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 /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj.rb:30: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 /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods.rb:2: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 /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/bin/pod:32:in `<top (required)>'
from /usr/bin/pod:23:in `load'
from /usr/bin/pod:23:in `<main>'
I am using Mac OS 10.10 (Yosemite beta version) and Xcode 6.0 beta2, but I think back when I used Mavericks and Xcode 5.1.1 I had the same problem.
I finally solved my problem.
Short answer:
I had to install ruby 2.1.2, then reinstall cocoapods and everything worked.
Long answer:
Resolve all warnings from brew doctor;
remove unused libraries;
remove MacPorts;
resolve additional warnings which I already do not remember;
I might even reinstalled brew.
Install rvm;
Install & use ruby 2.1.2 using rvm;
rvm requirements complains about many missing packages, install them;
among them, there is gcc46, which I was unable to install. After Xcode 4.2 or something, command line tools come without gcc. So if rvm requirements does not find one, it suggests gcc46. But the point is, installing brew install apple-gcc42 solves the problem. rvm requirements stops complaining and you can install ruby 2.1.2:
rvm install 2.1.2;
rvm use 2.1.2;
Install cocoapods, as suggested in #Varsha Vijayvargiya's answer.
I might forgot something, so if you have any questions - ask. Here are some links which helped me:
update mac osx to 10.10 and pod cannot work;
Installing Ruby 2.0.0 with RVM and Homebrew on Mac OS X 10.8 Mountain Lion;
Homebrew GCC won't install on OS X 10.10 Yosemite with Xcode 6;
Installing gcc on Mavericks.
-- Open Xcode 6
-- Open Preferences
-- click on Locations tab
-- Change the Command Line Tools version to Xcode 6.0
-- Uninstall cocoapods
$ sudo gem uninstall cocoapods
-- Install xcodeproj
$ sudo gem install xcodeproj
-- Install cocoapods
$ sudo gem install cocoapods
-- Run pod.
You most probably missed a step, but it's not your fault.
sudo gem install cocoapods
pod setup <–- this is not specified by the doc even though it's vital
pod install
See https://github.com/CocoaPods/CocoaPods/issues/2219
Or check that if you have multi ruby versions in your system:rbenv versions, and try rbenv global 1.9.x to change your ruby version for installing.
First warning says that you've insecure permissions for your bin directory:
local:Documents liuxiaojun$ gem update --system
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin14/rbconfig.rb:213: warning: Insecure world writable dir /usr/bin in PATH, mode 040777
Updating rubygems-update
Successfully installed rubygems-update-2.4.3
Parsing documentation for rubygems-update-2.4.3
Installing RubyGems 2.4.3
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin14/rbconfig.rb:213: warning: Insecure world writable dir /usr/bin in PATH, mode 040777
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin14/rbconfig.rb:213: warning: Insecure world writable dir /usr/bin in PATH, mode 040777
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Library/Ruby/Site/2.0.0/gauntlet_rubygems.rb
==========
brew install ruby
OK
First warning says that you've insecure permissions for your bin directory:
warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
See: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
You can fix it via (you need root credentials):
sudo chmod go-w /usr/local/bin
The error 'require': cannot load such file indicates that you some missing or broken gem package. You can probably fix it by re-installing cocoapods:
gem uninstall cocoapods # Follow by sudo if necessary
gem install cocoapods --verbose # Follow by sudo if necessary
And make sure that your xcodeproj is present:
gem install xcodeproj --verbose # Follow by sudo if necessary
my experience: I had the same error after upgrading to Yosemite, I just did a "gem update" and it worked.
rubygems/dependency.rb:296:in `to_specs': Could not find 'cocoapods' (>= 0) among 35 total gem(s) (Gem::LoadError)
from /Users/divyam.shukla/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /Users/user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /Users/user/.rvm/gems/ruby-2.0.0-p247/bin/pod:22:in `<main>'
I am getting this error.
Hey I had the same problem that you have, I solve it following the next steps:
(I strongly recommend to use rvm to manage ruby versions)
Remove cocoapods using gem uninstall cocoapods
Install rvm, to do this I followed this steps
https://rvm.io/rvm/install
After that reinstall cocoapods using gem install cocoapods
run pod setup
And after that everything works like a charm!.
You could notice that I didn't use sudo.
Hope it could helps you.
EDIT: If you have a slow internet connection it could take several minutes, to check the progress or steps use pod setup --verbose
I just ran this without doing any changes using rvm.
I do have rvm version: rvm 1.25.30 (stable).
Step 1: sudo gem uninstall cocoapods
Step 2: gem install cocoapods
Step 3: pod setup
Make sure not to install with sudo.
do this :
sudo gem install -n /usr/local/bin cocoapods
I'm using Postgres.app on OS X (10.8.3). I have modified my PATH so that the bin folder for the app is before all others.
Rammy:~ phrogz$ which pg_config
/Applications/Postgres.app/Contents/MacOS/bin/pg_config
I have rvm installed and can install the pg gem without error, but when I go to require it I get an error:
Rammy:~ phrogz$ gem -v
1.8.25
Rammy:~ phrogz$ gem install pg
Fetching: pg-0.15.1.gem (100%)
Building native extensions. This could take a while...
Successfully installed pg-0.15.1
1 gem installed
Rammy:~ phrogz$ ruby -v -e "require 'pg'"
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.3.0]
/Users/phrogz/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': dlopen(/Users/phrogz/.rvm/gems/ruby-1.9.3-p392/gems/pg-0.15.1/lib/pg_ext.bundle, 9): Library not loaded: #executable_path/../lib/libssl.1.0.0.dylib (LoadError)
Referenced from: /Applications/Postgres.app/Contents/MacOS/lib/libpq.dylib
Reason: image not found - /Users/phrogz/.rvm/gems/ruby-1.9.3-p392/gems/pg-0.15.1/lib/pg_ext.bundle
from /Users/phrogz/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/phrogz/.rvm/gems/ruby-1.9.3-p392/gems/pg-0.15.1/lib/pg.rb:4:in `<top (required)>'
from /Users/phrogz/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /Users/phrogz/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /Users/phrogz/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from -e:1:in `<main>'
What do I need to do to get the pg gem properly installed?
Edit: Even though this answer currently has more votes than the accepted answer, the accepted answer is far simpler and cleaner.
Remove the Postgres.app binaries from the path when installing the pg gem, and instead use the postgres install built into OS X to configure the gem. The pg library will still correctly connect to the Postgres.app server later on.
Rammy:~ phrogz$ gem uninstall pg
Successfully uninstalled pg-0.15.1
# Modify PATH to remove /Applications/Postgres.app/Contents/MacOS/bin
Rammy:~ phrogz$ gem install pg
Fetching: pg-0.15.1.gem (100%)
Building native extensions. This could take a while...
Successfully installed pg-0.15.1
1 gem installed
Rammy:~ phrogz$ ruby -v -e "require 'pg'"
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.3.0]
I found a solution that works for me and requires minimal hacking/configuring. You only need to do this once and it will work for every bundle install. Add the following to your .bash_profile, .bash_rc, or equivalent:
export DYLD_FALLBACK_LIBRARY_PATH=/Applications/Postgres.app/Contents/MacOS/lib:$DYLD_LIBRARY_PATH
(Assuming you installed Postgres.app in the default location). Then restart your terminal session and try again.
Exporting to DYLD_LIBRARY_PATH directly can cause serious problems with other apps that depend on it, but using the fallback path avoids these problems.
See also:
https://github.com/PostgresApp/PostgresApp/issues/109#issuecomment-18387546
Postgres.app upgrade, now Rails app won't start
EDIT: It seems that setting DYLD_FALLBACK_LIBRARY_PATH causes an error when you try to run psql. To fix this, you can add the following two lines to your .bash_profile:
alias psql="(. ~/.bash_profile; unset DYLD_FALLBACK_LIBRARY_PATH; psql)";
This is assuming that you're using bash and that your .bash_profile is located in your home directory. If that's not the case (or if you're using a .bashrc or other environment setup instead of .bash_profile) change the ~/.bash_profile part of the command to the path to your environment setup script.
The aliased commands basically start a subshell which does not effect your current bash environment. So when it unsets the DYLD_FALLBACK_LIBRARY_PATH variable, it's only temporary. After you exit psql the environment variable will be set again so that rails functions properly.
This worked for me:
sudo env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/Applications/Postgres93.app/Contents/MacOS/bin/pg_config
Just double check that the /Applications/Postgres93.app.. path exists for you.
The problem is in the linking of the gem to the Postgres.app.
If you link it to the postgres version that ships with osx
Here's a small script:
if using rvm with project gemsets: change into your project
run the following commands:
gem uninstall pg
PATH=${PATH/'Postgres.app'/'WRONGFOLDER.app'}
gem install pg
PATH=${PATH/'WRONGFOLDER.app'/'Postgres.app'}
Now everthing should be fine