Cocoapods user-install: cannot run pod command - cocoapods

I have installed Cocoapods on OS X Mavericks using the --user-install option (to avoid having to use sudo for the installation) following the instructions at http://guides.cocoapods.org/using/getting-started.html#getting-started . I have also created a .profile file in my home directory with the following:
export GEM_HOME=$HOME/gems
export PATH=$GEM_HOME/bin:$PATH
Cocoapods successfully installs, but I am unable to run the pod command.
When running it from the command line it says No such file or directory. From what I understand, it should be installed into the /Users/me/gems/bin folder. However, this folder does not exist at all - the only Ruby related folder in my home directory is /Users/me/.gem.
I have tried running /Users/me/.gem/ruby/2.0.0/gems/cocoapods-0.29.0/bin/pod but that results in the following error:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- bundler/setup (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from .gem/ruby/2.0.0/gems/cocoapods-0.29.0/bin/pod:14:in `<main>'
...but from what I understand, I shouldn't be running it from that location directly.
Any assistance for a Cocoapods newbie appreciated!

So after a lot of research and trying different things I have managed to get this working. I am not quite sure what eventually fixed the problem, or whether it was a combination of things, but for anyone else encountering this same problem here's what I did:
Installed the Xcode command line tools for Mavericks. The option to install this is no longer available in Xcode 5, so you need to download them from https://developer.apple.com/downloads . Some people seem to say they are already installed as part of Xcode 5 from the Mac App Store, whereas others say you need to manually install them. Either way, I figured that installing them again won't hurt.
The error message above talked about not being able to load bundler/setup. So, I (re?)installed the bundler ruby gem gem install bundler --user-install. Interestingly, when I then attempted to run the /Users/me/.gem/ruby/2.0.0/gems/cocoapods-0.29.0/bin/pod command again I got a different error: /Users/me/.gem/ruby/2.0.0/gems/cocoapods-0.29.0/Gemfile not found.
What was really handy is that after the installation of bundler a message appeared saying /Users/me/.gem/ruby/2.0.0/bin in your PATH, gem executables will not run. So, I checked out the contents of that folder and it contains the pod executable! Adding it to the PATH would certainly be handy, but I just ran it directly with the full path (after changing to my Xcode project folder containing the Podfile): /Users/me/.gem/ruby/2.0.0/bin/pod install and it all works!
When I ran pod install for the first time it showed a message saying Setting up CocoaPods master repo and stayed there for quite some time - I thought it had actually hung. However, it eventually completed. If you are unsure whether it is doing anything, or has hung, do ls -la ~/.cocoapods/repos/master/.git/objects/pack/ and look at the time modified/size of the file it is downloading (thanks to this comment for the hint).
Another tip for new players - when I tried to install a pod (in my case, BlocksKit) I got a message saying [!] The platform of the target Pods (iOS 4.3) is not compatible with BlocksKit (2.1.0) which has a minimum requirement of OS X 10.7 - iOS 5.0. This was a surprising message, since my project targets iOS 7.0. Apparently you don't need to specify the platform anymore, so I entirely removed the platform line from the Podfile and it all works.
Hope that this helps other people just getting started with CocoaPods!

After installing Mavericks, I got error with already installed cocoapods. So I ran this command to install the new updated cocoapods version, and it works now.
sudo gem install cocoapods

Thanks to the pointers in these answers, I found that the instructions for installing CocoaPods provided on the CocoaPods web site are incorrect, regarding the contents of the .profile file, specifically the path.
As Skoota noted in the question, the path $GEM_HOME/bin does not exist. A comment by Videre gives the important clue: the correct path is $GEM_HOME/ruby/2.0.0/bin.
The correct .profile contents, which works for me at least, is:
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/ruby/2.0.0/bin:$PATH
It is also worth noting that you must quit and relaunch the Terminal application for changes to the .profile file to take effect.

add:
export COCOAPODS_NO_BUNDLER=1
to your .zprofile or .bash_profile

FWIW - I ran into very similar problems. None of the above helped me so maybe others could benefit from my process.
Eventually just ran sudo gem uninstall cocoapods, deleting everything that I did before.
Followed the steps for creating the .profile file
For good measure, closed Terminal and rebooted everything.
Ran gem install cocoapods which somehow didn't run into errors this time
Checked the install by running gem which cocoapods which fortunately returned the correct path
ran pod setup which didn't raise any errors again .
Not entirely sure what actually worked and what didn't but maybe someone will find this useful.

I use homebrew to install cocapods
First install homebrew (paste this code in terminal and hit enter)
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Second enter this
$ brew install cocoapods

Related

killproc command not found error in Ubuntu 12.04

I have a redmine script in /etc/init.d/ folder which was working fine before I broke the ruby and rails packages link. Then I played with ruby gems and finally fixed the broken links. Then I tried to restart redmine script, But strangely, I got the below error
sudo service redmine stop
Shutting down redmine: /etc/init.d/redmine: line 49: killproc: command not found
user#studio:~$ sudo service redmine start
Starting redmine: /etc/init.d/redmine: /usr/local/bin/bundle: /usr/local/bin/ruby: bad interpreter: No such file or directory
/etc/init.d/redmine: line 35: echo_failure: command not found
killproc is part of init.d, so there isn't a missing package at play here. If the process isn't found, it won't run, as well.
However, the next line is more of a red flag. It sounds like your redmine installation is looking for ruby in the incorrect location. This may also be the source of the killproc error as it looks like redmine is not starting up properly.
You can get some more information by running which ruby and comparing that to the path that redmine is looking in. Reinstalling redmine may also resolve the path issue automatically since it sounds like you did a reinstall of rails earlier. Good luck.
My question has two answers, telemark already given answer for my 2nd problem ( ie, I had broken ruby links ). I solved path issues by uninstalling all ruby, rails and gem packages and reinstalled using apt repository. using rvm, chruby, etc everything failed when I switch between users. So I thought of going with the system ruby installation, relying on apt. Fortunately brightbox comes to the rescue.
https://www.brightbox.com/blog/2015/01/05/ruby-2-2-0-packages-for-ubuntu/
Using brightbox and apt solved my path issues.
Then, /etc/init.d/functions, this was missing. It says, No such file or directory. I searched in google and found this link
http://www.linuxfromscratch.org/lfs/view/6.4/scripts/apds02.html
I just copy pasted to /etc/init/functions and given execute permission
sudo chmod a+x /etc/init.d/functions
Thats it!.
UPDATE:
I forgot to mention one important thing, some functions like log_end_message, log_progress_message, etc are not available in functions file. So it's better to include . /lib/lsb/init-functions file.

Problems with Cocoapods on Xcode 6.4

I'm trying to install and use Cocoapods with Xcode. I've installed already Brew, so I've used this command:
sudo gem install cocoapods
but it stays there, without response and without asking me for password (that's really strange, because of sudo command).
Maybe I got some problem with Brew Installation or Ruby on my Yosemite iMac?
I met the same error in the past, there is something wrong with my development environment. I re-install the Command Line Tools follow this guide, then everything is ok.
You can get the detail information from here, hope it can help you.

OS X Yosemite - Vagrant: Failed to install / update plugins (ruby invalid option -H)

I've done a fresh install of OS X Yosemite and Vagrant on my Mac some days ago. The problem is, that every time when I try to update all plugins or install a vagrant plugin (vagrant-cachier), I'll get the following error:
An error occurred while installing json (1.8.2), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.2'` succeeds before bundling.
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/opt/vagrant/embedded/bin/ruby extconf.rb
/opt/vagrant/embedded/bin/ruby: invalid option -H (-h will show valid options) (RuntimeError)
If I install a gem over the system's binary it works. So it seems to be a problem with the built-in vagrant binaries. I've also already installed the command line tools. My Vagrant Version is 1.7.2
I've already googled the problem for hours, but I didn't find this problem.
Did I forget anything or does anybody has a workaround for this problem?
Thanks!
Thanks for your help. I found the problem.
The problem was the path were Vagrant is installed. My SSD partition on OS X is called "Macintosh SSD" with a space in it.
I renamed it to "MacintoshSSD" and now it works fine.
The issue appears to be that the 'embedded' binary of ruby is not happy with some older code in the JSON gem. Or something... I literally know nothing about ruby other than that it is a programming language and I installed it to use compass. And now here it is again with Vagrant.
ANYWAY I moved the embedded ruby to the side, and copied OS X's built-in ruby into the vagrant embedded binaries folder.
Something like:
sudo mv /opt/vagrant/embedded/bin/ruby /opt/vagrant/embedded/bin/ruby.2.0.0.p598
sudo cp /usr/bin/ruby /opt/vagrant/embedded/bin/ruby.2.0.0.p481
sudo ln -s /opt/vagrant/embedded/bin/ruby.2.0.0.p481 /opt/vagrant/embedded/bin/ruby
sudo vagrant plugin install vagrant-vmware-fusion
Installing the 'vagrant-vmware-fusion' plugin. This can take a few minutes...
Installed the plugin 'vagrant-vmware-fusion (3.2.1)'!
Yay.
Straight from HashiCorp... here is the troubleshooting checklist:
Hey there,
I am really sorry you are having problems installing that Vagrant plugin. We are aware of these issues, but we have not been able to narrow it down to a specific cause because it only affects a small subset of machines and we have not identified a common denominator yet.
First, please do not try and install the plugin using sudo. This can tamper with the permissions of other Vagrant plugins and cause Vagrant to error.
Second, please ensure you have the XCode Command Line Tools installed. You can install them by running:
sudo xcode-select --install
and following the on-screen prompt.
After completing those steps, many users have found success by doing the following:
Completely uninstall Vagrant
Removing the /opt/vagrant and /Applications/vagrant directories.
Remove Vagrant's storage directory (~/.vagrant.d). Warning: If you
have installed other Vagrant plugins or Vagrant plugin licenses,
they will be removed!
Reinstall Vagrant from the official Vagrant installers:
https://www.vagrantup.com/downloads.html
Install the plugin
Additionally, please ensure the following:
If there is a special character anywhere in Vagrant's path, you must
choose a different directory. This includes spaces (like in a
username or folder name) and parenthesis (like C:/Program Files
(x86)). Unfortunately there is a bug in the language in which Vagrant
is written that prohibits compiling native extensions under these
circumstances.
If you are using a Mac, please make sure you have accepted the XCode
license agreement. In some situations, native extensions will fail to
compile because XCode is prohibiting the installation due to an
unaccepted license agreement. To accept the license agreement, simply
open XCode - you will be prompted if you need to accept the
agreement.
If the problem persists after taking these steps, please provide the output of the plugin installation's debug logs.
Please let me know if you have any questions.
Best,
Seth

OSX Homebrew error: uninitialized constant MACOS

I've searched around a bit and can't seem to find any record of anyone else with this problem.
Whenever I try to run
$ brew update
I am rewarded with
/usr/local/bin/brew:34: uninitialized constant MACOS (NameError)
This isn't my machine and I normally develop on Linux systems so this is all a bit odd to me.
Any help would be greatly appreciated! Please tell me if there is any additional info I should provide. Again, I'm not used to homebrew or OSX.
EDIT
at the request of JameA
xiao:~ patrick$ brew doctor
/usr/local/bin/brew:34: uninitialized constant MACOS (NameError)
xiao:~ patrick$ brew --config
/usr/local/bin/brew:34: uninitialized constant MACOS (NameError)
...Not sure I like this whole "here, use this macbook for the project, it works better" thing...
I'm pretty sure the root cause of this is a failed upgrade attempt to Homebrew 0.9.5 from a much earlier version. Basically, if you run brew update as opposed to sudo brew update a portion of files are updated, while others are not. Here's what worked for me:
Edit /usr/local/bin/brew (it's just a Ruby file, not a compiled binary, so any text editor will do). You'll find a block like:
if MACOS and MACOS_VERSION < 10.5
abort <<-EOABORT.undent
Homebrew requires Leopard or higher. For Tiger support, see:
https://github.com/mistydemeo/tigerbrew
EOABORT
end
Comment this out. Even if you don't know Ruby, you can probably intuit what this is doing—it's checking to see if you have a current version of OSX. Assuming that you do in fact have this version, this sanity check isn't necessary. Brew is still broken, but at least now it will load far enough to give error messages.
Run sudo brew update, spoiler alert: it fails, but this time with a meaningful error message:
$ brew update
error: Your local changes to the following files would be overwritten by merge:
[giant list of files here]
Well, today I learned that brew update is just a wrapper for git pull because anyone who has worked with git knows that error message. We can fix this too.
Switch into the homebrew git repository with cd /usr/local and give the command git reset --hard FETCH_HEAD.
This piece found here.
Give the command sudo brew update. Homebrew should now update successfully and work properly!
Once the system is working again, you can actually kind of see why an error like this would have occurred. For one, usr/local/bin/brew has been completely rewriten and isn't even Ruby anymore, and most of its configuration has been moved into /usr/local/Library/brew.rb which no longer uses the constants MACOS or MACOS_VERSION constants, as they have been replaced by the more object oriented OS.mac and MacOS.version.
The MACOS constant is set in globals.rb. It seems like you may have a borked installation of Homebrew.
Check the output of brew doctor for any suggestions.
If that doesn't help please update with the results of brew --config.
If all else fails you may want to try re-installing Homebrew.
UPDATE:
Since this was a previous user's machine make sure your user is the owner of /usr/local and everything within. Fix it with sudo chown -R $USER /usr/local.
I had a similar issue, when I Killed an install mid-way with Ctrl-D.
Post that whenever I tried installing anything it gave the following error
uninitialized constant Homebrew::CLI::Parser::ARGV_WITHOUT_MONKEY_PATCHING
As a fix, I went to the directory I had where homebrew was installed, and reset the HEAD.
cd /usr/local/Homebrew
git status
git checkout .
And then it started working magically.
I had a similar error with a "borked" installation of brew. I removed the small 5 line block of code in the /usr/local/bin/brew script starting with the MACOS line. That did the trick to allow me to uninstall and eventually reinstall it.
In addition to Matt Korostoff's answer.
On point 3 (resetting the repo), for recent version of Homebrew, the repo is no longer /usr/local, do cd "$(brew --repo)" instead.

Ruby: RVM Install Error "Could not source..."

A reinstall of RVM produced the following errors when done:
WARNING:
Could not source '/Users/developer/.rvm/scripts/base' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/version' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/selector' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/cd' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/cli' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/override_gem' as file does not exist.
RVM will likely not work as expected.
cat: /Users/developer/.rvm/VERSION: No such file or directory
/Users/developer/.rvm/src/rvm/scripts/rvm: line 133: __rvm_conditionally_add_bin_path: command not found
I reinstalled after I wrestled with trying to get RVM to work with Textmate and RVM behavior became strange (reporting it didn't have gemsets it would list) so I ran:
rvm implode
... and then manually removed the executable. Then I ran the install again by scrupulously following the single user instructions from the home site.
After I spotted the errors, I investigated the paths and found that many files in ~/.rvm/scripts/ and ~/.rvm/src/rvm/scripts/ which obviously should be executable did not have execute permissions.
RVM would not run at all so I set the executable bit on all the files in the two directories and that seems to have fixed things. (So far at least.)
Googling, it seems that other people have hit this problem but there seems to be no explanation or resolution. I would like to find out if this is a known issue and whether I should reinstall yet again.
I'm running rvm 1.6.9 on MacOS X 10.6.7
Yep. If you have installed system-wide it is definitely looking for both the system-wide configuration... and some hard-coded user scripts. Which is weird.
quick fix:
ln -nfs /usr/local/rvm /Users/developer/.rvm
it looks like all you need is to create that missing file.
in your terminal type:
touch /Users/developer/.rvm/scripts/version
touch /Users/developer/.rvm/scripts/base
they are warnings, not errors. I've got similar ones on my ubuntu linux box (but not on another, with same RVM version). so, it's not strctly related to OSX.
your RVM installation should work anyway.

Resources