Cocoapods: "No Xcode project found, please specify one!" - xcode

Cocoapods is giving me this error message when calling pod init:
[!] No Xcode project found, please specify one
I've...
called sudo gem install cocoapods and waited for it to install
dragged in my project directory folder "Hello" (see images)
called pod init
Here's my desktop:
What my directory folder "Hello looks like (sudo gem install cocoapods has already finished
What happens when I try to initialize the pod.
Why does that happen?

if you are using REACT NATIVE or FLUTTER ,make sure go to ios folder ,then pod init
cd ios
pod init

Just close the XCode and terminal once then restart the Terminal. Make sure you select the path to your project folder only.
After calling cd /Users/YOUR_USER_NAME/Desktop/PROJECT_NAME just call a command ~ls and check if the list of the file contains your PROJECT_NAME.xcodeproj. If this file is available, it means you can now set up pod init. Otherwise, you should navigate to the next level and find your PROJECT_NAME.xcodeproj.
Hope it helps! :)

Make sure that you are in the correct directory where you .xcodeproj is located.

My solution:
Using terminal would still not work, so I just used the official Cocoapods application and it worked fine. Just download it, select new podfile and then your project and you're ready to go!

I had the same issue and the problem was because of the space in the directory name. I could see on the Desktop there was no space in the directory name, but in Finder, there was a space in the name. After closing out of XCode and then renaming the folder to have no spaces the issue was solved and 'pod init' worked fine.

My solution:
called sudo gem install cocoapods and waited for it to install
pod setup
dragged in my project directory folder "Hello"
called pod init
https://www.jianshu.com/p/a3b803457b08
It's working for me.

It's working for me .
first import directory in terminal where your .xcodeproj .
then run pod init
it's showing error ([!] No Xcode project found, please specify one)...then run pod install command .. Again it is showing error ([!] NoPodfile' found in the project directory.)`..
then QUIT terminal .. Open again ...
import directory in terminal again Run command pod init ..
Now working fine.

Rename the projectFolder to 7, Project folder should have the same name as the .xcodeproj file has.

Might as well add my 2 cents. I just installed xcode and react native, following this guide: https://dev.to/rob117/how-to-really-set-up-a-react-native-environment-on-mac-248h
Everything seemed to run as expected at first with react-native run-ios...I copied over some react-native files from another project, got some dependency errors, fixed them with npm install, and then I restarted my MacBook. After I booted up again, I ran react-native run-ios and got errors about not being able to launch the iPhone 6 simulator. I couldn't find a fix, so I decided to determine if it was my code or if it was xcode or what. So I went to my main projects directory and started a new react-native project, referencing the link I posted above. After everything installed, I did react-native run-ios again and boom, everything worked fine.
So then I closed xcode, the simulator and the terminal that runs upon starting react-native. I went back to my first project and ran react-native run-ios. boom it's working again, except this strange error error Could not find the following native modules: RNKeychain, RNVectorIcons. Did you forget to run "pod install" ?. I installed cocoapods via brew the first time around, I tried pod install but it complains about no xcode file or something. I've tried pod init, but it tells me No Xcode project found, please specify one. I ran pod setup, no error...seemed to do nothing? I guess it's working because now my simulator is running again.
Maybe I'll just remove the react-native-keychain and react-native-vectoricons npm packages from my package.json and see if it goes away. I don't really understand what coca pods is or why I need it. I'm thinking maybe you should take some time to update xcode, delete node_modules folder and run npm install again, spin up a new react-native project and if it works close xocde, simulator and the terminal and then try to go run your project again.
If it was working fine before and you didn't update anything outside of node_modules folder, remove and reinstall often works for me.
Good luck

I am using ionic, you need to cd to the directory that contains xcode files like (App.xcodeproj + App.xcworkspace) then apply the command
pod init

Related

React-Native Error + Bug in Ruby Interpreter: Failed to install CocoaPods dependencies for iOS project, which is required by this template

I am very new to Apple and app programming so please forgive me if I am not asking my questions in the perfect "format" that you might be expecting...
I bought my MacBook Air running on M1 chip just few days ago and would like to program with Xcode and React Native. As I do the common command "npx react-native init AwesomeProject" I got into the error which I saw quite some other people also run into:
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
I tried all of the suggestions available on other posts (assuming I am understanding the remedies correctly and making the changes accordingly) but none seem to work for me.
I tried also the default suggested solution which is:
Please try again manually: "cd ./AwesomeProject/ios && pod install".
And I seem to get something different from others, which is:
Analyzing dependencies Fetching podspec for DoubleConversion from
../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec
Fetching podspec for RCT-Folly from
../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec
Fetching podspec for glog from
../node_modules/react-native/third-party-podspecs/glog.podspec
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.1/lib/ffi/library.rb:275: [BUG]
Bus Error at 0x0000000102a08000 ruby 2.6.3p62 (2019-04-16 revision
67580) [universal.arm64e-darwin20]
and then
You may have encountered a bug in the Ruby interpreter or extension
libraries.
Is it something to do with my Ruby interpreter? If yes, what are the commands I could use to solve the issue???
https://github.com/CocoaPods/CocoaPods/issues/10349#issuecomment-849468291
brew install cocoapods
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
In my case, need to restart my terminal before execute pod install. Monterey + M1.
The top answer doesn't work for me on my MBP M1 so I fixed the issue this way :
Make sure you have opened project.xcworkspace and not the project.xcodeproj
Open the workspace file with xcode with clicking on it then go to File -> Workspace Settings ... -> Build System -> Legacy Build System
Select the project file then the Target then go to Build Settings Tab and Search Paths
Double click on Library Search Paths Debug and move the $(inherited) to the bottom of the list
Do the same for the Release .
Then Build Again and you're good to go .
If you still get any errors run these commands in the ios folder of the react native project and do the above steps again and it will build successfully.
rm -rf ~/Library/Developer/Xcode/DerivedData/
pod deintegrate
pod install
If you are facing this issue in Mac Big Sur, reinstalling CommandLineTools can fix this issue.
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

How to fix -resources.sh: line 7: realpath: command not found in Xcode

I'm setting up a new project with pods. Where do I need to set the path for below error
-resources.sh: line 7: realpath: command not found
If you have Homebrew you can fix this with brew install coreutils
Simply cleaning build folder (Product -> Clean Build Folder) fixed the issue for me.
Slightly old question, but here is my fix for those who come later:
Clean build folder
Exit Xcode
Run pod deintegrate
Run pod install
Restart Xcode and clean again
Always fixes this problem.

I can not do a "pod install" in CocoaPods

I can not do a "pod install" in any project.
But the thing is that before it could.
What has changed from before to now?
Basically I have installed the new Xcode 10.1 and the new Mojave operating system.
Before I could do all the pod functions and not now. The error that I get is the following:
The Podfile is the following:
EDIT:
If I write:
xcode-select -p
If I write:
xcode-select -s /Applications/Xcode.app/Contents/Developer
Any idea what it can be? Nor did I just see what the error is. Do you see it? I have tried different solutions than those proposed but they do not work ... It's stressful !!
Execute this command in Terminal and try again:
xcode-select -s /Applications/Xcode.app/Contents/Developer
And be sure to update your Cocoapods spec repository by running pod repo update before pod install
Description:
The error is because the wrong path was set as the Xcode Command Line Tools. this can lead to many problems such as git error, C compiler error etc.
Always be sure your Xcode Command Line Tools path has been set to embedded Command Line Tools in Xcode app.

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

Cocoapods user-install: cannot run pod command

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

Resources