a way to do scutil --get and --set stuff without scutil

Sorry about the title, it's kind of awkward.

Basically, I have an ASOC app that I'd like to port to swift as a learning excercise. it's pretty straightforward, it grabs the computer name, local host name, and host name via the scutil --get operations and lets you change those via the --set.

doing this in ASOC is dead simple, yay do shell script, and I mostly found a way to do it via NSAppleScript, but it feels very...awkward.

Is there a better framework to use for getting and setting this info?

thanks!

john

Replies

Is there a better framework to use for getting and setting this info?

That would be the System Configuration framework itself. It looks like --get and --set are interfaces to the SCPreferences API.

Note that the legacy doc, System Configuration Programming Guidelines, explains the SC architecture, which is something you’ll want to understand before tackling this.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"