6

I just installed the latest version of Xcode (10.1) on MacOS 10.14 (Mojave). I can build my application and it runs fine on my Mac or similar system.

However, I want to share this application with someone using MacOS 10.11 (El Capitan) and it fails to launch, asking for a minimum requirement of MacOS 10.13 (High Sierra).

My application is only very simple, can't I compile it to be compatible with older MacOS ?


After some research, I did download MacOSX10.11.sdk (from https://github.com/phracker/MacOSX-SDKs/releases/). I did decompress it, and drag it into: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs (This folder originally contains only "MacOSX.sdk" and a link pointing to it, named "MacOSX10.14.sdk")

MacOS SDK folder in Xcode

I also noticed the value of the string "MinimumSDKVersion" from the file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist is equal to "10.11", which sounds good in my case.

I read on some forums adding additional SDK versions into Xcode is not supported. And by the way, I cannot see any menu from Xcode to specify my target build (neither in Xcode Preferences, nor in the project settings (see picture below).

enter image description here

Where can I tell Xcode to use, let's say "MacOSX10.11.sdk" over "MacOSX10.14.sdk"?

And, is there a better way?

Or, do I have to install an old version of MacOS on a different partition, with an old version of Xcode (which would be a pain)?

Yoric
  • 1,761
  • 2
  • 13
  • 15
  • 4
    You should compile against the latest SDK, and set the "Minimum Deployment Target" to the earliest macOS version you wish to support (https://stackoverflow.com/a/46467255/233944). Be careful to only use APIs that are available on the system your app is running on. – TheNextman Dec 17 '18 at 05:33
  • @TheNextman Thank you, that's exactly the option I was looking for. So I wasn't looking at the right place. I was imagining complicated ways, but the solution was only very simple. If you wrote your comment as an answer, I would accept it greatly. The SO ticket you pointed illustrates perfectly where the option lies. I didn't find it because I didn't think of such keywords as "deployment target swift". Thanks again for your time! – Yoric Dec 17 '18 at 06:03

2 Answers2

1

I am not sure if this still works on Mojave, but there is a project called XcodeLegacy which is created specifically with this intention in mind: https://github.com/devernay/xcodelegacy

reukiodo
  • 740
  • 6
  • 12
0

Regarding the menu, you can find it at: Xcode -> Select File -> Project/Workspace Setting

Open Workspace Settings

Works on Xcode 13, I'm a bit late to the party but just had the very same question.