macOS - James Montemagno https://montemagno.com/tag/macos/ https://montemagno.com/content/images/2017/08/MonogramIcon_Orange_NoBuffer.png macOS - James Montemagno https://montemagno.com/tag/macos/ Hugo -- gohugo.io Thu, 26 Nov 2026 09:25:08 GMT 60 Fixing “No agents connected” in the .NET MAUI DevFlow Inspector https://montemagno.com/troubleshooting-dotnet-maui-devflow-no-agents-connected/ https://montemagno.com/troubleshooting-dotnet-maui-devflow-no-agents-connected/ Tue, 24 Nov 2026 17:13:34 GMT

DevFlow is a set of developer tools for connecting to and inspecting a running .NET MAUI app through the CLI and browser-based Inspector. I love it because it gives agents a way to run, navigate, interact with, and validate the app while it is running, making it much easier to debug and understand what is happening on an emulator or device.

I hit a really confusing one with the .NET MAUI DevFlow Inspector: the page says No agents connected, but maui devflow agent status happily talks to my app. Both can't be true, right? Turns out they can, because they are two different connections. Here is the quick fix, then why it works.

On my Mac (zsh, Android emulator, .NET 10 MAUI app), restarting the broker with IPv6 disabled brought everything back:

maui devflow broker stop
DOTNET_SYSTEM_NET_DISABLEIPV6=1 maui devflow broker start --foreground

Leave that terminal open, and in another one run:

maui devflow wait --timeout 30
maui devflow list

The app showed up right away, and I didn't even have to restart it. Keep in mind this is a workaround that worked for me, not an official fix. I filed it as dotnet/maui-labs#851, and I haven't confirmed that every Mac hits it.

The agent is fine, the broker never heard about it

DevFlow has two pieces that are easy to blur together:

  • The agent lives inside your app and runs its own HTTP server.
  • The broker is a small background daemon that keeps a registry of running agents so the CLI and Inspector can find them.

The DevFlow docs and broker docs cover the architecture. The part that matters here is that the CLI can talk to an agent directly, without the broker, if you tell it where to look:

maui devflow agent status --agent-host localhost --agent-port 9223

That worked for me, but it only proves the CLI can reach the agent. It says nothing about whether the app registered with the broker. Meanwhile maui devflow list returned [], which means the registry was empty.

One note on ports: 9223 was my agent's port (it comes from the .mauidevflow file in my project). The broker normally hands out ports from a pool, so yours can be different. Use the port your agent is actually on.

Check your Android tunnels, but don't stop there

An Android emulator lives on its own network, so two tunnels are involved, and they go in opposite directions:

adb -s emulator-5554 reverse tcp:19223 tcp:19223   # app -> broker on your Mac
adb -s emulator-5554 forward tcp:9223 tcp:9223     # CLI on your Mac -> agent in the app

The Android setup page shows adb reverse for both ports. forward for the agent is what worked for me. The one mistake to avoid is mapping the broker port the wrong way, because that can block the broker from starting.

I set both tunnels up, restarted the app, and recreated the tunnels. Still []. ADB wasn't the problem, so it was time to poke at the broker itself.

The curl trick

The broker listens on port 19223. I asked it for its agent list three different ways:

curl -4 -H 'Host: localhost:19223' http://127.0.0.1:19223/api/agents
curl -6 -H 'Host: localhost:19223' 'http://[::1]:19223/api/agents'
curl -4 http://127.0.0.1:19223/api/agents
Connection Host header Result
IPv4 localhost:19223 404
IPv6 localhost:19223 200
IPv4 127.0.0.1:19223 200

