r/macosprogramming • • Sep 24 '26

A problem I hit when opening CLI-provided files from a sandboxed macOS app

Post image
5 Upvotes

While building MergeDock, a native macOS file comparison app, I ran into a problem that looked simple at first:

https://mergedock.net

A command-line tool gives the Mac app two files. Open them and show the comparison.

The problem is that MergeDock is sandboxed.

Those files weren't selected through the app's NSOpenPanel, and receiving a file path doesn't automatically mean the sandboxed app should trust or retain access to it.

It became more complicated when I had to support both cases:

- MergeDock isn't running and gets cold-launched

- MergeDock is already running and receives another request

CLI arguments, Launch Services callbacks and file-access information don't necessarily arrive in an order I wanted the comparison logic to depend on.

My solution was to stop treating the command-line arguments as sufficient authority.

The CLI side first prepares the external files in a controlled staging area and marks that staging as ready.

The app then classifies the incoming request, validates the handoff payload and access grant, claims the staging state, and only then creates the comparison request.

The flow is roughly:

CLI receives external paths

↓

prepare controlled staging

↓

mark staging ready

↓

launch / hand off to MergeDock

↓

validate payload + access grant

↓

claim staging

↓

open comparison

I also suppress the normal document-open path for these CLI-driven launches. Otherwise a Launch Services file-open event and the CLI handoff could be interpreted as two different requests for what is really one operation.

For normal user-selected locations I still use Apple's security-scoped resource/bookmark APIs, including refreshing stale bookmarks. But CLI-driven file access has its own handoff and validation path.

The important distinction for me became:

receiving a path != trusting the path

and:

launching the app != successfully handing off the operation

Staging also gives the temporary files an explicit lifetime and cleanup path instead of making the UI depend on externally managed files remaining available.

It was more infrastructure than I expected for what initially sounded like “pass two file paths to the Mac app,” but the resulting ownership and sandbox boundaries are much clearer.

I'm curious how other macOS developers handle this.

If your sandboxed GUI receives files from a CLI/helper, do you stage them first, or have you found a cleaner way to safely hand file access into the app?


r/macosprogramming • • Sep 08 '26

Talk.swift - my first open source package that allows mac apps to "talk" to each other

5 Upvotes

Hey everybody 😄

I just published my first open-source package:

https://github.com/AppitStudio/Talk.swift

This package allows macOS app developers to create an "API Contract" for their app, publish it on the SDK repo, and other app creators can use this API to create fast integrations between their app and the provider app without the need to change the codebase of the "provider" app.

During this year, I got a few requests from developers to integrate my app with theirs, and it was super hard to implement,

I don't have access to their codebase, and they don't have mine,

I find Apple solutions outdated and difficult to implement.

Also, integration between my own apps was such a pain.

Hard to create a general solution, and every app needed some adaptation and custom code to work with each other.

This solution makes that simple.

Just use the SDK skill, tell your coding agent what functionalities you want to make public, and that's it,

It will install everything needed, configure the SDK and the settings screens (which you can always change later), and publish your API to the SDK repo.

And on the other side, you get the same workflow.

Install the skill, tell your agent "Create integration with dockflow using Talk SDK" and describe how you want to integrate it, and that's it.

DockFlow developers don't need to change a single line to support this new integration.

I hope more macOS developers can enjoy this package for both internal integrations between their apps and with third-party ones.

Let me know what you think, and I can't wait to see more apps join 😃


r/macosprogramming • • Aug 11 '26

CopySight: a native Swift 6 menu bar app for private on-device screen OCR

5 Upvotes

I’ve open-sourced CopySight, a small native macOS utility that turns a selected screen region into clipboard text. It uses ScreenCaptureKit for the selection capture and Apple Vision for recognition, then reconstructs line order before writing to NSPasteboard. The app has no accounts, network code, analytics, or third-party SDKs.

The release work was a useful macOS engineering exercise: SwiftPM builds arm64 and x86_64 separately, lipo combines the final executable, the app is signed with Developer ID and App Sandbox entitlements, and the universal DMG is notarized and stapled. The same codebase also has the separate App Store packaging path.

I’d welcome review or contributions around Vision text-layout reconstruction, multilingual OCR test fixtures, accessibility, and release automation. The repository includes contributor guidance, issue templates, tests, and the exact packaging scripts:

https://github.com/copysightapp/copysight


r/macosprogramming • • Jul 31 '26

What kept a Direct and Mac App Store build sane in one SwiftUI codebase

5 Upvotes

