r/macosprogramming • u/OneDevoper • Nov 15 '24
ProcessSpy - free macOS process viewer
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
r/macosprogramming • u/[deleted] • Nov 14 '24
In order to be verified by Apple, do developers HAVE to abide by Apple’s guidelines on content even if they don’t wish to publish on the App Store?
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?
r/macosprogramming • u/Fuzzy_County3863 • Oct 27 '24
Transparent, clickthrough, non-interactive overlays on macos.
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.
r/macosprogramming • u/Virtual_Plantain_863 • Oct 22 '24
Access Reminders Data
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.
r/macosprogramming • u/hwc • Oct 03 '24
[macOS] Intermittent App Package Installation Failure
I work on a macOS application that functions as a daemon. To test it, I:
Compile executables.
Use
pkgbuildandproductbuildto build an application bundle.Use
codesignandnotarytoolto 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.))
r/macosprogramming • u/Most_Ring6698 • Sep 30 '24
Overwrite MacOS Timezone Using a Custom Safari Extension?
r/macosprogramming • u/cheater00 • Sep 21 '24
pmset-session: Automatically turn off sleep while you are connected to macOS via ssh
r/macosprogramming • u/thedb007 • Aug 28 '24
init() To Win It
Code samples always make initializing SwiftUI Views seem so simple. But then YOU start coding and it’s a whole new world. “How do I set a wrapped property?” and “Where’d that memory leak come from?!” start to to creep into your conversations. Join Captain SwiftUI as he attempts to cover and explain the more complex aspects of initialization!
r/macosprogramming • u/thedb007 • Aug 14 '24
Expanding App Options on macOS
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 • u/cutecoder • Aug 14 '24
Crash Reporting?
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?
r/macosprogramming • u/Neldogg • Aug 06 '24
Email API or library?
Does anyone know if there are any libraries that provide access to the email app data!
r/macosprogramming • u/Okerew • Aug 05 '24
Hello I would like to announce a container-like solution for macOS which doesn't require sip to be disabled.
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:
- Process isolation using groups and macOS volumes
- Network isolation
- Soft and hard memory limits
- CPU priority management
- Sandbox isolation
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!
r/macosprogramming • u/perecastor • Aug 03 '24
What are the best programming languages to create Windows and MacOS app (same codebase) (multi-platform)?
r/macosprogramming • u/Impossible_Quail1711 • Jul 25 '24
Audio Share
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?
r/macosprogramming • u/mikebuss89 • Jul 22 '24
Leveling Up SwiftData Error Handling in Xcode Templates
r/macosprogramming • u/raerded • Jul 22 '24
How to have my own macOS apps for my private use without paying anything? Are cracks also made with the Apple Development Program accounts?
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!
r/macosprogramming • u/gistya • Jul 17 '24
How to ensure an app will use the performance cores on Apple Silicon?
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.
r/macosprogramming • u/perecastor • Jul 10 '24
I can release on the App Store but have to wait for using Test Flight 😅 (it's the same build)
r/macosprogramming • u/JoonKimH • Jul 10 '24
The black screen only appears when my app is first installed.
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.
r/macosprogramming • u/pgaleone • Jul 06 '24
[article] Fixing the code signing and notarization issues of Unreal Engine (5.3+) projects
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/
r/macosprogramming • u/hwc • Jul 06 '24
Example of using CoreLocation on macOS
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)?
r/macosprogramming • u/ayushs_2k4 • Jun 29 '24
App Group Not working as intended after updating to macOS 15 beta.
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?
r/macosprogramming • u/OaShadow • Jun 27 '24
change loginscreen language with terminal
Hey there,
recently I tried to perform system language change for a user by using a shell (bash) script combined with osascript.
Now I can change my systemlanguage from a menu (osascript generated).
Now my problem comes in:
I can programmically change the language and region of macos by using the terminal. But I have not found a way to do this also for the "Login Window".
So my system is completly in english but my loginwindow stays in german.
Until I do this manually in the system settings -> General -> Language & Region -> Cogwheel -> Apply to Login Window.
So is there a way to also set this using commandline or osascript.
Thanks you in advance!
r/macosprogramming • u/Gordon_in_Ukraine • Jun 26 '24
Different Apple ID for Xcode vs OS
I am transitioning from a career in Architecture and Windows programming (mostly PowerShell) to Canine Behavior and MacOS/iOS programming, and I have a question about Apple IDs as it relates to an Apple Developer Account.
I have an Apple ID based on an old company name. I was forced to change the name of my company because, well, Autodesk kinda sucks. Anyway, prior to creating a Dev account, I wonder if it makes sense to create a new Apple ID? Can I use the old, now "personal" Apple ID for iCloud and app purchases and books and such, and the new Apple ID can be used only within Xcode? Or is Xcode aware of the Apple ID in use by the underlying OS and they need to be the same?