Reputation: 38631
Now I am specify the Xcode version in Fastlane file like this:
lane :beta do
xcversion(version: "12.3")
xcode_select "/Applications/Xcode_12.3.app"
xcode-select -s /Applications/Xcode_12.3.app
if is_ci
create_keychain(
name: ENV['MATCH_KEYCHAIN_NAME'],
password: ENV["MATCH_KEYCHAIN_PASSWORD"],
default_keychain: true,
unlock: true,
timeout: 3600,
lock_when_sleeps: false
)
end
end
but it shows this error:
Run cd ./ios && bundle exec fastlane beta
+-----------------------+---------+--------+
| Used plugins |
+-----------------------+---------+--------+
| Plugin | Version | Action |
+-----------------------+---------+--------+
| fastlane-plugin-pgyer | 0.2.2 | pgyer |
+-----------------------+---------+--------+
[02:14:34]: Sending anonymous analytics information
[02:14:34]: Learn more at https://docs.fastlane.tools/#metrics
[02:14:34]: No personal or sensitive data is sent.
[02:14:34]: You can disable this by adding `opt_out_usage` at the top of your Fastfile
[02:14:34]: 12: lane :beta do
[02:14:34]: 13: xcversion(version: "12.3")
[02:14:34]: => 14: xcode-select -s /Applications/Xcode_12.3.app
[02:14:34]: 15: if is_ci
[02:14:34]: 16: create_keychain(
[!] Syntax error in your Fastfile on line 14: Fastfile:14: syntax error, unexpected unary-, expecting `do' or '{' or '('
xcode-select -s /Applications/Xcode_12.3.app
^
Fastfile:14: unknown regexp options - Xcd
...e-select -s /Applications/Xcode_12.3.app
... ^~~~~~
Fastfile:14: syntax error, unexpected local variable or method, expecting `end'
...elect -s /Applications/Xcode_12.3.app
... ^~~
Fastfile:14: unexpected fraction part after numeric literal
...ect -s /Applications/Xcode_12.3.app
... ^~
Fastfile:46: syntax error, unexpected `end', expecting end-of-input
Error: Process completed with exit code 1.
What should I do to specify the version of Xcode?
Upvotes: 8
Views: 14848
Reputation: 76
2023 Update
As of release 2.211.0 of Fastlane, both the xcversion and xcode-install lanes have been depecrated and replaced with xcodes.
There are now two ways to set an Xcode version for a fastlane execution (without affecting the system selection and requiring sudo permission).
xcode_select("/Applications/Xcode-14.1.app")
xcodes(version: "14.1", select_for_current_build_only: true)
Note that if you opt for option 2, you will need to install the xcodes CLI in the system you are executing your fastlane action from.
Upvotes: 6
Reputation: 166
The following is enough:
xcversion(version: "12.3")
According to the Documentation:
Finds and selects a version of an installed Xcode (...)
So the xcode-select
instruction is not needed.
Regarding xcode_select
, not sure if it even exists.
Upvotes: 5