I maintain a native macOS app with both a directly distributed target and a Mac App Store target. The two builds share almost everything, but they differ in entitlements, update delivery, licensing, and a few integrations.

The setup became much easier to reason about after treating distribution as a boundary instead of allowing target checks throughout the app.

The rules that helped most:

• Keep domain models and persisted data identical. A file or database written by one build should not need a target-specific interpretation.

• Put compile-time checks at integration boundaries. Updater setup, receipt handling, licensing, and unavailable frameworks are reasonable places. View models and core processing code are not.

• Expose capabilities to the UI rather than scattering build flags through views. The view asks whether a capability exists, then renders the appropriate control.

• Give each target its own entitlements and Info.plist values. Review changes to those files explicitly because they are part of the product behavior, not build-system noise.

• Use separate bundle identifiers and any target-specific network identifiers or ports. This avoids collisions when both builds are installed during testing.

• Keep source membership boring. Shared files belong to both targets. Distribution-specific files belong to exactly one. If a file needs many conditional branches, it is probably sitting at the wrong architectural layer.

• Build both targets after every shared change. A successful Direct build says nothing about sandbox assumptions in the Store build.

• Use isolated DerivedData for each verification build. This catches accidental reliance on artifacts produced by the other target.

• Test first launch, upgrade, and side-by-side installation. Most target-specific bugs I found were lifecycle and migration issues rather than compiler errors.

• Keep the user-facing workflow as similar as the platform permits. Distribution differences should not leak into unrelated navigation or state.

The most useful mental model was this: one application, two distribution adapters. Once I organized the project that way, target conditionals stopped spreading.

For people shipping both variants, what still tends to diverge in your projects despite your best efforts?


r/macosprogramming • • Apr 13 '26

Airlock — crash isolation for macOS Swift apps via child processes

5 Upvotes

Hey all! I built a small library that lets you run risky Swift code in a separate process. If it crashes, your app keeps going.

You define a task as a struct, register it at startup, and call Airlock.run. Behind the scenes it re-launches your binary via posix_spawn and passes data through anonymous shared memory (no names leak to argv or the filesystem).

It's like XPC but without the signing, plists, and Mach port ceremony. Great for CLI tools, dev utilities, or anywhere you want quick crash containment.

macOS 12+, Swift 6.1+, 0BSD license. Still early (0.1.0) — comments are very welcome, whether it's API design ideas, edge cases, bug reports, or just your thoughts. Would really appreciate any feedback!

https://github.com/MaximKotliar/Airlock


r/macosprogramming • • Mar 27 '26

Is @Observable strictly for SwiftUI

5 Upvotes

If you have a non-GUI item that needs to monitor an @Observable object, can a second monitoring API also be used? And/or is there a way a non-SwiftUI object can hook into the @Observable system?


r/macosprogramming • • Mar 12 '26

GNUstep monthly meeting (audio/(video) call) on Saturday, 14th of March 2026 -- Reminder

5 Upvotes

The monthly GNUstep audio/(video) call takes place every second Saturday of a month at 16:00 GMT to 19:00 GMT. That is 12:00 AM - 3:00 PM EDT (US, note that the US already has Daylight Saving Time whereas Europe has not yet) or 17:00 to 20:00 CET (Berlin time).

It's a Jitsi Meeting - Channel: GNUstepOfficial (Sorry, reddit don't let me post jitsi links here)

We usually just talk (who wants it might share video too) and occasionally share screens. Everybody (GNUstep developers and users) is welcome!

Also see https://mediawiki.gnustep.org/index.php/Monthly_Meetings please


r/macosprogramming • • Mar 10 '26

Recommendations for macOS app polish

5 Upvotes

I’m a 17 year (omg has it really been that long??) veteran of iOS app development. At this point I’d say I’m pretty familiar with dotting the i’s and crossing the t’s for a professional and polished iOS app. I was fortunate to gain this experience by working with great people over the years.

But I’m looking for new experiences and I’ve recently been creating some small macOS apps. I’m really loving it. But I want to do it well. I’m looking for info on all those things that really “put the bow” on an app and make it feel polished. Unfortunately I don’t have coworkers to help share experiences on macOS dev.

Any info on resources or individual features that add that professional something to a macOS apps would be awesome! Thanks!


r/macosprogramming • • Feb 25 '26

Adding MCP to a macOS app

5 Upvotes

I’ve been integrating an MCP server into my macOS app so users can control parts of it from AI clients like Codex / Claude Code.The app is a file cleanup tool, so the MCP side handles things like:

  • resolving natural-language paths (“Downloads”, “Desktop”, etc.)

  • scanning for exact duplicate files

  • safely moving selected duplicates to Trash

