mokagio mokagio - 1 year ago 129
Swift Question

Opening import file for module 'XCTest': Not a directory

I'm experiencing this issue on a brand new Sierra setup, with Xcode 8.1.

I have a framework target for iOS, the target builds fine, but when I try to build for test the build fails with this error:

Opening import file for module 'XCTest': Not a directory

enter image description here

I looked at these questions already, but their suggestions are not useful for us:

All the settings in the project are pretty standard.

Answer Source

The cause of this issue was quite bizarre.

It was happening in a CI box on which I had installed Xcode 8.1 via the MAS. In our company we provision CI boxes using xcode-install, but for some reason that I don't remember I wasn't able to do so on this one.

To mimic xcode-install's behaviour I renamed into, and created an alias of it called

This is where the issue was. The alias I created wasn't a proper symbolic link. wasn't actually a folder.

I realised this when trying to perform a command line build that referenced some system framework other than Foundation/UIKit... It failed saying that it couldn't find the framework inside

Once I made into a proper symlink everything worked.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download