Same broker, same request, different answer depending on the address family and the Host header. My read (and it is only a read, I haven't pinned down the root cause) is that the agent registers through localhost:19223, so a broker that answers that with a 404 never learns the app exists.

Starting the broker with the official .NET DOTNET_SYSTEM_NET_DISABLEIPV6 switch made the IPv4 localhost request work, and the app registered on its own.

Make it stick

Typing the variable every time gets old fast. Instead of turning IPv6 off for every .NET app, I scope it to the maui command.

zsh

Add this to ~/.zshrc:

maui() {
    DOTNET_SYSTEM_NET_DISABLEIPV6=1 command maui "$@"
}

Run source ~/.zshrc or open a new terminal, then run maui devflow broker stop once. The next broker that maui starts should pick up the variable. This does not start the broker, emulator, or app for you.

PowerShell

Same idea in a PowerShell profile (New-Item -ItemType File -Force -Path $PROFILE then code $PROFILE):

function maui {
    $env:DOTNET_SYSTEM_NET_DISABLEIPV6 = "1"
    try { & (Get-Command maui -CommandType Application).Source @args }
    finally { Remove-Item Env:DOTNET_SYSTEM_NET_DISABLEIPV6 -ErrorAction SilentlyContinue }
}

Reload with . $PROFILE. I only tried this in PowerShell 7 on my Mac, and I haven't seen this problem on Windows, so don't assume you need it there.

Startup checklist

  1. The app calls AddMauiDevFlowAgent() in a Debug build.
  2. The emulator is running (adb devices shows it, for example emulator-5554).
  3. adb reverse tcp:19223 tcp:19223 is set for the broker.
  4. adb forward tcp:<your agent port> tcp:<your agent port> is set (mine was 9223).
  5. The broker is running, with IPv6 disabled if you are hitting this.
  6. Run maui devflow wait --timeout 30, then maui devflow list.
  7. Still stuck? Try maui devflow diagnose --device emulator-5554.

There you go! If you are seeing the same thing, add your details to dotnet/maui-labs#851. The more repros the better.

]]>
Introducing Clipboard Next for Mac and Windows https://montemagno.com/introducing-clipboard-next-mac-windows/ https://montemagno.com/introducing-clipboard-next-mac-windows/ Fri, 13 Nov 2026 18:30:00 GMT

When we demo, we're often trying to remember every command we need to enter. For Ignite, we have a series of .NET MAUI DevFlow commands to run, and remembering all of them just isn't going to happen! Sometimes you don't need to memorize anything. You just want the next item ready on your clipboard.

That is why I built Clipboard Next, a small, free, open-source app for Mac and Windows that lines up your commands, code snippets, and prompts so you can keep moving through your demo.

Here is a quick look at the idea:

A short, silent animation illustrating the command queue, terminal, and progress badge. You can also see the live animated demo on the Clipboard Next website.

Queue it up, then just paste

Add your snippets in the order you want to present, enable paste detection, and press Start. The first item lands on your clipboard. Paste with Command-V on Mac or Ctrl+V on Windows, and Clipboard Next copies the next item after a configurable delay. No trip back to your notes between commands.

Already have a Markdown demo script? Import it! Preview the code blocks, split them into individual lines or keep multiline blocks together, and optionally include blockquoted prompts.

A few little details make this useful beyond a straight list of commands:

  • Keep your place: an optional floating progress badge stays visible without taking keyboard focus.
  • Go off script: pause, resume, go back, skip ahead, or start from a selected snippet.
  • Copy something else: the queue pauses rather than overwriting the different text you just copied.
  • Keep it local: no account, telemetry, or cloud sync. Your queue stays on your device.
Clipboard Next on Windows with the third of seven snippets selected, pause and navigation controls, and a floating 3/7 progress badge.
The Windows queue and floating badge keep track of your place while presenting.

One thing to know: detection observes the paste shortcut, not whether the destination successfully pasted. Test your terminal or editor before presenting. The app doesn't run commands or press Enter, but multiline text can still execute when pasted into some terminals, so review your snippets.

Get Clipboard Next

On Mac, install with Homebrew or grab the signed, notarized app from GitHub Releases. You'll need macOS 14 or later and Input Monitoring permission for automatic advancement.

The Windows app targets Windows 11, with distribution through the Microsoft Store. Check the download page for release availability.

A little bit under the hood

The Mac version was pretty straightforward: Swift and SwiftUI for a native menu bar app, then Homebrew for installation. The Windows version is a native C#/.NET 10 app built with WinUI 3 and system tray controls. The queue logic was ported rather than shared, but both versions use a compatible queue-file format. If you're curious about how it works, check out the source on GitHub!

]]>
Restore SwiftUI Menu Icons on macOS 27 with One Line https://montemagno.com/restoring-tiny-clips-menu-icons-macos-27/ https://montemagno.com/restoring-tiny-clips-menu-icons-macos-27/ Sun, 08 Nov 2026 16:00:49 GMT