The interesting part wasn’t implementing the tools. It was making the whole thing work as a macOS product feature.

What turned out to matter most:

  • local stdio process behavior (handshake, pipes, lifecycle)

  • launchers and stable binary paths

  • client configuration UX

  • debugging visibility in-app (self-test + probe + logs)

  • macOS sandbox and App Store distribution constraints

One big lesson:

“it works when I run the binary manually” is not the same as “it works in a real MCP client”

Had to debug failures across multiple layers:

  1. server binary health

  2. launcher health

  3. client config correctness

  4. client runtime behavior

I wrote up the full implementation journey and lessons learned (including the debugging approach and packaging decisions):

👉 Full article: Adding MCP to a macOS app
👉 Medium article (longer, less technical)

If you’re building macOS apps with local AI integrations/tool servers, I’d be interested in how you’re handling packaging, permissions, and supportability.


r/macosprogramming • • Feb 04 '26

How do I programmatically get the "Favorites" on Mac finder via the CLI?

Post image
5 Upvotes

I'm actually been searching for this for a while, but nothing came of use. I need a way to get the mac finder favorites list in test format that I can parse.

Any ideas?


r/macosprogramming • • Jan 11 '26

Just open-sourcing Clické. Faster, cleaner screenshots that you can edit.

Post image
5 Upvotes

r/macosprogramming • • Nov 13 '25

Why do apps use different directories for support files?

5 Upvotes

I've never done professional desktop development before and I don't quite understand why applications seem to use every possible dedicated folder:

  • ~/.*

  • Local Application Support

  • Global Application Support

  • etc.

It seems like developers place these files wherever they want—you'll find VS Code uses one location, Chrome uses another, and collectively they scatter files across 7+ different locations.


r/macosprogramming • • Oct 16 '25

How to make a mini toolbar

5 Upvotes

I see lots of small toolbars above views in Xcode and other Mac apps. I want to have something similar for my app, a toolbar that relates to a view rather than the window. I'd like each button to be able to produce a popup to configure its effect.

I can't figure out exactly what controls to use. Is it an SegmentedControl or something like that? I've made it with a StackView and a SegmentedControl in IB, but couldn't figure out how to add items to the SegmentedControl.

Plus, I'm not sure how to make it sit correctly above my view and take up the width. I've tried both constraints and resize masks, but they each produce odd side effects.


r/macosprogramming • • Sep 04 '25

How do I turn a Icon from Icon Composer to ICNS?

5 Upvotes

I can't for the life of me figure it out, please tell me if you know.


r/macosprogramming • • Aug 03 '25

Clarification on apps promotion posts

5 Upvotes

Edit: Updated on 25th January 2026.

Hello fellow macOS developers,

We wanted to clarify our policy around promoting macOS apps:

  • Open-source apps (if in App Store -> Free with no IAPs or subscriptions): You are welcome to share these. We appreciate contributions that benefit the community.

  • Everything else: Please note that promotion of these requires prior permission. We're happy to discuss it, but direct advertising without approval isn't allowed.

  • Non-macOS apps are not permitted.

A few important reminders:

  • Do not send DMs to advertise your app. This violates community guidelines and can result in a permanent ban.

  • We do not accept payment or compensation in exchange for promoting any app per rule 5 in Reddit's Terms of Services.


r/macosprogramming • • Jul 03 '25

"Squircle Jail" escape: How I fixed my broken macOS Tahoe Beta app icons

Thumbnail
youtube.com
5 Upvotes

Finally broke free from 'Squircle Jail' in macOS Tahoe Beta, and wanted to share the fix. I put together a video on how I used the new Icon Composer and Xcode to get my app icons working again.

Anyone else have success getting icons looking right?


r/macosprogramming • • Jun 13 '25

When I open icon-composer, it's all blank. Does anyone know how to solve this problem?

5 Upvotes
When I open icon-composer, it's all blank. Does anyone know how to solve this problem?

r/macosprogramming • • Jun 07 '25

Made a macOS app that automatically organizes your Dock based on usage - DockIt!

Thumbnail
gallery
5 Upvotes

I’ve always been annoyed by my messy Mac Dock, install a few apps, and suddenly you’re scrolling through 30+ icons trying to find what you need.

So I built DockIt to finally fix that, and figured some of you might dig it.

