Jazzy Unable to find an Xcode with swift version 2.2. (RuntimeError): Xcode7.3

594 Views Asked by At

We are trying to generate the documents for Swift2.2 using Jazzy with Xcode7.3. We have 2 environments: Local dev environment (Macbook) and Server machine for central build.

We have exactly same set up in both machine like Xcode,CommandLine tools,Ruby but in server Jazzy fails with the below error:

jazzy-0.5.0/lib/jazzy/sourcekitten.rb:137:in `run_sourcekitten': Unable to find an Xcode with swift version 2.2. (RuntimeError)
from .../gems/jazzy-0.5.0/lib/jazzy/doc_builder.rb:57:in `block in build'
from .../gems/jazzy-0.5.0/lib/jazzy/doc_builder.rb:55:in `chdir'
from .../gems/jazzy-0.5.0/lib/jazzy/doc_builder.rb:55:in `build'
from .../gems/jazzy-0.5.0/bin/jazzy:15:in `<top (required)>'
from .../jazzy/bin/jazzy:23:in `load'
from .../jazzy/bin/jazzy:23:in `<main>'

Many people suggested to use the --swift-version 2.2 but this didn't work for me.. :(

Do we need to send any additional parameters to get rid of this error..?

2

There are 2 best solutions below

0
On BEST ANSWER

The problem was caused by the fact that jazzy relies on the spotlight indexing service of OS X in order to find an Xcode instance with the proper Swift version. Since this service is disabled on the build server it was failed to find any Xcode instance.

We can't guarantee the enable of spotlight in build servers and we need to make sure that jazzy works even if spotlight is disabled. Luckily, a new version of jazzy (0.6.1) that fixes the problem. This version uses the currently selected Xcode (xcode-select command) if there is no swift version explicitly specified (https://github.com/realm/jazzy/pull/560).

We need to make sure that there is either only one version of Xcode installed or that the right Xcode version (with the proper swift version) is selected.

0
On

This could be the spacing/formatting issue in the command you executing.

Suggest to try out by creating .jazzy.yaml file and put configuration in there details to avoid such scenarios.

Post that just type "jazzy" in terminal it will generate the doc.

$ jazzy

For details follow this link, it's a step by step guide on the same along with a sample swift project:

https://medium.com/@sumit16.kumar/document-generation-for-swift-projects-using-jazzy-e148efc72bca

Hope this helps!!