/r/macosprogramming
Subreddit for macOS developers!
/r/macosprogramming
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?
I have spent hours looking through various .cat files in System/Library/Private Frameworks, and inside the application bundles for messages – but for the life of me I cannot find the new colored tapback elements. I believe that before they were in color they were part of a CoreUI cat that had a bunch of SFSymbols in it. But now that they are more like emojis they dont seem to be in the Symbols stuff. Also they arent part of the Emoji font set. So I am stumped?
To enable access to a MySQL server I need to go to Settings .. Privacy & Security .. Local Network and turn off and on again switch for my app after each Mac restart.
So, I don't understand this at all.
It used to work on my M1 Sequoia and a colleagues M1 Max Sequoia, but today I brought an i7 Sequoia and I get Access Denied error.
Then I installed Sequel Pro and Sequel Ace. They had the same problem with access denied on that MySQL server but the dialog appears if the user allows access to other computers on the network so the next time these apps were able to access that MySQL server.
My app is not signed, but I spend some time in Settings / Privacy & Security adding my app to Accessibility and then I was asked for my app if I allow it to access other computers on the network. So this enabled access to the database but only till the next Mac restart.
After the restart, I need to go back to Settings - Local Network and disable / enable my app there (Allow the applications below to find and communicate with devices on local network).
Any idea if I should finally go with the signing or if this is some problem with this version of Sequoia, or maybe I should add a key to my info.plist or...?
Or wait till the next update?
In short, my app on one Sequoia has problem accessing only MySQL on my old Black MacBook 2007 under Snow Leopard that we use for testing and experiments before we move to the real server running linux. And the same app on that Mac can access MySQL on linux server. And the same app works fine on two other Sequoias. But I am worried I might have problem at other places with users on Sequoia or whatever comes next.
Ah, and as I first used Sequel Pro and Sequel Ace to connect to the linux server that dialog about network access did not appear. It appeared for each app when I accessed that MacBook server only.
edit - at home, when I tried to access a database on my Synology NAS I was asked for network permission on my M1 Sequoia. But on the i7 Sequoia it was the same as it was with the old MacBook server in the office, off and on in the Settings to make it work with Synology.
No problems on Sonoma, Ventura & Monterey.
I am developing a macOS app that requires the ability to create new files in the same directory as a user-selected file, but I am encountering permission issues due to the App Sandbox restrictions. While the user can select a file (e.g., a.jpg) using a standard open panel, I cannot create an adjacent file (e.g., a.jxl) in the same folder because the sandbox only grants access to the selected file, not to other files in the directory.
I understand that full disk access might be an option, but it requires user intervention and isn't suitable for this case. Is there any way to extend access to other files in the directory (including those not selected by the user) while remaining within the App Sandbox environment?
Hello there. Since I last wrote here about ProcessSpy it got many new features. It is now possible to find a process by clicking anywhere on the screen, define your own javascript filters, running shortcusts when process starts or finishes, and more. Feel free to grab your copy here: https://process-spy.app
Do developers have to follow Apple’s writing style guide, avoiding terms from master to monitor?
Can developers make erotic games for Mac? How about really brutal shoot em up or knife games? Or literally anything that the first amendment and a government that more or less tells prudes to pound sand half the time would allow?
Could said people still sign their app otherwise so it can load on MacOS 15.1 which can’t run OpenSCAD?
import numpy as np
import mss
import time
from ultralytics import YOLO
import tkinter as tk
import Quartz
import AppKit
from PIL import Image, ImageTk
# Load the YOLO model
model = YOLO("yolo11n.pt")
# Screen capture configuration
sct = mss.mss()
monitor = sct.monitors[1] # Capture primary screen
# Set desired FPS
fps = 30
frame_time = 1 / fps
class TransparentWindow:
def __init__(self):
self.root = tk.Tk()
self.root.overrideredirect(True) # Remove window borders
self.root.attributes('-topmost', True) # Keep the window on top
self.root.attributes('-alpha', 0.2) # Completely transparent
self.root.geometry(f"{monitor['width']}x{monitor['height']}+0+0")
# Set the window to be click-through
self.set_click_through()
# Create a canvas for drawing
self.canvas = tk.Canvas(self.root, width=monitor['width'], height=monitor['height'], bg='white', highlightthickness=0)
self.canvas.pack()
# Launch the window
self.root.after(100, self.update)
self.root.mainloop()
def set_click_through(self):
# Access the window's NSWindow instance to set it to ignore mouse events
ns_window = AppKit.NSApp.windows()[0]
ns_window.setIgnoresMouseEvents_(True) # Make it ignore mouse events
def update(self):
# Capture the screen
screen = np.array(sct.grab(monitor))
screen_rgb = screen[..., :3] # Drop the alpha channel
# YOLO Inference
results = model(screen_rgb)
boxes = results[0].boxes.data.cpu().numpy()
# Clear previous drawings
self.canvas.delete("all")
# Draw bounding boxes on the canvas
for box in boxes:
x1, y1, x2, y2, score, class_id = map(int, box[:6])
self.canvas.create_rectangle(x1, y1, x2, y2, outline='green', width=2)
# Schedule the next update
self.root.after(int(frame_time * 1000), self.update)
# Create and launch the transparent window
overlay = TransparentWindow()import numpy as np
import mss
import time
from ultralytics import YOLO
import tkinter as tk
import Quartz
import AppKit
from PIL import Image, ImageTk
# Load the YOLO model
model = YOLO("yolo11n.pt")
# Screen capture configuration
sct = mss.mss()
monitor = sct.monitors[1] # Capture primary screen
# Set desired FPS
fps = 30
frame_time = 1 / fps
class TransparentWindow:
def __init__(self):
self.root = tk.Tk()
self.root.overrideredirect(True) # Remove window borders
self.root.attributes('-topmost', True) # Keep the window on top
self.root.attributes('-alpha', 0.2) # Completely transparent
self.root.geometry(f"{monitor['width']}x{monitor['height']}+0+0")
# Set the window to be click-through
self.set_click_through()
# Create a canvas for drawing
self.canvas = tk.Canvas(self.root, width=monitor['width'], height=monitor['height'], bg='white', highlightthickness=0)
self.canvas.pack()
# Launch the window
self.root.after(100, self.update)
self.root.mainloop()
def set_click_through(self):
# Access the window's NSWindow instance to set it to ignore mouse events
ns_window = AppKit.NSApp.windows()[0]
ns_window.setIgnoresMouseEvents_(True) # Make it ignore mouse events
def update(self):
# Capture the screen
screen = np.array(sct.grab(monitor))
screen_rgb = screen[..., :3] # Drop the alpha channel
# YOLO Inference
results = model(screen_rgb)
boxes = results[0].boxes.data.cpu().numpy()
# Clear previous drawings
self.canvas.delete("all")
# Draw bounding boxes on the canvas
for box in boxes:
x1, y1, x2, y2, score, class_id = map(int, box[:6])
self.canvas.create_rectangle(x1, y1, x2, y2, outline='green', width=2)
# Schedule the next update
self.root.after(int(frame_time * 1000), self.update)
# Create and launch the transparent window
overlay = TransparentWindow()
Working on a project to identify objects on screen, and put boxes around them. Using an overlay. Here is my code... The window is clickthrough right now and everything, however i cant find a way to make it fully transparent.
Not sure if there's a way to do this, but I bounce between spaces frequently, and the latency while switching is annoying. Can I assign a hotkey to each space to facilitate faster switching?
Where, and how, exactly is my reminders data stored? I'm trying to rig up an interface between Emacs Org Mode and Reminders (and eventually Notes and Calendar). I thought there'd by a reminders.db file somewhere or something, but just the file hierarchy is pretty confusing.
I work on a macOS application that functions as a daemon. To test it, I:
Compile executables.
Use pkgbuild
and productbuild
to build an application bundle.
Use codesign
and notarytool
to sign and notarize the app.
Install the app with /usr/sbin/installer -target LocalSystem -pkg ...
. This often overwrites the previous version of the app.
Sometimes, the installation fails at the postinstall
stage, when it can not find the application's install directory. We explicitly check for this error in our script:
if ! [ -d "$APP_INSTALL_DIR"/Contents ]; then
echo "directory ${APP_INSTALL_DIR}/Contents is missing"
exit 1
fi
This is unexpected!
Even worse, some of our customers have occasionally seen the same issue!
We use a postinstall script in order to install files into the /Library/LaunchDaemons
and /Library/LaunchAgents
directories, and start the agent with launchctl bootstrap
.
Our preinstall
script makes sure that the previous version of our application is fully uninstalled (so there is no confusion), and we wonder if that is part of the problem.
While researching this error, I ran across a discussion of a similar issue on Stackoverflow: <https:// stackoverflow.com/questions/19283889>. One of the commenters there wrote:
It appears that the OS X installer uses information about already installed packages and application bundles in order to decide where and if to install new packages. As a result, sometimes my installer did not install any files whatsoever, and sometimes it just overwrote the .app bundle in my build tree. Not necessarily the one used to build the installer, but any .app bundle that OS X had found. In order to get the installer to install the files properly I had to do two things:
Tell OS X to forget about the installed package.
sudo pkgutil --forget <package id>
Not sure if this is needed for you nor in my case, but it is probably a good idea anyway.Delete all existing .app bundles for the app. If I didn't do this, the existing app bundle was overwritten on install instead of the app being placed in /Applications. Maybe there is a way to prevent this while building the installer package, but I haven't found it.
On the other hand, the man page for pkgutil
says not to use --forget
from an installer:
Discard all receipt data about package-id, but do not touch the installed files. DO NOT use this command from an installer package script to fix broken package design.
What is the correct approach to fix this problem?
((I submitted this question on the Apple forums, but got no response: https://developer.apple.com/forums/thread/759046.))
What's the current recommendation for macOS (and iOS) crash reporting services nowadays? We used to pay HockeyApp for this, then it got bought by Microsoft, and now its scheduled for shutdown soon. Where should we move?
Does anyone know if there are any libraries that provide access to the email app data!
I’m excited to share a project I’ve been working on called osxiec (osx isolated environment creator). While it’s not a full container solution, osxiec provides a way to isolate processes from the main system on macOS.
Here are some key features:
Unlike existing solutions like "darwin containers," osxiec doesn’t require System Integrity Protection (SIP) to be disabled. It's designed to be an easy-to-use tool for testing code, isolating applications, and integrating with your development workflows on macOS.
I’d love to get feedback from the community. Any suggestions or concerns are welcome!
Hello, we are working on building a software to record audio and screens but have run into an issue. Everytime we record the screen, audio stops getting recorded. In contrast, it works perfectly in Windows. Does anyone have any suggestion on what could be the issue here?
It must be a dumb question to most people here - sorry about it! I've been using macOS since 3 years ago very lightly and now I'm trying to use mac more actively thinking maybe it could become my main working machine replacing Windows.
Just yesterday I started coding Swift on Xcode to create something useful for myself as I usually do it with AutoHotKey on Windows. And it seems I need to enroll in the Apple Development Program. Is it correct even if it's only for myself and not for distributing? Then all the macOS programs that you can download on the Internet were made with Apple Development Program accounts? Even cracks?
At least there is a debug app from the Swift project in like ~/Library/Developer/Xcode/DerivedData/GlobalHotkeys3-bdyffbtmfedmnmbhtthegawzlhbw/Build/Products/Debug/GlobalHotkeys3.app
So I'm using it for now. Any tips please!
We've noticed on an M1 Max laptop, the app (which should use as many cores as possible) is being confined solely to the two efficiency cores, no matter how much load we throw at it. What could be causing this? The computer is plugged in and set to "high power" mode in the system settings, energy pane.
Other than marking DispatchQueue priority as .userInitiated or similar, is there anything else (like a system entitlement?) to ensure that the whole CPU is maximized?
Thanks.
I developed a macos application with Flutter and created a deployable file with a developer ID certificate and Xcode. I compressed it into a dmg and passed it through internal tests. When I did this, I got something like the title. Even after shutting down and running it again, I never get the black screen again.
Interestingly, uninstalling and reinstalling the app also doesn't cause the black screen. So I wanted to see if there was an issue with authenticating the apple account, so I brought my personal macbook, which uses the same apple account as my work macbook, and experimented with it, and again, after the first install, I only got the black screen.
It doesn't seem to be a code signing or notarisation issue. Because if I get the black screen in the first place and shut it down, there is no problem after that.
I don't have a clue how to reproduce this as the only way to do so is the first installation on the first device, so if anyone has experienced something similar, or knows anything about this issue, please help.
I wrote an article about my long journey in the packaging, code signing, and notarization process of an Unreal Engine macOS application.
I found several problems in the recently introduced modernized Xcode workflow, and a bug in the implementation of CEF as a macOS framework.
All the detailed information is in the article - that's quite long so I added a TL;DR section for the ones only looking for the solution.
I hope the article can help other developers and save them all the weeks I had to spend on this.
https://pgaleone.eu/unrealengine/macos/2024/07/06/codesigning-notarization-issues/
I'm trying to put together a minimal example of a program that can use the CoreLocation api on macOS.
I know that I need to add usage description keys the Info.plist, so I'm compiling in a plist file.
Here is the code I'm using now, complete with a Makefile.
When I execute the program, I just get the error message:
CLLocationManager error: The operation couldn’t be completed. (kCLErrorDomain error 1.)
What am I missing? Is the codesign
step neccesary? Do I need to notarize it (and how do I notarize a single executable)?
I have an app (currently not released on App Store) which runs on both iOS and macOS. The app has widgets for both iOS and macOS which uses user preference (set in app) into account while showing data. Before upgrading to macOS 15 (until Sonoma) widgets were working fine and app was launching correctly, but after upgrading to macOS 15 Sequoia, every time I launch the app it give popup saying '“Kontest” would like to access data from other apps. Keeping app data separate makes it easier to manage your privacy and security.' and also widgets do not get user preferences and throw the same type of error on Console application when using logging. My App group for both iOS and macOS is 'group.com.xxxxxx.yyyyy'. I am calling it as 'UserDefaults(suiteName: Constants.userDefaultsGroupID)!.bool(forKey: "shouldFetchAllEventsFromCalendar")'. Can anyone tell, what am I doing wrong here?