Sign in Join
Wiki copytemporary

macOS Big Sur changes for developers: what changed

Revision 3 to 4. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11*(macOS only)*
22
33## User interface changes
44
55macOS 11 Big Sur introduces many user interface changes that update the appearance of applications and make them more iOS-like. It also adds support for familiar iOS features — such as SF Symbols and text styles.
66
77### Icons and Images
88
99macOS 11 refreshes icon design throughout the system and also introduces multipurpose feature icons that can represent items or functions in sidebars and tables. It also adopts iOS SF Symbols. macOS 11 automatically maps AppKit shared images — such as Action, Unlocked, and Share — to specific symbols. In some cases, a symbol might not have the same size or alignment as the AppKit image it replaces, so check your layout.
1010
1111![](/wiki-images/3/3e/SF_Symbols.png)
1212
1313### Application icons
1414
1515In macOS 11, application icons combine a rounded-rectangle shape, a front-facing perspective, and a consistent drop shadow.
1616
1717![](/wiki-images/8/8e/MacOS11_app_icons1.png)
1818
1919The new design does not preclude *judicious* expressiveness. For example, the Preview, Xcode, and TextEdit icons continue to combine depictions of the physical objects that best convey the applicationʼs core purpose, while incorporating the new shape, perspective, and shadow.
2020
2121![](/wiki-images/f/f2/MacOS11_app_icons2.png)
2222
2323### Document Icons
2424
2525To compose a document icon, the system combines your application icon with the familiar folded-corner icon shape. If your application opens or creates a large number of document types, you can also supply a custom centre image or background appearance to help people distinguish them.
2626
2727![](/wiki-images/c/c8/MacOS11_doc_icons.png)
2828
2929### Feature Icons
3030
3131A feature icon can represent an item (or category of items), a technology, or a type of information in a table view or in the content sidebar of a preferences window. A feature icon typically uses the macOS 11 rounded rectangle shape to contain a simple, unambiguous glyph, but it can also use custom shapes and colors. For help designing a feature icon, download the production template included in the [Apple Design Resources for macOS](https://developer.apple.com/design/resources/#macos-apps).
3232
3333| | |
3434|----|----|
3535| macOS 11 | macOS 10.15 |
3636| ![](/wiki-images/a/ae/MacOS11_feature_icon.png) | ![](/wiki-images/d/d5/MacOS10_feature_icon.png) |
3737
3838### Application Accent Colours
3939
4040In macOS 11, you can specify an accent colour to customize the appearance of your applicationʼs buttons, selection highlighting, and sidebar glyphs. The system applies your accent colour when the current value in the user's General \> Accent colour preferences is multicolour.
4141
4242If users set the Accent colour preferences to a value other than multicolour, the system applies their chosen colour to the relevant items throughout your application, replacing your accent colour. The exception is a sidebar glyph that uses a fixed colour you specify. Because a fixed-colour sidebar glyph uses a specific colour to provide meaning, the system does not override its colour when users change the value of Accent colour preferences. To learn more, see Sidebars.
4343
4444The iCloud glyph remains teal, even when the other glyphs use orange.
4545
4646![](/wiki-images/e/e1/IClould_glyph.png)
4747
4848### Windows and Views
4949
5050Throughout macOS 11, windows adopt visual cues from iOS interfaces. For example, windows integrate the sidebar, toolbar, and content areas, use an increased corner radius, and display lightweight controls.
5151
5252![](/wiki-images/6/64/Macos11_window_view.png)
5353
5454#### Toolbars and Title Bars
5555
5656By default, toolbars are taller, window titles can display inline with controls, and toolbar items no longer include a bezel.
5757
5858| | |
5959|----|----|
6060| macOS 11 | macOS 10.15 |
6161| ![](/wiki-images/1/13/MacOS11_tool-title_bar.png) | ![](/wiki-images/b/bc/MacOS10_tool-title_bar.png) |
6262
6363To match the default toolbar’s increased height, toolbar items automatically use the large control size. The exception is an integrated toolbar-title bar area — such as the one in a Safari window — which continues to use the regular control size. To accommodate the new default size, you’ll probably need to adjust the layout of your toolbar.
6464
6565| | |
6666|----|----|
6767| macOS 11 | macOS 10.15 |
6868| ![](/wiki-images/6/6f/MacOS11_tool_bar.png) | ![](/wiki-images/e/ef/MacOS10_tool_bar.png) |
6969
7070Continuing to use the [minSize](https://developer.apple.com/documentation/appkit/nstoolbaritem/1531777-minsize) and [maxSize](https://developer.apple.com/documentation/appkit/nstoolbaritem/1526451-maxsize) APIs to set the size of a toolbar item can clip the control, because the current values don’t account for the larger default size. Use constraints if you need to specify minimum or maximum sizes for a toolbar control.
7171
7272When horizontal space is limited, the toolbar can display the Search button in place of the search bar. When users click the Search button, the bar expands; when they click elsewhere in the window, the search bar collapses and the toolbar displays the button again.
7373
7474![](/wiki-images/3/3d/MacOS11_toolbar_search.png)
7575
7676In a preferences window, the toolbar can use SF Symbols, but the title position remains above the toolbar buttons. When needed for clarity, individual toolbar buttons can include colour. To indicate the active preference pane, the window applies a system-provided selection appearance to the selected toolbar button.
7777
7878| | |
7979|----|----|
8080| macOS 11 | macOS 10.15 |
8181| ![](/wiki-images/1/1b/MacOS11_prefs_toolbar.png) | ![](/wiki-images/e/ef/MacOS10_prefs_toolbar.png) |
8282
8383If your window includes multiple panes, you can align different subsets of toolbar items with each pane, so that as people resize the window, each set of items remains above its associated view.
8484
8585#### Sidebars
8686
8787In macOS 11, a sidebar extends to the full height of the window. Within the sidebar, default item spacing, row height, and glyph size all increase, and the selected-item highlight uses a rounded-corner appearance.
8888
8989| | |
9090|----|----|
9191| macOS 11 | macOS 10.15 |
9292| ![](/wiki-images/e/e5/MacOS11_sidebar.png) | ![](/wiki-images/6/6a/MacOS10_sidebar.png) |
9393
9494A sidebar’s row height, text, and glyph size depend on its overall size, which can be small, medium, or large. You can set the size programmatically, but users can also change it by selecting a different sidebar icon size in General preferences. The table below shows the differences in default sidebar metrics between macOS 11 and previous versions of macOS.
9595
96-<thead>
97-
98-</thead>
99-<tbody>
100-
101-</tbody>
96+| Sidebar size | Sidebar component | macOS 11 (default) | macOS 10.15 and earlier (default) |
97+|---|---|---|---|
98+| Small | Row height | 24pt | 22pt |
99+| | SF symbol scale | Medium † | – |
100+| | Glyph size | 16pt × 16pt | – |
101+| | Text size (style) | 11pt (Subhead) | 11pt |
102+| Medium | Row height | 28pt | 24pt |
103+| | SF symbol scale | Medium | – |
104+| | Glyph size | 20pt × 20pt | 18pt × 18pt |
105+| | Text size (style) | 13pt (Body) | 13pt |
106+| Large | Row height | 32pt | 32pt |
107+| | SF symbol scale | Medium | – |
108+| | Glyph size | 24pt × 24pt | 24pt × 24pt |
109+| | Text size (style) | 15pt (Title 3) | 13pt |
110+| All | Horizontal spacing between cells | 17pt | 3pt |
111+| | Vertical spacing between cells | 0pt | 2pt |
112+| † In some cases, a small sidebar may use small-scale SF Symbols by default. | | | |
102113
103114Using SF Symbols is the easiest way to create sidebar glyphs that use the new metrics. Alternatively, you can use PDF template images to create sidebar glyphs; if you must use bitmap images, be sure to create them in small, medium, and large sizes, at both @1x and @2x resolutions.
104115
105116By default, sidebar glyphs use the current accent colour (to learn more, see Application Accent Colours). If you need to clarify the meaning of an individual sidebar glyph, you can give it a fixed color that persists regardless of the user’s Accent colour preferences. Don’t use the ability to specify a fixed colour to stylize your application as a whole. In macOS, people expect to see their chosen accent colour throughout all the applications they use.
106117
107118#### Table Views
108119
109120In macOS 11, table views are larger overall, using taller rows, a larger font size, and more space between items to increase visual separation within and around table content. macOS 11 introduces three table-view styles to define different appearances that work well in specific window areas: inset, full-width, and automatic. For developer guidance, see [NSTableView.style](https://developer.apple.com/documentation/appkit/nstableview/3622475-style).
110121
111122The *inset style* adds insets to the expanded spaciousness of macOS 11 tables. Because the inset style increases the visual space around the content, it works well in tables that fill the area between other views — such as sidebars and toolbars — and echoes the changes in sidebar appearance.
112123
113124![](/wiki-images/9/95/MacOS11_tableview_inset.png)
114125
115126The *classic, full-width table style* remains available, but automatically includes the required content padding at the beginning and end of each row. The full-width style works best for tables that already have a visual margin around them, such as a table embedded in a preferences pane.
116127
117128![](/wiki-images/a/a0/MacOS11_tableview_classic.png)
118129
119130The *automatic style* means the system uses the table view’s position in the view hierarchy to help determine its appearance.
120131
121132To create more spacious tables, macOS 11 uses several new table-view metrics. In the diagrams that follow, you can see how the layout of a table row differs between macOS 11 and macOS 10.15 and earlier.
122133
123134| | |
124135|----|----|
125136| macOS 11 | macOS 10.15 |
126137| ![](/wiki-images/9/91/MacOS11_tableview_layout.png) | ![](/wiki-images/7/7d/MacOS10_tableview_layout.png) |
127138
128139The following table lists the values for the table-row layout areas shown above.
129140
130141| Table-view metric | macOS 11 | macOS 10.15 and earlier |
131142|----|----|----|
132143| Recommended row height | 24pt | 17pt |
133144| Minimum row height for text-only rows | 18pt | 17pt |
134145| Inset at leading and trailing row edges | 10pt (inset style); 0pt (other styles) | – |
135146| Padding at leading and trailing row edges | 6pt | – |
136147| Intercell spacing | (17,0) | (3,2) |
137148| Text size (style) | 13pt (Body) | 11pt |
138149
139150In addition to the values listed in the table above, inset-style tables in macOS 11 also include a 10pt vertical inset before the first row and after the last row.
140151
141152As you adjust the layout of your table content to follow the new metrics:
142153
143154- Make sure your icons or glyphs can fit into a 16pt × 16pt area when you use the recommended 24pt row height
144155- Consider adding 6 points of space between items within a row to ensure a spacious table appearance
145156- If you don’t update your application, the appearance of your tables doesn’t change when your application runs in macOS 11. The exception is a table that implements a sidebar. If you identify the table style as a source list, the system automatically applies the new sidebar appearance. For guidance, see Sidebars; for developer guidance, see [NSTableView.style.sourceList](https://developer.apple.com/documentation/appkit/nstableview/style/sourcelist).
146157
147158> **Tip:** TIP In macOS 11, a table's width continues to equal the width of its rows, but the new padding and insets prevent columns and cells from covering the entire row. The system also uses the specified style to determine the space to add to row background features, like selection appearance or alternating row colors. If you need to provide content that completely covers a row — such as a custom background appearance — add it to the row instead of the cells.
148159
149160#### Sheets
150161
151162Sheets no longer unfurl from the bottom edge of the parent window’s toolbar. In macOS 11, a sheet is a rounded rectangle view that floats on top of the dimmed parent window.
152163
153164| | |
154165|----|----|
155166| macOS 11 | macOS 10.15 |
156167| ![](/wiki-images/6/6f/MacOS11_sheet.png) | ![](/wiki-images/8/8b/MacOS10_sheet.png) |
157168
158169#### Alerts
159170
160171Alerts are cardlike rectangles that use the same corner radius as all windows in macOS 11. Within an alert, most content is center aligned.
161172
162173![](/wiki-images/1/1f/MacOS11_alert.png)
163174
164175You can also use red text to emphasize a destructive action in an alert.
165176
166177![](/wiki-images/8/88/MacOS11_alert_red.png)
167178
168179### Menus
169180
170181macOS 11 introduces visual changes to menus and menu content. If you use standard menus and menu items, you get the following default appearances automatically:
171182
172183- Menu item titles use the same 13-point font size as sidebars and window content areas.
173184- Menu separator lines are 1 point thick and inset from the sides.
174185- The selection highlight for a menu item is a rounded rectangle that’s inset from the edges of the menu.
175186
176187| | |
177188|----|----|
178189| macOS 11 | macOS 10.15 |
179190| ![](/wiki-images/f/f7/MacOS11_menu.png) | ![](/wiki-images/2/2b/MacOS10_menu.png) |
180191
181192### Controls
182193
183194Refreshed AppKit controls — such as checkboxes, pop-up buttons, push buttons, and segmented controls — emphasize simplicity and boldness, similar to iOS controls while maintaining familiar appearances. When you use standard AppKit controls in your application, you shouldn’t have to adjust your interface to adopt the new appearances. The exception is the slider, which is taller.
184195
185196| Slider | Size | macOS 11 (default) | macOS 10.15 and earlier (default) |
186197|----|----|----|----|
187198| Without tick marks | Regular | 28pt | 19pt |
188199| | Small | 20pt | 15pt |
189200| | Mini | 17pt | 13pt |
190201| With tick marks | Regular | 28pt | 24pt |
191202| | Small | 20pt | 18pt |
192203| | Mini | 17pt | 15pt |
193204
194-<thead>
195-
196-</thead>
197-<tbody>
198-
199-</tbody>
200-
201-<thead>
202-
203-</thead>
204-<tbody>
205+| Slider without tick marks | |
206+|---|---|
207+| macOS 11 | macOS 10.15 |
208+| ![](/wiki-images/4/44/MacOS10_slider_notick.png) | ![](/wiki-images/8/81/MacOS11_slider_notick.png) |
205209
206-</tbody>
210+| Slider with tick marks | |
211+|---|---|
212+| macOS 11 | macOS 10.15 |
213+| ![](/wiki-images/6/61/MacOS11_slider_ticks.png) | ![](/wiki-images/1/18/MacOS10_slider_ticks.png) |
207214
208215Beginning in macOS 11, the track of a slider with tick marks aligns with the center of the thumb.
209216
210217### Typography
211218
212219Beginning in macOS 11, SF Pro is available as a variable font. The variable font format delivers a single package that includes the glyphs for all supported weights — such as regular, bold, and ultralight — in both uprights and italics. The variable format also supports optical sizing, which is a way to interpolate between glyphs to create size-specific versions of SF Pro to fit every design. Optical sizing replaces the need for the fixed-range Text and Display variants of SF Pro.
213220
214221macOS 11 also introduces support for the full range of text styles, such as body, headline, and callout. Dynamic Type is not available in macOS 11. For guidance, see [Typography](https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/typography/).
215222
216223### Widgets
217224
218225A widget elevates a small amount of useful content from your application. In macOS 11, you can create widgets in small, medium, and large sizes; people choose the size they want when they add your widget to Notification Center.
219226
220227You can also create widgets for iOS and iPadOS. For guidance, see [Widgets](https://developer.apple.com/design/human-interface-guidelines/ios/system-capabilities/widgets/); for developer guidance, see [WidgetKit](https://developer.apple.com/documentation/widgetkit).
221228
222229## Removed features
223230
224231- Kernel extensions using certain KPIs deprecated in macOS 10.15 Catalina no longer load. Refer to the [Apple support page](https://developer.apple.com/support/kernel-extensions) for details.
225232
226233## Deprecations
227234
228235- The default initializer on the auto-generated model interface has been deprecated in favor of init(configuration:). Use init(configuration:) or the newly introduced .load() method and handle model load errors as appropriate. (macOS 11.0.1)
229236
230237- The function hv_vcpu_run(_:) is deprecated. (macOS 11.0.1)
231238
232239- The VNIdentifiedPointsObservation class is deprecated. Use VNRecognizedPointsObservation instances instead. (macOS 11.0.1)
233240
234241- Support for the Developer Transition Kit is no longer available as of macOS Big Sur 11.3. (macOS 11.3)
235242
236243- Don’t use the iOS MinimumOSVersion information property list key to declare the minimum release of macOS in which your app runs. Use LSMinimumSystemVersion instead. (macOS 11.3)
237244
238245## New features
239246
240247#### Security
241248
242249macOS Big Sur 11 improves system security by requiring an administrator password when a certificate trust settings change is made in the admin trust domain. Running as the root user alone is no longer sufficient to modify certificate trust. User trust domain settings continue to require confirmation by entering the password for the user’s account. This change may affect you if one of the following is true:
243250
244251- You have written scripts which call `/usr/bin/security add-trusted-cert -d ...` as root.
245252- Your process runs as root and calls the SecTrustSettingsSetTrustSettings function to trust a certificate.
246253- Workflows that add trust settings in the admin trust domain, such as for an enterprise root certificate, may require modification if the user can’t authenticate as an administrator at the time settings are changed.
247254 - Workaround: Use Apple Configurator 2 to create and install a configuration profile containing your root certificate.
248255
249256#### Kernel
250257
251258- The `kern.argmax` limit has been increased, allowing programs to receive longer argument lists.
252259- Darwin `kevent` now allows non-parent processes to register for NOTE_EXITSTATUS, which delivers the same values as the `wait()` family of functions in the event data. Refer to the `wait4()` man page for more information. This event is subject to the following security checks:
253260 - The requesting process is allowed to send signals by sandbox restrictions.
254261 - The requesting process and the target process are running as the same user or the requesting process has root privileges.
255262
256263#### Safari
257264
258265- Support for Web Extensions is now available. Existing Chrome and Firefox extensions can be converted for Safari using xcrun safari-web-extension-converter and distributed through the App Store for use in Safari 14.
259266
260267#### Time Machine
261268
262269- APFS-formatted backup volumes are now supported for faster, more compact, and more reliable backups. New local and network Time Machine backup destinations are formatted as APFS by default. Time Machine will continue backing up to existing HFS backup volumes.
263270
264271#### Virtualisation
265272
266273- The Hypervisor framework now requires the com.apple.security.hypervisor entitlement.
267274- A new Virtualization framework provides high-level APIs to run Linux in a virtual machine.
268275
269276#### Built-in dynamic linker cache
270277
271278New in macOS Big Sur 11, the system ships with a built-in dynamic linker cache of all system-provided libraries. As part of this change, copies of dynamic libraries are no longer present on the filesystem. Code that attempts to check for dynamic library presence by looking for a file at a path or enumerating a directory will fail. Instead, check for library presence by attempting to *dlopen()* the path, which will correctly check for the library in the cache.
272279
273280As the libraries are no longer present on the filesystem, it makes it difficult to disassemble them! Fortunately, there are ways to extract the system libraries from the cache. One way is provided by Apple itself: the `dyld_shared_cache_util` tool command-line tool. Unfortunately, this tool does not come installed with macOS Big Sur. However, the tool is open source - see [dyld_shared_cache_util](https://opensource.apple.com/source/dyld/dyld-519.2.1/launch-cache/) and for the "fixed to compile as is" Xcode project source see [dyld-shared-cache-big-sur](https://github.com/antons/dyld-shared-cache-big-sur).
274281
275282### Other differences: Intel vs aarch64
276283
277284- **Timing**: Any code which uses Mach Absolute time when run in Rosetta translation is given Mach ticks equivalent to one every nanosecond as happens on an Intel processor; whereas aarch64 native Mach ticks are incremented every 41.67 nanoseconds instead.
278285
279286## ARM64/AArch64/Apple Silicon Support
280287
281288macOS 11 Big Sur is the first macOS version that supports Apple's AArch64 processors on the desktop. FPC trunk supports targeting this platform.
282289
283290The following instructions assume that you are working on an AArch64 Mac, that you have already installed FPC 3.2.2 for Intel, and that the **Xcode.app** bundle is located in the **/Applications** folder. You can place it elsewhere and adjust the paths accordingly so long as there are no spaces in the path.
284291
285292> **Note:** If you have only installed the standalone Command Line Tools and not the full Xcode package, you will need to replace *`/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin`*` with `*`/Library/Developer/CommandLineTools/usr/bin`* and *`/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk`*` with `*`/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk`*
286293
2872941. Compile a native AArch64 compiler from the FPC trunk source
288295 :
289296
290297make distclean make FPC=ppcx64 OPT="-ap -FD/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -XR/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" CPU_TARGET=aarch64 -j 4 FPMAKEOPT="-T 4" all \> build.log
291298
2922991. Copy the created native compiler to a safe place (the delete + copy is to avoid issues with a code signature caching bug in the OS - see [[Code Signing for macOS|Updating a signed file]] for an explanation)
293300 :
294301
295302rm -f ppca64 ; cp compiler/ppca64 .
296303
2973041. Build a complete native FPC distribution for Darwin/AArch64
298305 :
299306
300307make distclean make FPC=\$PWD/ppca64 OPT="-ap -FD/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -XR/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" -j 4 FPMAKEOPT="-T 4" OVERRIDEVERSIONCHECK=1 all \> build.log
301308
3023091. Install the built toolchain globally (under /usr/local)
303310 :
304311
305312sudo make FPC=\$PWD/ppca64 OPT="-ap -FD/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -XR/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" install
306313
3073141. Enable the **fpc** binary to find the AArch64 compiler (**ppca64**). You only need to do this once, even if you build/install newer build later on (unless the version number of trunk would change)
308315 :
309316
310317sudo ln -sf /usr/local/lib/fpc/3.3.1/ppca64 /usr/local/bin
311318
3123191. Create a file called ".fpc.cfg" (note the starting ".") in your home directory with the following contents
313320 :
3143212. include /etc/fpc.cfg
315322
316323-FD/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -XR/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
317324
318325Now you can use either **fpc** or **ppca64** to compile AArch64 programs.
319326
320327> **Warning:** When you wish to build a newer version later on, make sure to restart at step 1. As always, compiling the trunk sources is only supported when you start with one of the latest two FPC releases, or with a compiler built from the same trunk sources. Starting with a trunk compiler built using previous trunk sources is not and never will be supported.
321328
322329## Creating a universal binary for aarch64 and x86_64
323330
324331### FPC applications
325332
326333Open a Terminal and use the following commands:
327334
328335``` bash
329336fpc my_app.pas -omy_app_ARM64 -Paarch64
330337fpc my_app.pas -omy_app_X8664 -Px86_64
331338lipo -create -output my_app my_app_ARM64 my_app_X8664
332339strip my_app
333340```
334341
335342You can check that you have created a universal binary with this command:
336343
337344``` bash
338345file my_app
339346```
340347
341348which should produce output similar to this:
342349
343350```text
344351my_app: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64]
345352my_app (for architecture x86_64): Mach-O 64-bit executable x86_64
346353my_app (for architecture arm64): Mach-O 64-bit executable arm64
347354```
348355
349356### Lazarus applications
350357
351358- Go to Lazarus Menu, Project \> Project Options \> Compiler Options - Config and target
352359- Select Target CPU family "aarch64"
353360- Go to Lazarus Menu, Project \> Project Options \> Compiler Options - Paths - Target filename
354361- Rename my_app to my_app_ARM64
355362- Compile
356363
357364- Go to Lazarus Menu, Project \> Project Options \> Compiler Options - Config and target
358365- Select Target CPU family "x86_64"
359366- Go to Lazarus Menu, Project \> Project Options \> Compiler Options - Paths - Target filename
360367- Rename my_app to my_app_X8664
361368- Compile
362369
363370- Open a Terminal and execute the following commands in your my_app directory:
364371
365372``` bash
366373lipo -create -output my_app my_app_ARM64 my_app_X8664
367374strip my_app
368375```
369376
370377You now have a universal binary with which to replace the symbolic link in your final [[Application Bundle|application bundle's]] MacOS directory. You can check that you have created a universal binary with this command:
371378
372379``` bash
373380file my_app
374381```
375382
376383which should produce output similar to this:
377384
378385```text
379386my_app: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64]
380387my_app (for architecture x86_64): Mach-O 64-bit executable x86_64
381388my_app (for architecture arm64): Mach-O 64-bit executable arm64
382389```
383390
384391### Removing duplicate resources in universal binaries
385392
386393When creating universal binaries any resources will be duplicated in each executable which increases the file size of the universal binaries, sometimes quite substantially depending on the size of the resources.
387394
388395The Free Pascal Compiler supports loading external resources on Darwin using the -We command line option. For usage examples, see:
389396
390397- <https://gitlab.com/freepascal.org/fpc/source/-/blob/main/tests/test/units/system/tresext.pp> and
391398- <https://gitlab.com/freepascal.org/fpc/source/-/blob/main/tests/test/units/system/tres2ext.pp>
392399
393400## Code signing - Intel vs M1
394401
395402On **Intel** systems running Big Sur very little is required to be signed *except for* kernel and system extensions and related code which require special approval from Apple.
396403
397404The situation is different on **M1** Apple Silicon (aarch64) systems running Big Sur. There are a few situations to consider:
398405
399406- Intel code running under Rosetta 2 - this does not need to be signed for practical reasons (ie the code is translated into aarch64 code for the M1 and so any signature for the Intel code would of course be invalid when applied to the aarch64 code).
400407
401408- Native M1 aarch64 code will be blocked from execution unless a valid signature is attached. This signature can be as simple as an ad hoc code signature that doesn’t bear any actual identity from the secret half of an asymmetric key pair (it’s simply an unauthenticated measurement of the binary). The reason for this requirement is not to enable conventional code signature checks, but so that the executable code has a cdhash (code directory hash), which is used when macOS checks code before running it to verify that the contents of a binary have not changed since being code signed. If you don’t have an Apple developer signing certificate, an ad-hoc certificate generated on your Mac is quite sufficient. For those without developer accounts, [[Xcode]] now defaults to applying ad-hoc signing to its projects. As there is no requirement for an identity, and therefore any certificate to prove that identity, anyone can sign an application to run locally.
402409
403410- Universal binaries that include both Intel code and native M1 aarch64 code will be blocked from execution unless a valid signature is attached.
404411
405412Checking the status of code signing for FPC and/or FPC and Lazarus native code executables shows:
406413
407414``` pascal
408415$ codesign -dv -r- ./program
409416Executable=/Users/trev/Documents/fpc_adhoc_test/program
410417Identifier=program
411418Format=Mach-O thin (arm64)
412419CodeDirectory v=20400 size=3392 flags=0x20002(adhoc,linker-signed) hashes=103+0 location=embedded
413420Signature=adhoc
414421Info.plist=not bound
415422TeamIdentifier=not set
416423Sealed Resources=none
417424# designated => cdhash H"6d17593d42b7b10d8af344197c48df47beda2779"
418425```
419426
420427```text
421428$ codesign -dv -r- DemoDownload.app
422429Executable=/Users/trev/Documents/laz_resume_dload/DemoDownload.app/Contents/MacOS/DemoDownload
423430Identifier=DemoDownload
424431Format=app bundle with Mach-O thin (arm64)
425432CodeDirectory v=20400 size=110533 flags=0x20002(adhoc,linker-signed) hashes=3451+0 location=embedded
426433Signature=adhoc
427434Info.plist=not bound
428435TeamIdentifier=not set
429436Sealed Resources=none
430437# designated => cdhash H"bb0a310c980906bd6320deaabc72f543dc725bbb"
431438```
432439
433440So, it appears that the macOS linker is doing the ad hoc code signing for us and generating the all-important cdhash.
434441
435442What happens if you edit the executable with the cdhash (I changed a single occurrence of Assertion to ASsertion) ?
436443
437444``` pascal
438445 $ ./program
439446 Killed
440447```
441448
442449and:
443450
444451 Process: DemoDownload [7888]
445452 Path: /Users/USER/Documents/*/DemoDownload.app/Contents/MacOS/DemoDownload
446453 Identifier: com.company.DemoDownload
447454 Version: 0.1 (1)
448455 Code Type: ARM-64 (Native)
449456 Parent Process: ??? [1]
450457 Responsible: DemoDownload [7888]
451458 User ID: 501
452459
453460 Date/Time: 2021-03-14 15:52:46.806 +1100
454461 OS Version: macOS 11.2.3 (20D91)
455462 Report Version: 12
456463 Anonymous UUID: FDB6D79D-592D-3959-8F4F-9EC29A74836C
457464
458465 Time Awake Since Boot: 5300 seconds
459466
460467 System Integrity Protection: enabled
461468
462469 Crashed Thread: 0 Dispatch queue: com.apple.main-thread
463470
464471 Exception Type: EXC_BAD_ACCESS (Code Signature Invalid)
465472 Exception Codes: 0x0000000000000032, 0x00000001023bd758
466473 Exception Note: EXC_CORPSE_NOTIFY
467474
468475 Termination Reason: Namespace CODESIGNING, Code 0x2
469476
470477Beware if you use a workflow involving tools that modify a binary after linking (eg strip or install_name_tool). In these situations you will almost certainly need to manually use codesign as an additional build phase to properly ad-hoc sign your binary.
471478
472479### What does this mean for natively compiled FPC and Lazarus aarch64 binaries?
473480
474481If you deploy:
475482
4764831\) an unsigned binary to your endusers, they *will NOT be able* to execute the binary on an M1 Apple Silicon computer. Note, however, that if the binary was linked on an M1 Apple Silicon computer, the macOS linker will have *ad hoc* signed the binary for you.
477484
4784852\) an *ad hoc* signed binary to your endusers, they *will be able* to execute the binaries on an M1 Apple Silicon computer. This is because these new signatures are **not** bound to the specific machine that was used to build the executable; they can be verified on any other system and will be sufficient to comply with the new default code signing requirement on Macs with Apple silicon. However, given that these signatures do not bear any valid identity, binaries signed this way cannot pass Gatekeeper.
479486
480487For manual ad hoc code signing of an application bundle (note that a dash is using for the signing identity after the -s argument):
481488
482489```text
483490codesign --force --deep -s - MyApp.app
484491```
485492
486493Also note that you cannot sign an application bundle where the executable is a symlink (eg an application compiled with Lazarus) unless you replace the symlink with the linked executable.
487494
488495For manual ad hoc signing of a command line utility:
489496
490497```text
491498codesign --force -s - MyExe
492499```
493500
494501### Code signing an x86_64 binary on an aarch64 machine
495502
496503## Apple Big Sur "New Look" external links
497504
498505- [WWDC2020 - New look macOS](https://developer.apple.com/videos/play/wwdc2020/10104/)
499506- [WWDC2019 - Introducing SF Symbols](https://developer.apple.com/videos/play/wwdc2019/206)
500507- [WWDC2020 - SF Symbols 2](https://developer.apple.com/videos/play/wwdc2020/10207)
501508
502509## Apple Silicon external links
503510
504511- [Apple: Porting Your macOS Apps to Apple Silicon](https://developer.apple.com/documentation/xcode/porting_your_macos_apps_to_apple_silicon)
505512- [Apple: Building a Universal macOS Binary](https://developer.apple.com/documentation/xcode/building_a_universal_macos_binary)
506513- [Apple: Addressing Architectural Differences in Your macOS Code](https://developer.apple.com/documentation/apple_silicon/addressing_architectural_differences_in_your_macos_code)
507514- [Apple: Porting Your Audio Code to Apple Silicon](https://developer.apple.com/documentation/audiounit/porting_your_audio_code_to_apple_silicon)
508515- [Apple: Porting Your Metal Code to Apple Silicon](https://developer.apple.com/documentation/metal/porting_your_metal_code_to_apple_silicon)
509516- [Apple: Installing a Custom Kernel Extension](https://developer.apple.com/documentation/apple_silicon/installing_a_custom_kernel_extension)
510517- [Apple: Debugging a Custom Kernel Extension](https://developer.apple.com/documentation/apple_silicon/debugging_a_custom_kernel_extension)
511518- [Apple: Platform Security Guide](https://support.apple.com/en-au/guide/security/welcome/web).
512519- [Apple: Code signing x86_64 binaries on aarch64](https://developer.apple.com/forums/thread/673323).
513520
514521## Big Sur Release Notes
515522
516523- [Apple: macOS Release Notes](https://developer.apple.com/documentation/macos-release-notes/).
517524
518525---
519526*From the Free Pascal wiki, page "macOS Big Sur changes for developers", as it stood on 2022-05-08 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
520527Category: FPC
521528Category: Install
522529Category: Lazarus
523530Category: Platform-sensitive development
524531Category: macOS

Back to history