What it does:

  • Smart Auto-Ordering: Learns which apps you use most and reorders your Dock automatically. Most used apps go left, the rest shift right. No more hunting.

  • Custom Profiles: Set up different Dock layouts for different workflows, Work, Creative, Gaming, etc.

  • Folder Support: Add folders like Downloads or Documents to your profiles (just note: folders aren’t auto-sorted).

  • Manual Mode: Prefer full control? Set your Dock the way you want and it stays that way.

  • Usage Analytics: Still under development but you can take a look :P

It runs super light in the background, you’ll barely notice it’s there… until you realize your Dock just makes sense now.

If you want to take a look just go to https://dockit.space and download the app (7 days trial or $9.99 one time payment) but there is a special offer for you devs from r/macosprogramming just add MACOSDEVS10 and grant 10% off until Monday 9th!

Thank you guys for the support :)


r/macosprogramming • • Apr 16 '25

Which MBP model for new developer?

5 Upvotes

By day I'm a hybrid services and data engineer with a mix of Python, Java, SQL etc. But there's an old Mac OS app I use that has long since gone EOL that I want to have a crack at recreating myself as a personal project.

I can't use the work laptop, and my personal MBP is ancient. I'm wanting to by a new MBP but unsure which model to buy. Not too concerned about price so mostly don't want to buy inadequately specced machine. But equally don't want to overbuy...

The app in question is not that complicated, finance related with some limited data entry via forms/dialogs, list views, reports etc.

Wondering if I could get away with the M4 10 core 16GB memory, 512GB storage, or whether the Xcode/build/simulator experience on that is frustrating. Did I ought to nudge up on either memory or storage space? Comments/opinions/recommendations much appreciated.

UPDATE: Many thanks everyone for the feedback, it is much appreciated. Seems like, beyond skimping on memory and maybe disk size I can't really go wrong. Will pull the trigger soon!


r/macosprogramming • • Dec 08 '24

iTunes on Sequoia / Development of worthy replacement

5 Upvotes

I recently upgraded to a new Macbook thinking there will be the option of using Retroactive to help bring back my beloved iTunes library for my whole music collection. Unfortunately I had to learn that with the new Mac OS Sequoia, the Retroactive developer will no longer update the app. Because I bought extra internal storage to make my long-desired dream come true of having my whole music collection nicely arranged on my macbook, this hit me quite hard. I have looked at alternatives which unfortunately weren't too flattering including the Apple Music app.

From someone who doesn't know how to program, to all the Mac App developers, how hard would it be to copy the iTunes codes, add features and then make it work on Sequoia?


r/macosprogramming • • Aug 14 '24

Expanding App Options on macOS

Thumbnail
open.substack.com
5 Upvotes

Exploring SwiftUI on macOS is incredibly fun and exciting, especially if you're accustomed to developing for iOS or iPadOS. The Menu Bar offers a distinctive approach to macOS app development that sets it apart. Join Captain SwiftUI’s in his latest post where we’ll dive in together and discover how to enhance app options and functionality with SwiftUI!


r/macosprogramming • • Jun 10 '24

Creating my own mac app

5 Upvotes

Complete newbie here. I want to create my own note taking app. Something like a cross between evernote and notion. A place to dump thoughts and tasks and references.

I'm very fussy so no existing app really ticks all of the boxes for me whether it be because of price or privacy concerns.

I've done a bit of very basic coding in the past - COBOL (don't laugh), C++ and er, well, that's it :-) But I like learning.

How realistic is it to build my own app to run on my own mac? Perhaps sync it between all of my macs? Perhaps even have an ios version so I can have it on my phone? I'm ok with learning new skills and I'm not looking to create something commercially viable. It's just for my own needs.

Am I dreaming? If not, what would be the best language / platform to learn? Swift? OR something else?

Thanks in advance for any helps, tips, comments.


r/macosprogramming • • May 04 '24

How do I change the background of the highlighted area (titleBar?) in SwiftUI.

Post image
5 Upvotes

r/macosprogramming • • Mar 30 '24

Source code for a replacement for Stickies

5 Upvotes

I was annoyed that Apple’s Stickies did not support dark mode, and that I couldn't use AppleScript to move stickies where on the display I wanted them.

It also annoys me when document-based apps don't support right-clicking in the title bar to see the file system path, or dragging the proxy icon to move a file, or when dragging to a Terminal window, display the file’s path. So I fixed that, too.

It's also hard to find source code examples of non-standard windows for macOS.

So I wrote a replacement for Stickies, source code posted on github, Stickery and, since many programmers no longer like Objective-C, I did the app again, in Swift: Swickery