How to Fix Cocoapod .Modulemap File Not Found

Can't find Pods.modulemap - looking in wrong directory

The solution that worked for me was:

First step:

(this step may no longer be needed in Xcode 9.x and newer)

  1. Open Xcode
  2. Click Window (Menu Bar)
  3. Click Projects
  4. Remove all projects (e.g. use backspace)
  5. Close Xcode

Second Step:

  1. Open a terminal app
  2. cd ~/Library/Developer/Xcode/DerivedData
  3. rm -rf Build/* see below if you have a customized build location
  4. rm -rf ModuleCache/*
  5. Close a terminal app

Third Step:

  1. Open Xcode
  2. Product > Clean
  3. Product > Run


If you have defined a custom build location:

  1. Go with Finder or the Terminal to the location of the build files. The location for these files is defined in Xcode. To check where these files are:

    • Open Xcode
    • Go to Settings -> Locations -> Derived Data
  2. Go to that location and delete the Build folder

Edit: June 9, 2016

It is also possible that this resolves your problem:

By default the clean of Xcode, does not delete everything, by going to Product, pressing the ALT-key, the Clean-button will change to Clean Build Folder....

error: unable to read module map contents from 'Target Support Files in iOS

Xcode might be using another projects project path, even though your project is a new project. Closing Xcode and deleting the xcode preferences from ~/Library/Preferences/ might fix the issue.

Add import to module_map or umbrella header

By the way, I found the solution! /p>

I created the custom umbrella headerMyPod/Sources/MyPod-umbrella.h.

And added imports of pods which I want to be available with import MyPod:

@import MyAnotherPod;

Then I created the custom modulemapMyPod/MyPod.modulemap:

framework module MyPod {
umbrella header "MyPod-umbrella.h"
export *

And finally in ./MyPod.podspec:

# Add MyPod-umbrella.h to sources
s.source_files = "#{}/Sources/**/*.{swift,h}"

# Select custom module map
s.module_map = "#{}/#{}.modulemap"

After these changes I just can write:

import MyPod
// And it also imports MyAnotherPod like
// import MyAnotherPod

Related Topics

Leave a reply