Tiny Clips had a nice little dropdown full of icons on macOS 26. On macOS 27, most of those icons disappeared from its SwiftUI MenuBarExtra menu. The labels were still there, but the menu looked quite different.

If your app uses symbol images in SwiftUI menus, you might be seeing the same thing. Before you start replacing your SF Symbols or building an AppKit bridge, check the menu's label style!

Tiny Clips menu on macOS 27 with text-only Screenshot, Copy Text from Region, Record Video, Studio Recording, and Record GIF items.
Before: menu items without visible icons.

Where did the icons go?

This is an intentional default change, not necessarily a missing image or a broken Label.

In the macOS 27 release notes, SwiftUI entry 170480710 explains that menu bar menus and macOS context menus now show a reduced set of images:

  • Symbol images are hidden by default in most contexts.
  • Non-symbol images remain visible, according to the SwiftUI entry.
  • Common system items such as Settings, Share, and Print still get default visible images.

That last detail explains why a menu can look inconsistent: some icons survive even when most of your app's symbols disappear.

Apple recommends reviewing which items actually benefit from images, particularly items representing an object or concept rather than an action. You don't have to opt every menu back in. However, when you do want to preserve an existing icon-driven menu, SwiftUI already has the modifier you need.

The one-line SwiftUI fix

Use .labelStyle(.titleAndIcon) on the content inside MenuBarExtra.

The Tiny Clips implementation PR adds the modifier in mac/TinyClips/TinyClipsApp.swift. The existing content view becomes:

MenuBarContentView(captureManager: captureManager, sparkleController: sparkleController)
    .labelStyle(.titleAndIcon)

That is the whole code change: one added modifier!

Applying the style to the content view sets it for the labels within that hierarchy, rather than changing label styling across the entire app. In Tiny Clips, that scope includes submenu labels and recent-capture labels with thumbnails or symbol fallbacks. It doesn't create images for text-only items.

There is no AppKit bridge, private API, new dependency, or macOS version branch. The existing actions, keyboard shortcuts, and platform guards stay unchanged.

Tiny Clips menu on macOS 27 with camera, text-recognition, video, layers, and image icons beside the capture options, plus icons for folders, recent captures, library, and settings.
After: icons visible alongside the menu labels.

There are the icons!

Does this raise the minimum macOS version?

No, not for Tiny Clips. labelStyle(_:) is available from macOS 11.0, and .titleAndIcon is available from macOS 11.3. Tiny Clips already supports macOS 15.0 and newer, so this change doesn't need an availability check.

Using AppKit instead?

If you create NSMenuItem instances directly, AppKit has a separate preferredImageVisibility property on macOS 27 and newer:

if #available(macOS 27.0, *) {
    menuItem.preferredImageVisibility = .visible
}

Here, menuItem is your existing NSMenuItem. This is the AppKit option, not an extra step for SwiftUI. AppKit's release notes also describe SDK-linkage-dependent image visibility; don't apply those rules to SwiftUI's separate release-note entry.

For a SwiftUI MenuBarExtra like Tiny Clips, start with the supported label-style modifier. A small, scoped change beats replacing your menu just to ask for its icons back.

Happy coding.

]]>
Introducing Tiny Clips Studio: Screen Recordings You Can Keep Editing https://montemagno.com/introducing-tiny-clips-studio/ https://montemagno.com/introducing-tiny-clips-studio/ Tue, 03 Nov 2026 22:00:00 GMT

You finish recording a demo, play it back, and notice that your camera bubble is sitting right on top of the button you were explaining. Or the recording looks good, but you want to zoom in on one little detail and switch to a different layout halfway through.

Trimming the beginning and end isn't going to fix that!

Today, I'm introducing Tiny Clips Studio (Preview) for macOS and Windows. It adds an editable recording workflow to Tiny Clips, the little menu bar and system tray app for screenshots, videos, and GIFs.

