Skip to content

Build and run natively on Apple Silicon (Xcode 26 / macOS 26)#1377

Open
mavliev wants to merge 1 commit into
MacDownApp:masterfrom
mavliev:apple-metal
Open

Build and run natively on Apple Silicon (Xcode 26 / macOS 26)#1377
mavliev wants to merge 1 commit into
MacDownApp:masterfrom
mavliev:apple-metal

Conversation

@mavliev

@mavliev mavliev commented Jun 28, 2026

Copy link
Copy Markdown

Summary

MacDown currently fails to build with modern Xcode because the project's deployment
target is macOS 10.8, which requires libarclite (removed in Xcode 14+). This PR makes
MacDown build and run as a native arm64 app on Apple Silicon with current toolchains,
using minimal, surgical changes.

Tested on Apple M2, macOS 26, Xcode 26.3, CocoaPods 1.16.2.

Changes

  • Raise deployment target 10.8 -> 11.0 in the Xcode project (all configurations) and
    the Podfile, plus a post_install hook so the generated Pods project keeps the same
    target. This is the only change required to fix the libarclite build failure.
  • Fix a latent out-of-bounds read in MPToolbarController.m: spaceAfterIndices[]
    and flexibleSpaceAfterIndices[] were indexed without bounds checks. This was benign
    under the old x86_64 toolchain, but the arm64 Release optimizer made it crash at launch
    in toolbarDefaultItemIdentifiers:. Added bounds guards (behavior-preserving).
  • Modernize 14 deprecated API uses across 7 files (warnings only, no behavior change):
    • NSAutoPagination -> NSPrintingPaginationModeAutomatic
    • NSFileHandlingPanelOKButton -> NSModalResponseOK
    • NSOnState -> NSControlStateValueOn
    • deprecated -insertText: -> -insertText:replacementRange:
    • +unarchiveObjectWithFile: -> secure +unarchivedObjectOfClasses:fromData:error:
      (verified to decode data.map / treats.map identically)
    • colorUsingColorSpaceName: -> colorUsingColorSpace:
    • drag-and-drop updated to NSPasteboardTypeFileURL + readObjectsForClasses:options:
      (also fixes a registerForDraggedTypes: that registered a pasteboard name, not a type)
  • Add MacDown/MacDown.entitlements (hardened-runtime compatible) to support
    notarization-ready distribution builds.

Not included (intentionally, to keep this focused)

  • Legacy WebView / DOMNode -> WKWebView migration. Those APIs are deprecated but
    still function; migrating is a larger change best left to a separate PR.
  • Sparkle 1.x -> 2.x migration.

Testing

  • Clean Release build succeeds with no errors; the produced binary is universal and
    includes a native arm64 slice.
  • App launches and runs natively (verified Code Type: ARM64, not under Rosetta).
  • An independent clean rebuild reproduces the result.

🤖 Generated with Claude Code

- Raise deployment target 10.8 -> 11.0 (project.pbxproj + Podfile + post_install
  hook). 10.8 required the removed libarclite and was the only build blocker.
- Fix latent out-of-bounds toolbar array reads in MPToolbarController.m that
  crashed at launch under the arm64 Release optimizer.
- Modernize 14 deprecated API uses across 7 files (NSAutoPagination,
  NSFileHandlingPanelOKButton, NSOnState, insertText:replacementRange:, secure
  NSKeyedUnarchiver, colorUsingColorSpace:, file-URL drag pasteboard). Secure
  unarchiving verified to decode the .map resources identically.
- Add MacDown/MacDown.entitlements (hardened-runtime compatible) for
  notarization-ready distribution builds.

Legacy WebView/DOMNode deprecations deferred (need a WKWebView migration).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@JanX2

JanX2 commented Jun 29, 2026

Copy link
Copy Markdown

Just an FYI: there already is a fork, that is being maintained:

https://macdown.app

https://github.com/schuyler/macdown3000

MacDown 3000
MacDown 3000 - A free, open source Markdown editor for macOS with live preview, syntax highlighting, GitHub Flavored Markdown, and Apple Silicon optimization. Download the best lightweight Markdown editor for Mac.
GitHub
A modern, lightweight Markdown editor for macOS. Contribute to schuyler/macdown3000 development by creating an account on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants