Skip to content

How to resolve No Xcode project found, please specify one error when doing pod init with cocoapods

Problem

When initializing CocoaPods in macOS with the following command:

Terminal window
~ pod init

You may encounter this error:

Terminal window
[!] No Xcode project found, please specify one

Environment

  • macOS 10.14
  • Ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
  • Gem 2.5.2.3
  • CocoaPods 1.9.3

Reason

The pod init command expects the current directory to contain an .xcodeproj file, where MyProject is the name of your Xcode project.

Solution

To resolve this issue, navigate to the directory that contains the .xcodeproj file before running pod init. Here’s an example:

Terminal window
MyProject git:(master) ls -l
drwxr-xr-x 10 xx staff 320B 10 8 21:34 MyProject
drwxr-xr-x@ 5 xx staff 160B 10 8 21:19 MyProject.xcodeproj
MyProject git:(master) pod init
MyProject git:(master) ll
total 8
drwxr-xr-x 10 xx staff 320B 10 8 21:34 MyProject
drwxr-xr-x@ 5 xx staff 160B 10 8 21:19 MyProject.xcodeproj
-rw-r--r-- 1 xx staff 246B 10 11 07:51 Podfile

After running pod init, a Podfile will be generated in the directory. Here’s an example of what the Podfile might look like:

Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyProject' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for MyProject
end

Summary

The “No Xcode project found, please specify one” error occurs when CocoaPods cannot locate an .xcodeproj file in the current directory. To resolve this, navigate to the directory containing the Xcode project file and run pod init. This will generate a Podfile, allowing you to manage dependencies for your project. By following these steps, you can avoid common pitfalls and streamline your CocoaPods setup.

Final Words + More Resources

My intention with this article was to help others who might be considering solving such a problem. So I hope that’s been the case here. If you still have any questions, don’t hesitate to ask me by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!