How do I use cocoapods 0.33.1 on Yosemite? - xcode6

Because of the breaking changes cocoapods 0.34.x introduces, I need to continue using 0.33.1 following my upgrade to Yosemite.
Unfortunately, running pod install produces this output:
$ pod install
/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 have Xcode 6.1 and latest command line tools. The answer to the following question no longer works: Can't get to work CocoaPods and Yosemite

Alright, it seems the easiest solution is to install a Ruby environment manager. This allows the appropriate Ruby version to be loaded when cocoapods asks for it. I haven't dug too deep, but it seems the version CP is looking for is incompatible. (???) Anyway, installing rbenv immediately solved my problem.
I chose rbenv but there's another called RVM. rbenv did a good job explaining the differences between the two, however.

Related

Rails console uninitialized constant MiniTest::Test (NameError) error

I use Rails. 3.2.16, with Rspec.
Recently when I run rails console I get the following error:
.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/minitest/unit.rb:28:in `const_missing': uninitialized constant MiniTest::Test (NameError)
from .rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/test/unit/testcase.rb:8:in `<module:Unit>'
from .rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/test/unit/testcase.rb:4:in `<module:Test>'
from .rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/test/unit/testcase.rb:3:in `<top (required)>'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/activesupport-3.2.16/lib/active_support/test_case.rb:1:in `<top (required)>'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/console/app.rb:2:in `<top (required)>'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/application.rb:312:in `initialize_console'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/application.rb:152:in `load_console'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/commands/console.rb:27:in `start'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/commands/console.rb:8:in `start'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
When I run rails server there are no problems.
Since I use Rspec, I don't have minitest in my Gemfile. However when I run gem list I can see:
minitest (5.3.3, 5.3.2, 4.7.5, 4.3.2)
And I am not sure why this suddenly happens.
Additional note
#user3364461 may have a related issue:
With RVM and last bundler (1.6.2) ruby 2.1.1, and rails 4.1. Happen
when I've updated some gem (Axlsx-rails, minitest, arel) If I force
minitest 5.3.2, it's the same bug with arel :
Could not find minitest-5.3.3 in any of the sources Run bundle install
to install missing gems.

Ruby on Rails + PostgreSQL app fails to start on AWS EC2. Error is: "cannot load such file -- pg_ext (LoadError)"