The idea is pretty straightforward: record now, choose the look afterward. Keep your screen and camera separate, arrange them in Studio, and create the final MP4 when you're ready to share. Want a different look later? Reopen the project and change it.

Here is a quick look at Studio in action:

A 45-second overview with music and no narration, showing editable screen and camera layers, layouts, zooms, cuts, and export. It combines real editor controls with illustrative compositions; preview capabilities vary by platform.

Download Tiny Clips for macOS and Windows, then enable Settings > Studio > Tiny Clips Studio (Preview).

Let's take a look at what had to change in the recording pipeline, how two native apps agree on a project, and some of the decisions that went into building the editor.

From a recording to a project

The biggest change in Studio happens before you ever touch an editing control.

An ordinary Tiny Clips recording produces a finished video. On Windows, the camera and overlays are drawn into the frames while recording. On macOS, the screen and camera are captured separately, but the normal workflow combines them after recording. Either way, by the time you start trimming, you're working with one flattened picture.

Studio takes a different path. A Studio recording keeps:

  • The screen recording, without the camera composited on top.
  • A separate camera recording, when you include your webcam.
  • Cursor and click timing data, for features such as zoom suggestions.
  • Project settings, describing the layout, styling, and edits.

Instead of immediately combining everything, Studio opens those pieces in an editor. The final composition is rendered when you export.

That is what makes moving the camera after recording possible. It isn't trying to erase a camera bubble from an existing video. The screen underneath was kept in the first place.

Screen recording, optional camera recording, and click and cursor data feed an editable Studio project. Layouts, scenes, zooms, and cuts are applied before exporting an MP4, while the project remains editable.
The Studio workflow: keep the ingredients separate, edit the project, and render the video when you're ready to share.

One important distinction: Studio needs those original pieces. It doesn't magically separate the webcam from an older, flattened MP4.

Give the recording a look, then tell the story

You can start with a screen-only layout, add a camera bubble, put the screen and camera side by side, or switch to camera only. Change the background, padding, and rounded corners, then adjust the camera's size, position, and shape.

The real Windows Studio editor in light mode, with the screen preview and camera bubble on the left, Scene layout choices on the right, and editing lanes below. Color bars and frame numbers are synthetic test footage.
The real Windows Studio Preview editor, captured in an isolated test host. The color bars and frame markers are synthetic clips used to check composition and timing, not a UI mockup.

For a quick demo, that might be all you need: record, frame it nicely, trim, and export. No need to turn every clip into a production.

But the layout doesn't have to stay the same for the entire video. Scenes let different parts of a recording use different arrangements. For example, you could open with the camera, switch to the screen with a small camera bubble for the walkthrough, and finish side by side. Transitions can be instant or animated.

There are also timeline tools for zooms, cuts, and speed changes. Zoom in on the setting you're explaining, cut out a pause, or speed through a repetitive step. Zooms can focus on a fixed point or follow the pointer when that recording includes pointer data. Click-based suggestions give you a starting point that you can adjust rather than committing you to an automatic edit.

A cropped Windows Studio timeline in dark mode. Separate lanes show three scenes, two zooms, two cuts, faster and slower speed segments, and trim handles.
A closer look at the actual timeline: scene layouts, zooms, cuts, and speed changes each have their own lane. Cropped from the test project's editor window.

This is still a preview, and the two platforms aren't identical in every detail. Audio controls, camera background effects, and playback behavior have platform-specific limitations. The Studio development pull request tracks the implementation and known issues; the shared project design isn't a promise that every preview control behaves identically on both systems.

One design, two native implementations

For the developers out there, this is where the project gets interesting.

Studio wasn't built by putting the same web editor inside both apps. The Mac implementation uses Swift and SwiftUI, with AVFoundation and Core Image handling composition and rendering. Windows uses C# and WinUI 3, with Direct3D/Direct2D rendering and Media Foundation for video processing.

Different stacks, but they need to agree on what a project means.

