CocoaPods folder does not exist / permissions error - ruby

I'm new to CocoaPods, I tried running 'pod install' on my Mac to install my pod, but I'm getting a permissions error with the folder /Users/username/Library/Caches/CocoaPods. That folder doesn't even exist! Did I accidentally delete it at one point? How do I restore it?
There is however a folder called /Library/Caches but its not under my username, its at the root.
I'm a little confused. If someone can just direct me in the right direction, I would really appreciate it.
Here is the full error message:
Errno::EACCES - Permission denied # dir_s_mkdir - /Users/nachshonfertel/Library/Caches/CocoaPods

You can solve this in 2 ways.
Add CocoaPods folder on ~/Library/Caches/CocoaPods then try
pod install
OR
Give full permission on you project
cd your-project
chmod -R 777 .
cd ios
pod install

Turns out it was a permissions error. And the folder I thought didn't exist, was hidden in finder > Go > (Hold Down Option Key) Library
Took me 2 full days to finally figure it out!

Are you using system Ruby or have you installed Ruby with sudo?
You basically have 2 options:
use sudo pod install
Probably the easiest/fastest way for you go forward
This typically causes more problems than Ruby being owned by non-root
When you install packages they will have sudo access!
Install Ruby, non-sudo; you can try
github.com/postmodern/ruby-install together with github.com/postmodern/chruby (my personal favourite), rvm.io is also very popular
The benefit of this approach is that you also can switch Ruby version whenever you like (and as mentioned above; more secure less insecure..)

I had been struggling with this issue for a while. For some reason, in my case the problem was that the folder ~/Library/Caches/CocoaPods was not there, and cocoapods wasn't able to create it when running 'pod install'. Hence the permission error.
After trying several things, I created that folder manually (which prompted for my password), ran 'pod update' and my problem was fixed!
Hope this saves someone some trouble.