I began by installing all these dependencies:
sudo yum install ruby19 ruby19-devel gem rubygems19-devel make gcc postgresql9 postgresql9-devel postgresql9-server
Then I switch to the root user and I run
bundle install
and I get the green success message:
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
However, when I cd to the dir and run
rails s -p80
it I get all this and it fails to start (I'm still root because bind won't work to port 80 if I'm not root):
/usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- pg_ext (LoadError)
from /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/share/gems/gems/pg-0.14.0/lib/pg.rb:4:in `<top (required)>'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:68:in `require'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:66:in `each'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:66:in `block in require'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `each'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `require'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler.rb:128:in `require'
from /home/user/TransForm/config/application.rb:7:in `<top (required)>'
from /usr/local/share/gems/gems/railties-3.2.8/lib/rails/commands.rb:53:in `require'
from /usr/local/share/gems/gems/railties-3.2.8/lib/rails/commands.rb:53:in `block in <top (required)>'
from /usr/local/share/gems/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'
from /usr/local/share/gems/gems/railties-3.2.8/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Perhaps there is an easy way to just deploy it correctly from the begining instead of messing around with error craps? I need PostgreSQL. This app works everywhere except this AWS EC2 instance, so I know my Gemfile is correct. Any clues would help.
open irb & type require "pg" does it work? if not, then check that pg_ext exists in /usr/local/share/gems/gems/pg-0.14.0/lib/ directory. you can install manually postgresql gem manually, using
gem install pg
If this still doesn't work, ensure that you are using latest version of ruby & latest version of rubygems using gem environment command.if its the older version, you can install latest ones using rvm
use gem pg
than
bundle install
bundle update
please not use any version of pg
I face this error and solved by this

Incorrect MySQL client library version

I created a new rails project calling
rails new simple_cms
Then when in the directory I run
rails s
I get the follow errors
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/l
ib/mysql2/mysql2.rb:2:in `require': Incorrect MySQL client library version! This
gem was compiled for 6.0.0 but the client library is 5.5.24. (RuntimeError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-
x86-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-
x86-mingw32/lib/mysql2.rb:9:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-
x86-mingw32/lib/mysql2.rb:9:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/
lib/bundler/runtime.rb:68:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/
lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/
lib/bundler/runtime.rb:66:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/
lib/bundler/runtime.rb:66:in `block in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/
lib/bundler/runtime.rb:55:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/
lib/bundler/runtime.rb:55:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/
lib/bundler.rb:119:in `require'
from c:/development/ruby/simple_cms/config/application.rb:7:in `<top (re
quired)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/commands.rb:53:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/commands.rb:53:in `block in <top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/commands.rb:50:in `tap'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I have seen other people with this error but they tend to be linux users and I am running windows. I have attempted to reinstall both rails (railsinstaller.org) and mysql 5.5. I have used both the 32bit version as well as the 64bit version
There seem to be several questions on here already about this. Did you try their solutions?
Probably the most clear is this:
mysql2 gem compiled for wrong mysql client library
The pertinent part is here:
At the time of building this gem, the necessary DLL files where available
in the following download:
http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick
And put lib\libmysql.dll file in your Ruby bin directory, for example
C:\Ruby\bin
This will remove the gem and its dependencies. Then reinstalling will re-compile itself and all dependencies.
gem uninstall mysql2
bundle install
I had this error in a new project I was working on which suddenly stopped working in a windows machine that already had working rails projects, so it was clearly not an installation problem.
What caused the problem was a bundle update command, which decided to redownload mysql2 gem (for unknown reasons) and ignored my Gemfile line gem 'mysql2', '~> 0.2.6'.
The problem was that bundle update got mysql version 0.2.18, as shown in Gemfile.lock, in the following line:
mysql2 (0.2.18-x86-mingw32)
I'm note sure what the symbol means, but I replaced the following line in my gemfile
gem 'mysql2', '~> 0.2.6'
for
gem 'mysql2', '0.2.6'
And now everything works fine, including bundle update.

Error building gem from git branch

I am following the instructions of this question to install a gem from git.
When I try to do I checkout of the branch I get:
mari#Black:~/Documents/apn_on_rails$ git checkout -b rails3 remotes/origin/rails3
fatal: git checkout: branch rails3 already exists
I also tried these instructions to download the branch and that works fine. But I still cannot build the gem. I get:
mari#Black:~/Documents/apn_on_rails$ rake build --trace
rake aborted!
no such file to load -- gemstub
/home/mari/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/mari/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/mari/Documents/apn_on_rails/Rakefile:2:in `<top (required)>'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/home/mari/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/home/mari/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'
I also tried rake gem but I get the same error. What can I do?
I am using rails 3 and ruby 1.9.2
possibly you already have rails3 branch. Check this with git branch.
If branch already exist try running same command without '-b'. It should work.
I fixed the problem by running gem build apn_on_rails.gemspec instead of rake build or rake gem as suggested in the instructions followed

Rails3 rails console crashes throwing error

I am trying Rails 3 and I am using RVM to manage the ruby versions. Using RVM I had installed ruby versions 1.8.7, 1.9.1 and 1.9.2.
When I do "rails console" I am getting the following error and console isn't starting:
/home/syed/.rvm/rubies/ruby-1.9.2-preview3/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (LoadError)
from /home/syed/.rvm/rubies/ruby-1.9.2-preview3/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
from /home/syed/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta4/lib/rails/commands/console.rb:3:in `require'
from /home/syed/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta4/lib/rails/commands/console.rb:3:in `<top (required)>'
from /home/syed/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta4/lib/rails/commands.rb:20:in `require'
from /home/syed/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta4/lib/rails/commands.rb:20:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Since I don't require 1.9.1 any more to work with Rails 3, I un-installed it using the following command:
rvm uninstall ruby-1.9.1
Still rails console crashes. Am I doing something wrong?
I am using Ubuntu 10.04 and RVM to manage different ruby installations.
I had to do:
rvm package install readline
rvm remove 1.9.2
rvm install 1.9.2 -C --with-readline-dir=/home/syed/.rvm/usr/
following the instructions here:
http://rvm.beginrescueend.com/packages/readline/ and with help from
Sutto at #rvm irc.freenode.net