A shared project format, layout math, and golden test fixtures guide two native implementations. macOS uses Swift, SwiftUI, AVFoundation, and Core Image. Windows uses C#, WinUI 3, Direct3D, Direct2D, and Media Foundation. Both provide preview and MP4 export.
Architecture at a glance. The shared layer is a specification and test data, not a common UI runtime; preview capabilities still vary by platform.

The foundation is a shared project format and rendering specification. Layout positions use normalized coordinates rather than assuming a particular recording resolution. Edits refer to the source recording's timeline, and a time map handles the relationship between that timeline and the exported video after cuts and speed changes.

Why does that matter? Cutting out five seconds shouldn't require rewriting every zoom and scene that comes after it.

The layout resolver takes a project, a time, and a canvas size, then calculates what belongs in that frame. There is a Swift implementation and a C# implementation, checked against the same shared fixtures. The time mapping and zoom-suggestion logic use shared fixtures too.

That gives both implementations concrete examples to agree on, rather than relying on two screenshots that look roughly similar. It doesn't guarantee interchangeable projects or pixel-identical exports, but it makes the common rules testable.

Some of the most useful changes weren't rendering features

The development history starts in early October and includes plenty of work on renderers, exporters, and timelines. It also records the smaller decisions that shape what using Studio actually feels like.

For example, an early version had an "After recording" setting and a separate "Record for Studio" choice. That became one explicit entry point: Studio Recording... on the Mac and a Studio tile on Windows. Ordinary Video stays ordinary Video.

The inspector changed too. Instead of putting eleven sections in one long scroll, Studio uses a rail that opens one panel at a time: Scene, Background, Screen, Camera, Zoom, Cut, Speed, Audio, and Project. Selecting a zoom on the timeline brings up its controls. Dragging the camera opens the Camera panel.

The Windows Studio Camera inspector, with size, corner position, horizontal and vertical offset sliders, and a Circle shape selection. The adjacent rail switches between Scene, Background, Screen, Camera, Zoom, Cut, Speed, Audio, and Project.
The Camera panel and inspector rail, cropped from the running Windows editor. One set of controls at a time, instead of one long list.

Those aren't flashy export features, but they save you from hunting through a wall of sliders.

Testing also had to go beyond compilation. One Windows inspector issue survived builds and unit tests because the problem only appeared when the actual window was constructed: a referenced UI style didn't exist. Opening and exercising the real window caught what the model tests couldn't.

The work includes shared data tests, rendered-frame checks, export checks, and Windows UI Automation. A build passing and an editor being usable are different questions, and the development notes deliberately distinguish what was compiled, what was checked automatically, and what someone actually tried.

Keep the project, not just the MP4

An export is the video you share. The project is what lets you come back and make another version.

Studio manages projects inside the app, but you can also save a project as a folder containing its recordings and a .tinyclips project file. Opening that file imports a copy as a new draft, leaving the saved folder alone.

A Studio project can produce a flattened MP4 for sharing or a saved folder containing a .tinyclips file and separate recordings for future editing. Save the folder outside app-managed storage. Pinning a project prevents automatic cleanup but is not a backup.
Two different things to keep: the MP4 you share and the project folder you can edit again. Pinning a managed project is not the same as saving an independent copy.

There is an important storage trade-off here: keeping editable recordings takes more space than keeping only the finished MP4.

By default, exported projects are eligible for cleanup after 30 days without use, with a 10 GB limit for cleanup-eligible projects. Drafts and projects marked Keep this project are protected from automatic cleanup. Those settings are adjustable.

Keep this project protects against Studio's cleanup; it isn't a backup. In particular, Windows stores its managed projects in the app's data folder, which can be removed when you uninstall or reset the app. Save a project folder somewhere you keep your work if you want to retain it independently of the installation.

And once Studio has cleaned up the source files, the exported MP4 still plays, but those separate editable layers are gone.

Try Studio Preview

Studio Preview is included in the new store releases for macOS and Windows. There is no separate Pro gate for Studio, and it is off by default.

To get started:

  1. Update Tiny Clips. You can find the downloads and store links at tinyclips.app.
  2. Open Settings > Studio.
  3. Turn on Tiny Clips Studio (Preview).
  4. On macOS, choose Studio Recording... from the menu bar menu. On Windows, choose the Studio tile in the tray menu.
  5. Record a short demo, arrange it in Studio, and export an MP4.

