40

I'm doing the Ray Wenderlich tutorial called SimpleWeather.
The podfile is in the same folder as the project. Here's my code from the podfile:

platform :ios, '7.0'

xcodeproj 'SimpleWeather'  

pod 'Mantle'  
pod 'LBBlurredImage'  
pod 'TSMessages'  
pod 'ReactiveCocoa'  

The error message is this: [!] Unable to find the Xcode project /Users/myName/Developer/SimpleWeather.xcodeproj for the target Pods.

The name of the project is SimpleWeather.

meghan66
  • 565
  • 1
  • 7
  • 13
  • What is your project name? What is the location of Pods file? – kukido Jan 12 '14 at 03:41
  • I have tried putting the podfile in both SimpleWeather and Developer – meghan66 Jan 12 '14 at 03:45
  • Move it into your SimpleWeather project directory, comment out `xcodeproj` and just run `$ pods install`. – kukido Jan 12 '14 at 03:47
  • If you absolutely positively have to use project name, check project name quotes, they should be "backticks". [Podfile Syntax Reference](http://guides.cocoapods.org/syntax/podfile.html) – kukido Jan 12 '14 at 03:50
  • When I do pods install I get pods: command not found. When I do pod install I put xcodeproj back in I get: [!] Could not automatically select an Xcode project. Specify one in your Podfile like so: xcodeproj 'path/to/Project.xcodeproj' I'm unsure if I should use the bash developer myname or just myname – meghan66 Jan 12 '14 at 03:54
  • Please run `$ pod install`. Sorry about that. – kukido Jan 12 '14 at 03:55
  • I did run pod install with and without the xcode project line. – meghan66 Jan 12 '14 at 03:58
  • What error do you get when you run `pod install` without `xcodeproj`? I assume you are running it from `/Users/myName/Developer/SimpleWeather` – kukido Jan 12 '14 at 03:59
  • It's working! my mistake was that I didn't use /Users/myName/Developer/SimpleWeather but I used it without SimpleWeather. Thank you so much! – meghan66 Jan 12 '14 at 04:04

12 Answers12

61

I'm pretty sure you are not in the right directory. Are you sure your .xcodeproj is in the Developer folder? There might be a subfolder you need to navigate to.

The right way to enable CocoaPods in your Project is:

  1. Open Terminal and execute: $ sudo gem install cocoapods
  2. Navigate to your Project folder (I assume in your case it's cd /Users/myName/Developer/SimpleWeather/SimpleWeather.xcodeproj).
  3. Setup Cocoapod pod setup
  4. Create the Podfile touch Podfile
  5. Open the Podfile open -e Podfile and insert your code for Podfile
  6. Finally install the Podfile pod install

If you follow this instructions everything should work. When opening your project make sure to open the .xworkspacefile.

For more information, see this.

itzmebibin
  • 9,199
  • 8
  • 48
  • 62
fahu
  • 1,511
  • 4
  • 17
  • 26
  • 2
    hey it given me like this "[!] [!] The Podfile does not contain any dependencies." – Dhaval Bhadania May 06 '14 at 10:48
  • this is strange, I never had this error before. Are you sure, that you typed in everything correctly? – fahu Jul 01 '14 at 14:01
  • @dhaval are your pods entered in the Podfile file? `nano Podfile` – David Douglas Sep 08 '15 at 23:23
  • Sometimes I click on the `.xcodeproj` file in Finder and select "New Terminal in Folder" which opens the Terminal inside the `.xcodeproj` folder, so of course I need to `cd ..` back a level to the project folder. IOT, really check your in the right folder with `ls` – Drakes Sep 19 '15 at 13:05
  • And also Its prefer to rm -rf MyProject.xcworkspace before making above changes – Kirtikumar A. Oct 15 '15 at 18:51
  • @VijaySinghRana try this way : https://www.digifloor.com/install-cocoapods-xcode-project-4-simple-steps-06 may help you more.. – Dhaval Bhadania Jan 08 '16 at 10:51
  • Also make sure no more than one .xcworkspace or .xcodeproj files (each type of file should have exactly only one) in the current directory. – Yingpei Zeng Mar 21 '17 at 16:08
31

This error also occurs when you have multiple .xcodeproj in your Xcode project.

You don't need more than one .xcodeproj in general cases. Remove unnecessary .xcodeproj, and Cocoapods should get the correct path automatically afterwards.

Brian
  • 30,156
  • 15
  • 86
  • 87
20

Reiterating our original conversation:

Accordingly to Podfile Syntax Reference the Podfile looks right.

Make sure you are running $pod install from your project directory:

/Users/myName/Developer/SimpleWeather
kukido
  • 10,431
  • 1
  • 45
  • 52
14

Hey your path for the project might be wrong. Go to the project and right click on SimpleWeather.xcodeproj and select Get Info as show in the image below(The right side window is for Get Info here). Copy this path from the details window and paste it into the Podfile. After that append /SimpleWeather.xcodeproj to that pasted path. This might solve the problem(Note: It is a snap shot for my project). In your case the solution might be replacing the path with this /Users/myName/Developer/SimpleWeather/SimpleWeather.xcodeproj

enter image description here

Rohan Bhale
  • 1,323
  • 1
  • 11
  • 29
4

To solve this issue, just follow below steps and your issue will get resolved :

Step 1 : Open Terminal and navigate to your project folder

Step 2 : touch podfile

Step 3 : open -e Podfile

Step 4 : Write below line in your text edit and close it

workspace '/Users/systemName/Developer/yourprojectname/yourprojectname.xcworkspace'

Step 5 : Pod install

And after successful process, you will not get this error again.

CheersKP

Kalpesh Panchasara
  • 1,730
  • 2
  • 15
  • 27
2

Maybe you have two project .xcodeproj, remove one.

Remove Podfile.lock, folder Pods. On Terminal cd /Users/myName/Developer/SimpleWeather and pod install

Yura Huber
  • 53
  • 7
2

For people who are on Mac and also using code editors, the duplicate file that is causing this issue is ._projectname.xcodeproj because it has the same extension as the regular .xcodeproj files.

Sam G
  • 21
  • 1
  • 2
1

I had the same problem. Then with many attempts of trials and errors I finally got the working solution:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target 'SimpleWeather'
pod 'Alamofire', '~> 3.4'

This works when you are in your project directory (I assume you should navigate using terminal to /Users/myName/Developer/SimpleWeather/)

pulp
  • 1,768
  • 2
  • 16
  • 24
0

You installed your Xcode..in application use this command to execute

sudo xcode-select -switch /Applications/Xcode.app
itzmebibin
  • 9,199
  • 8
  • 48
  • 62
Arvind Kumar
  • 2,371
  • 1
  • 18
  • 25
0

so okay i had tried every possible thing ...i had only one .xcodeproj file but sill i couldnt install so finally i had tried with the following
1. open terminal cd to your project folder one with .xcodeproj
2. type pod init
3. type touch Podfile
4. type pod install
Magic happens and your pod files gets installed

0

Check your Podfile for the following lines

config = use_native_modules!

use_react_native!(:path => config["reactNativePath"])

under

target '<project_name>' do

0

Hopefully this answer can be useful in times of many people using SPM. My case was the following: I had a binary framework package that had to be converted to the cocoapod, together with it's dependency tree. In the git repository where the package lived, the .gitignore file contained this line: /*.xcodeproj. This meant that even though everything worked fine locally, whenever the CI tried to run pod install it failed.

lawicko
  • 7,246
  • 3
  • 37
  • 49