Last month, I analyzed the programming languages and UI frameworks used to create iOS 17. This month, let’s analyze macOS from OS X El Capitan 10.11 to the latest macOS Sonoma 14 and answer a few questions:
What is the total count of binaries within macOS Sonoma? Which programming languages are used to develop these apps? How many apps are written with Swift? How many apps are using Mac Catalyst and SwiftUI versus AppKit?
- Easily preview Mermaid diagrams
- Live update when editing in your preferred editor
- Capture screenshots with customizable margins
- Create PNG from the Terminal
- Free download on the Mac App Store
For practicality, I limited my analysis to the 9 most recent macOS releases:
- OS X El Capitan 10.11
- macOS Sierra 10.12
- macOS High Sierra 10.13
- macOS Mojave 10.14
- macOS Catalina 10.15
- macOS Big Sur 11
- macOS Monterey 12
- macOS Ventura 13
- macOS Sonoma 14
The methodology and tools to create this article have been detailed in my previous posts. If you are interested, please refer to:
- Apple’s use of AppKit, Mac Catalyst and SwiftUI in macOS
- Evolution of the programming languages from iPhone OS 1.0 to iOS 14
- Apple’s use of Swift in iOS 10.1 and macOS 10.12.
Before jumping into the details, let’s clarify a few points:
I only analyzed what is commonly called ‘macOS’, i.e. everything above the kernel. The XNU kernel and low-level firmwares are excluded, with the exception of the Secure Enclave.
I counted the frameworks located inside the dyld shared cache, a mechanism introduced in macOS Big Sur.
Keep in mind that a developer can mix different programming languages to create one binary. One example is a Mac app I developed, Dependencies, where I use Swift, Objective-C, C++, and C, the most appropriate programming language used to solve each specific problem. In this article, an app containing a single line of Swift code will be counted as using Swift.
You will see mentions of Objective-C and C++ but you might notice the absence of Objective-C++. The approach used here can’t really detect binaries built with Objective-C++. Such binaries are counted as using both Objective-C and C++.
Finally, you should take this analysis with a grain of salt. While I believe the overall picture to be accurate, my approach has some limitations because I don’t have access to the macOS source code and relied on imprecise compilation artifacts.
Number of binaries
Let’s first answer a simple question: What is the total count of binaries within macOS Sonoma? The number of binaries composing macOS is quite stable since a couple of releases: macOS Sonoma contains 7884 binaries, close to the number of binaries in macOS Big Sur.
The drop from macOS Sierra to macOS High Sierra can be attributed to the presence of both Python 2.6 and 2.7 in macOS Sierra, whereas macOS High Sierra only included Python 2.7.
Many extensions were removed with macOS Ventura, probably made possible by discontinuing support for pre-2017 Macs.
The increase with macOS Sonoma can be attributed to the fact that macOS Sonoma includes both Perl 5.30 and Perl 5.34, gains new frameworks, and some apps are split into multiple extensions.
Swift and SwiftUI in macOS Sonoma
Unsurprisingly, there has been a significant increase in the number of apps adopting SwiftUI this year. Notable mentions include:
- The new Print Center app is using SwiftUI
- The FindMy, Weather, and Screen Time apps have switched from Catalyst to SwiftUI
- Several AppKit apps now use SwiftUI, including Preview, Reminders, Screen Sharing, VoiceOver Utility, …
The Swift and SwiftUI adoption continues its climb: macOS Sonoma now contains 349 binaries using SwiftUI. Likewise the number of binaries containing at least one line of Swift code notably increased between macOS Ventura and macOS Sonoma:
At the WWDC 2020, Apple introduced the SwiftUI Application Life Cycle, making it possible to create SwiftUI apps without the dependency on older frameworks. An increasing number of apps are embracing the SwiftUI Application Life Cycle:
Evolution of the programming languages
By analyzing all major releases of macOS from OS X El Capitan to macOS Sonoma, we can see the evolution of the programming languages used by macOS. Again please note that a single binary can be counted multiple times, so the sum of the binaries in this graph is greater than the total number of binaries:
Some trends can be better visualized by displaying percentages:
What can we learn from these graphs?
- Objective-C is still at the core of macOS and is used directly or indirectly by most apps
- The adoption of Swift continues to grow rapidly
- The share of C and C++ slowly decrease over time
AppKit vs Mac Catalyst vs SwiftUI
Since macOS Catalina, developers can create native UI for their Mac apps using 3 different UI technologies:
AppKit is the old Cocoa toolkit, available to Mac developers since Mac OS X 10.0. It is powerful and mature but it was made clear during the WWDC 2022 State of the Union that it is not the future of Mac development.
Mac Catalyst is a technology to port native iOS apps written with UIKit, a framework derived from AppKit.
SwiftUI is a new UI framework to create declarative user interfaces. It was announced alongside Mac Catalyst at the WWDC 2019.
An effective way to understand the distribution of AppKit, Mac Catalyst, and SwiftUI is by grouping apps into 3 categories:
- Mac Catalyst apps (which may also use SwiftUI and AppKit)
- Apps using SwiftUI (they don’t use Mac Catalyst but might use AppKit)
- Apps exclusively using AppKit
What we can learn from the graph:
- A large percentage of apps are built using AppKit
- After a slow start, the number of apps using SwiftUI is rapidly increasing
- The share and number of apps using Mac Catalyst is now decreasing. Mac Catalyst was a great yet transitional technology.
We can get a finer grained picture by grouping the apps into 6 distinct categories:
The Secure Enclave is a hardware-based security component, isolated from the main processor to provide an extra layer of security. It was initially introduced with the iPhone 5S to ensure the security of sensitive user data, playing a critical role for Touch ID, Face ID, and Apple Pay. It was initially introduced on Macs around 2016 with the Apple T1 Chip.
What's new in Swift session (5:35) of the WWDC22, Apple stated that Swift is now suitable for restricted environments like the Secure Enclave Processor. We can indeed confirm that the
hibernation binary in macOS Ventura is using Swift:
There is also a lot of fascinating work for the Embedded Swift ecosystem like the recent announcement of Swift MMIO. It will be interesting to check the use of Swift in the Secure Enclave in the future.
Even though we don’t have access to the macOS source code, we can determine the programming languages used to create its built-in apps and we can measure the evolution of these languages from OS X El Capitan 10.11 to the latest macOS Sonoma 14.
Unsurprisingly, the number of apps adopting Swift and SwiftUI is rapidly growing, while the share of C and C++ is slowly decreasing over time.
More interestingly, the number of apps using Mac Catalyst is now decreasing. Initially employed by Apple for low-risk apps, this technology was later adopted for more critical apps such as Maps and Messages. 6 years after its introduction, it is becoming evident that this was a transitional technology.
In the upcoming years, it will be interesting to observe whether Swift is more widely adopted into low-level firmware, such as the Secure Enclave.
As previously mentioned, this approach has some limits and while I believe the overall picture to be accurate, I can’t guarantee that the results are perfectly exact. If you think that I missed something, please reach out to me on Mastodon @email@example.com.