OSX application without storyboard or xib files using Swift

if you don’t want to have the @NSApplicationMain attribute, do: have a file main.swift add following top-level code: import Cocoa let delegate = AppDelegate() //alloc main app’s delegate class NSApplication.shared.delegate = delegate //set as app’s delegate NSApplicationMain(CommandLine.argc, CommandLine.unsafeArgv) //start of run loop // Old versions: // NSApplicationMain(C_ARGC, C_ARGV) // NSApplicationMain(Process.argc, Process.unsafeArgv); the rest should be … Read more

gdb 8.2 can’t recognized executable file on macOS Mojave 10.14

The problem is that clang-1000.11.45.2 distributed with Apple LLVM version 10.0.0 adds a new load command to o-mach executables named LC_BUILD_VERSION. $ otool -l test.o … Load command 1 cmd LC_BUILD_VERSION cmdsize 24 platform macos sdk n/a minos 10.14 ntools 0 … From the apple source: /* * The build_version_command contains the min OS version … Read more

How to check in AppleScript if an app is running, without launching it – via osascript utility

I suspect the reason you are getting this is because each time you call the script from the command line with osascript the script is being compiled. The act of compiling on a tell application will afaik make the app launch. Calling the script from the command line with osascript from a pre-compiled file i.e … Read more

How to detect if OS X is in dark mode?

Don’t think there’s a cocoa way of detecting it yet, however you can use defaults read to check whether or not OSX is in dark mode. defaults read -g AppleInterfaceStyle Either returns Dark (dark mode) or returns domain pair does not exist. EDIT: As Ken Thomases said you can access .GlobalPreferences via NSUserDefaults, so NSString … Read more

How to unpack and pack pkg file?

Packages are just .xar archives with a different extension and a specified file hierarchy. Unfortunately, part of that file hierarchy is a cpio.gz archive of the actual installables, and usually that’s what you want to edit. And there’s also a Bom file that includes information on the files inside that cpio archive, and a PackageInfo … Read more

tech