My build process depends on SMJobBlessUtil.py. With the removal of python 2 from Monterey 12.3 beta, is there a replacement script available in any sample code.
I am not very interested in patching my current version as python is way beyond my skill set.
Post not yet marked as solved
A number of years ago I wrote code that uses dns_open(...) and dns_lookup(...) to call a remote name server for dns resolution.
Testing in Monterey, Big Sur and Catalina I get a NULL reply from dns_lookup. The code produces an expected result with Mojave and High Sierra.
If I pass NULL as the argument to dns_open() then resolution is successful, but that is not using the desired name server.
I have submitted feedback request FB10027085 with a small project that demonstrates the failure.
Post not yet marked as solved
An application I am working on (Mostly swift 4.2 with sprinklings of C and C++) appears to be leaking mach ports when run on Mojave and currently has 3,600 open after running for 12 hours. I am just looking at the 'Ports' field in Activity Monitor to see this.The same binary running on Sierra is using about 500 ports.The application is quite complex, making extensive use of DispatchQueue() and also has an associated privileged helper.Unfortunately, I have been unable to create a simple test case that demonstrates the behaviour.I have done a lot of searching to find out what may be causing the problem and come up with zilch. Is there any debugging tool (i.e. Instruments plugin maybe) that might help to narrow down where the allocation/leakage is coming from. I have seen the results of the tests on google Chrome from a few years back but I'm not keen to start building, installing and debugging kernel extensions to track this problem down.
Post not yet marked as solved
In my code I copy 2 executable files to the Desktop (selected via NSOpenPanel). I am using Xcode 13.2.1
On an Intel Mac this works as expected and I see the 2 files on the desktop as expected.
On an M1 Mini I see a link file called Developer. When I click it the 2 copied files are revealed. If I only copy one file then it shows as expected. This happens in both Monterey and Big Sur but only on the M1.
Saving the files to any other folder does not create the Developer link, only when Desktop is chosen from the selection dialog.
When I execute ls ~/Desktop from the command line I see only the 2 files, so I am thinking that Developer is some artefact of the Finder.
Is the creation of this 'Developer' link a System/Finder setting and why would it only happen on the M1 machine?
@IBAction func exportUtils(_ sender: Any)
{
let panel = NSOpenPanel()
panel.message = NSLocalizedString("Export Command Line Tools", comment: "")
panel.prompt = NSLocalizedString("Choose", comment: "")
panel.canChooseFiles = false
panel.canChooseDirectories = true
panel.canCreateDirectories = true
panel.showsHiddenFiles = true
panel.isExtensionHidden = false
let result = panel.runModal()
if result != .OK { return }
guard let dir = panel.directoryURL else { return }
let dest = dir.path
let fileManger = FileManager.default
for file in ["a", "b"] {
do {
let target = dest + "/" + file
if fileManger.fileExists(atPath: target) {
try fileManger.removeItem(atPath: target)
}
guard let util = Path.executablePath(forExecutable: file) else { return }
try fileManger.copyItem(atPath: util, toPath: target)
Logger.instance.log("Copied: " + file + " to: " + dest)
} catch {
Logger.instance.log("Failed to copy: " + file + " to: " + dest)
}
}
}
code-block
Post marked as Apple Recommended
I have a C struct that stores a MAC address as an array of 6 unsigned characters (u_char) i.e.u_char mac[6];In swift this array is seen as a tuple (UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)I want to store this tuple into a Swift array in the fastest way possible. Currently I am using memcpy but wondered if there is a more Swiftified way of doing this without sacrificing speed. var dst_mac: [u_char] {
var a = [u_char](repeating: 0, count: 6)
var mac = m_flow.dst_mac
memcpy(&a, &mac, 6)
return a
}
Post not yet marked as solved
The system call ntp\_adjtime sets and returns various attributes associated with the NTP phase locked loop in the Darwin kernel via a struct timex argument. The frequency of the the loop is passed back and forward in this struct as a signed fractional number.
In Big Sur, instead of returning a negative number for the frequency when required, ntp\_adjtime returns the unsigned representation of the number - i.e. the value is always positive and can be 'off' by 65536.
I have submitted FB8561779, along with a simple test case demonstrating the problem. I hope it will be fixed soon.
Post not yet marked as solved
I cannot see how to disable Auto layout in Xcode 11. I saw nothing in the release notes to say it's no longer possible.Is it no longer possible to do this by error or design?
Post not yet marked as solved
I am using the following code to determine the last opened date of an applicationpublic extension URL {
var lastUsedDate: Date? {
guard let item = MDItemCreateWithURL(kCFAllocatorDefault, self as CFURL) else { return nil }
guard let date = MDItemCopyAttribute(item, kMDItemLastUsedDate) as? Date else { return nil }
return date
}
}In general this works very well, providing the URL being inspected is either /Applications/xyz.app or even ~/Applications/xyz.app. The code returns the same date as that shown by the Finder 'Last opened' attribute for the application.If the application is NOT in either of these locations then the kMDItemLastUsedDate attribute for the application is never updated. I can observe this with both the code snippet above and also by manually inspecting the attribute in the Finder. An example failure case:I have unpacked the developer 'Additional Tools' into ~/Applications/Additional Tools/ preserving the hierarchy from Apples .dmg file. 'Last opened' is never updated for any of these tools, no matter how I open them (i.e. double click in the Finder, or 'open path/to/tool' from a terminal session.Is this an OS issue (I am running 10.15.3) or possibly a Spotlight problem?
Post not yet marked as solved
In 10.15 beta 7, my boot volume has the default document icon. This volume is on an external USB 3.1 disk. If I boot from another 10.15 beta 7 volume (different disk) then that volume loses it's icon and the original volume now has the expected USB icon.Anyone else seeing this or is my installation broken?
I have a Swift command line tool embedded in a Swift application that is compiled to run on macOS 10.10 and later.After upgrading the application and tool to Swift 5, will users on macos 10.14.3 and earlier have to install the Swift 5 Runtime Support?Is there anyway to link or invoke the tool so that it uses the Runtime Libraries already embedded in the Frameworks directory of the application bundle?
Post not yet marked as solved
I have recently added a second monitor to my iMac.In my NSWindowController I have:override func windowDidLoad() { window!.titleVisibility = NSWindow.TitleVisibility.hidden window!.setFrameAutosaveName(window!.title) }and in IB, the Restorable attribute for the window is enabled.This works fine with just one monitor and the window is restored to its previous offsets..If I move the window to the external monitor, Quit and relaunch the application, the window is restored to the primary monitor at the offsets it had on the external monitor. (i.e. correct position on the screen but incorrect monitor)Do I need to explicitly save and restore the window screen info or am I missing some other window attribute that should be set.
Post not yet marked as solved
In macOS 10.13, submitting an NSRuler to NSScrollView.horizontalRulerView changes the the frame of the ruler.clientView by decreasing the height (for a horizontal ruler) of the clientView frame by the thickness of the ruler. This all makes sense and seems to be a good thing.In macOS 10.14 (Mojave) it seems this no longer happens and the client frame retains its original size. Is this a bug?I can work around the difference with #available but somehow that doesn't seem like the right way to be doing it.
Is there a way in macOS 10.14 (or earlier) to find programatically if the user has selected Dark Mode in System Preferences?
Post not yet marked as solved
I have Linux installed on an external (USB 3.0) drive. Since the update to Mojave I have been unable to boot from this disk. I see the missing OS icon, or if there is a version of macOS installed on other drive, the system will boot from that.I looks as tho there has been a firmware update that has broken non-macOS booting.Anyone else with Mojave installed able to dual boot Linux?
Post not yet marked as solved
My application compiles and runs successfully. To avoid the 'signature too large to embed' error I was getting during code-signing I set 'Other Code Signing Flags' --timestamp --signature-size=12000 (workaround posted by Quinn in another thread)Now when I attempt to export an archive of the application from Organizer, I once again fail with 'signature too large to embed (size limitation of on-disk representation)' when re-signing.It appears that when the application is re-signed by the export process the --signature-size=12000 attribute is not inherited.How can I work around this?