Compile for iOS 5.1 in macOS Mojave

I have a macOS Mojave based Mac, and, for a project, I need to be able to target iOS 5.1 (iPad 1).

Xcode 10 doesn't ship build support for iOS 5.1, so I downloaded Xcode 4.3 from Apple's archives.

Xcode 4.3 isn't compatible with macOS Mojave, and from what I've been able to understand, it is with OS X Mountain Lion.

Without having to buy an old Mac (old enough to be based on OS X Mountain Lion), and without having to completely reinstall the OS, how can I compile for the iOS target 5.1, for an iPad 1?


Solution 1:

The latest Xcode version that is documented by Apple to include the iOS 5 SDK is Xcode 4.3.3 for Lion. Apple doesn't document in the release notes whether it is also included in Xcode 4.4 and Xcode 4.4.1. However, by Xcode 4.5 it is definitely not included anymore.

The important thing to notice here is that you actually do not need to have the iOS 5 SDK in order to build an app for iOS 5. This means that you can build apps for iOS 5 with an Xcode that is newer, and doesn't as such include the iOS 5 SDK.

You do this by setting the deployment target of your project. Inside Xcode you click on your project (the blueprint icon), select the Info tab and then you have a drop-down named "iOS Deployment Target". You'll want to set it to 5.1.

With modern Xcode releases, you can download simulators, etc. directly from within the latest Xcode - however this only goes back to iOS 8 for Xcode 10. This also goes for the deployment target.

The end result is that you can use a much newer Xcode than Xcode 4.3, although not the latest Xcode 10 releases. You just need to remember to set your deployment target for the project!

Solution 2:

Honestly, your best bet is to find a used Mac that can run Mountain Lion. It would likely be cheaper in time and $$ to go that route. The most recent Macs that can do that are 2007, 2008, 2009 models. I found a number of these systems on eBay for way under $100 bucks.

Failing that you might be able to get one of the virtualization packages (VMWare, VirtualBox, Parallels) to run that version of macOS.

I believe that virtualizing macOS on macOS is not something that is officially supported by any of the vendors who make that software but There are guides out there that may be able to help you virtualize macOS ON macOS with your virtualization platform of choice.