I solved the problem creating the missing folder Users (in my case the error was Permission denied # dir_s_mkdir - /Users/Users) and give full permission to all users.

I managed to solve my issue in following steps:
Create CocoaPods folder (if it doesn't exist) cd ~/Library/Caches && mkdir CocoaPods
Give access to CocoaPods folder sudo chmod 777 Cocoapods
Create Pods folder cd CocoaPods && mkdir Pods
Give access to Pods folder sudo chmod 777 Pods
I hope it helps !

Related

Cocoapods install "You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory"

I'm trying to uninstall Ruby/gem so I can reinstall it. Just updating it has it hit a bunch of errors. It won't let me uninstall it at all because it says I do not have the write permissions for the stated directory.
The confusing part is I tried to find the directory in finder and it literally does not exist. There is a Ruby directory in the Library itself but no Frameworks/Ruby.framework
How do I fix this issue? I'm reticent about disabling the security of my computer.
Create this directory and in terminal write:
sudo chmod -R a+rwx /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0
Then retry to uninstall.

Cocoapods permissions No such file or dirrectory

I have a problem here. I've installed cocoapods on my Mac because I need it for my XCode project. I've runned this command
gem install cocoapods
which works fine, all things were installed. But I after that when I tried to use any pod COMMAND thing, I've got the error - You cannot run CocoaPods as root.
I've looked through stackoverflow, and the main advices were to use this commands
sudo chown -R $USER ~/.cocoapods or sudo chown -R $USER ~/Library/Caches/CocoaPods
but the problem is none of those commands were working for me and I've got this error:
chown: /Users/user/.cocoapods: No such file or directory
Could you tell me where I'm wrong?
Ok, guys, I've figured out the problem. Just need to do what the error says. You shouldn't run pod install command with sudo or from the root user. It means - just open new terminal window and don't log to the root user and work with pod

vagrant: command not found after install on Mac OSX 10.10.4

Downloaded Vagrant, and went through th installation process.
When I ran vagrant -v it says vagrant: command not found
It has put the files in /opt/vagrant/...
It should install in the Applications folder with a link to the /usr/bin so it is added to the shell path.
There is no directory that has been created during this process.
I am afraid I can't even get started with it. ITs obviously not creating all the shortcuts it needs to be able to run the commands.
I have looked for support on this issue and reported a bug.
I also accepted the xcode licence agreement.
Has anybody else had this issue.
My next step is to manually create the shortcuts.
If you look at the uninstall script including in the Vagrant DMG, it is referring to /usr/local/bin which does not exist. It should be error handling (the Vagrant pkg installer) and create it (permissions/ownership etc) but it doesn't.
You need to mkdir the /usr/local/bin. I tried a symlink between /usr/bin/vagrant (as /usr/bin exists, and in-path) to /opt/vagrant/bin/vagrant BUT this does not work, as later on in life, Vagrant refers in a hard fashion to /usr/local/bin/vagrant because its stupid.
$ sudo mkdir /usr/local/bin
If you sudo it, it should be made with correct ownership etc. Now just re-run the Vagrant installer pkg.
Make sure the Virtual Box setup is installed on Mac before installing Vagrant.
I raised the bug with https://github.com/mitchellh/vagrant/issues/6034
The issue is that I had no /usr/local directory at all.
It is an apple issue.
After I created the directories as you described I was able to install vagrant vitrual boax and laravel.
Here is what I did.
sudo mkdir /usr/local
Then bin.
cd /usr/local
sudo mkdir bin
I uninstalled Vagrant, re-installed and when I ran vagrant -v I then got the version.
cd /usr/local/bin
ls
sudo chmod 755 vagrant
Thanks for your Answer.
Weird, on 1.8.5 I couldn't run Vagrant either, noticed that /usr/local/bin was owned by root. Ran command
# chown -R User:Group /usr/local/bin
as root and works from my username now.

Can't run sudo pod install after updating to cocoapods 0.32.1 with error "You cannot run CocoaPods as root. (CLAide::Help)"

I found an issue when running sudo pod install command after updating it to latest version 0.32.1. Earlier it was working very fine.
When I tried to do pod install with older cocoapods, it asked me to update to latest cocoapods version i.e. 0.32.1. After I updated by cocoapods gem, I can't do sudo pod install in my Xcode project. It gives me following error.
± sudo pod install ruby-1.9.3-p0
Password:
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/gems/1.9.1/gems/claide-0.5.0/lib/claide/command.rb:328:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)
CocoaPods, the Objective-C library package manager.
Commands:....
Any suggestion to overcome the issue would be very helpful. Thanks in advance.
I had to update permission on CocoaPods
sudo chown -R $USER ~/Library/Caches/CocoaPods
sudo chown -R $USER ~/.cocoapods
Since it seems to fix the problem for some people, you might want to try running "pod install" and see if it fixed your problem from that point. However, I still had a permission denied when running "pod install" for a pod item, so running the next line will overwrite permission for the pod folder.
sudo chown -R $USER ./Pods
I have removed the old podfile.lock before running pod install
Source :
cocoaPods pod install Permission denied
https://github.com/CocoaPods/CocoaPods/issues/509
I am working with windows. After reading all tips which didn't work I drove into the code base.
As a disclaimer, I am beginning phase of developing an app and my goal is to get a quick proof of concept. Therefore, this solution will only bypass that the error message as a quick hack.
In the file ~/lib/cocoapods/command.rb you will find a function on line 47 that stops the program if there is a root user.
#help! 'You cannot run CocoaPods as root.' if Process.uid == 0
Simply comment out the line. Again, this is a terrible idea to do in any situation except as a pragmatist using Windows and trying to get proof of concept out.
Nothing worked for me except the following
switched to ios platform with cd platforms/ios
switched ownership of the folder to the current user with sudo chown -R YourUsername .
Pod install
In m1 MACs run sudo arch -x86_64 pod install --allow-root to resolve this issue.
in my case, the both "folder content project" and file "project.xcodeproj" was locked "i ignore why !!! maybe the git clone provoked error :s", i unlock the folder and apply all changes for sub folder .... And it WORK FINE :D

meteorite error Cloning Mac

This is the error I keep getting when I try to run meteorite
$ mrt
Stand back while Meteorite does its thing
✓ router
tag: https://github.com/tmeasday/meteor-router.git#v0.5.3
/usr/local/lib/node_modules/meteorite/lib/sources/git.js:108
throw "There was a problem cloning repo: " + self.url;
^
There was a problem cloning repo: https://github.com/tmeasday/meteor-router.git
I've tried sudo -H npm install -g meteorite
I've installed and reinstalled it a bunch of times
I have git installed, I have Xcode installed, I have Homebrew installed and I have meteor.
All of those work.
This is my $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
This is which Git
/usr/local/bin/git
This is which mrt
/usr/local/bin/mrt
Not sure if this is relevant but I have two drives in my Mac one that has the user folder and the other that has system files.
Any help? I'm a unix newb so please be very clear on solutions. Thanks
Found the Error, make sure the Volume name has no SPACES. Mine had a few spaces and Meteorite git.js doesn't account for that. Just rename the Volume with no SPACES and it should work.
try running it as root:
$ sudo mrt
I always have to do this when using Meteorite to bundle on remote machines.
You might also need to create a symbolic link on mrt..
$ ln -s /usr/local/bin/mrt /usr/bin/mrt
It might be solved already, but I had the same error.
It turned out that Apple wanted me to agree on Terms, which I found out after running:
git --version
I had to run this as a administrator
sudo git --version
And agree upon the long list of Apple Terms. Afterwards my meteorite (and GIT for that matter) was running like a charm again.

Resources