If you just want your usual recording workflow, keep using Video. Turning Studio on doesn't turn every video recording into a Studio project, and leaving it off keeps the ordinary workflow unchanged.

Explore the design and source

Want to dig into how it works? Here are a few useful places to start. The implementation links below point to the revision used for this write-up, while the pull request tracks ongoing preview work.

The diagrams are available as editable Excalidraw files too: recording workflow, native architecture, and projects versus exports.

Give Studio a try with a short recording, move the camera somewhere else after you've finished, and export a second version. That is the idea in one little experiment.

If something doesn't work as expected, or you have an idea that would make recording demos better, open an issue in the Tiny Clips repository. I'd love to hear what you create with it.

]]>
Long-running Operations on macOS and iOS with NSProcessInfo https://montemagno.com/long-running-processes-ios-macos-nsprocessinfo/ 6117d5c0ba5764003b25bff5 Sat, 14 Aug 2021 15:04:35 GMT

One issue that sometimes comes up in app development is keeping your app alive and running during long running processes. In my case with My Stream Timer, when the user starts a timer, it needs to keep running no matter what. My first solution was to simply turn on Screen Saver mode.

var appDelegate = ((AppDelegate)NSApplication.SharedApplication.Delegate);

appDelegate.MainWindow.Level = NSWindowLevel.ScreenSaver;

This solution "works" but has the side effect that the app will always be on top all the time, no matter what.  As you could imagine this is not an ideal solution. Then out of nowhere Frank told me about starting and stopping Activities with NSProcessInfo. We then did a full podcast on it:

I of course ignored his advice until this morning when I wrote 40 lines of code that solved all of my problems.

What are Activities?

According to Apple:

"The system has heuristics to improve battery life, performance, and responsiveness of applications for the benefit of the user. You can use the following methods to manage activities that give hints to the system that your application has special requirements."

What this means when you Begin or Perform and Activity is that:

"the system disables some or all of the heuristics so your application can finish quickly while still providing responsive behavior if the user needs it."

This is pretty awesome! There are also two distinct categories of activities based on what you app is looking to do.

  • User-initiated activities are explicitly started by the user. Examples include exporting or downloading a user-specified file.
  • Background activities perform the normal operations of your application and aren’t explicitly started by the user. Examples include autosaving, indexing, and automatic downloading of files.

In my case I have a "User-initiated" activity where I want to keep the screen on, app alive, and the processor going. There are several different types of NSActivityOptions that you have fine grain control over to specify this:

In my case this is a NSActivityUserIntitated, which includes NSActivityIdleSystemSleepDisabled, but I also want NSActivityIdleDisplaySleepDisabled. I also have multiple activities running at the same time, so I created a small manager to handle this.

Start Activity

Dictionary<string, NSObject> Activities { get; } = new Dictionary<string, NSObject>();

public void StartActivity(string id)
{
    if (Activities.ContainsKey(id))
    return;

	try
	{
		var options = NSActivityOptions.UserInitiated | NSActivityOptions.IdleDisplaySleepDisabled;

		var activity = NSProcessInfo.ProcessInfo.BeginActivity(options, "User has inititiated a timer that is a long running process.");

	Activities.Add(id, activity);
	}
	catch (Exception ex)
	{
		Debug.WriteLine($"Unable to start activity: {ex}");
    }
}

Now, when the user starts a timer, I kick off an activity and I am good to go.

End Activity

Now, I need to stop it when the timer ends or the users stops or pauses the timer.

public void StopActivity(string id)
{
    if (!Activities.ContainsKey(id))
        return;
    try
    {
        var activity = Activities[id];
        NSProcessInfo.ProcessInfo.EndActivity(activity);
        Activities.Remove(id);
    }
    catch (Exception ex)
    {
        Debug.WriteLine($"Unable to start activity: {ex}");
    }
}

That is it! Easy peasy, and now the system will keep My Stream Timer will continue running without having to stay on top.

My Stream Timer counting down beside OBS, whose text source shows the same Starting in 13:14:16 countdown

]]>