I am trying to run the following two bash commands in a Cocoa app:
defaults write com.apple.finder CreateDesktop false
killall Finder
Using NSTask, I have the following Swift code to execute the command when a button is clicked:
let commands = ["-c", "defaults write com.apple.finder CreateDesktop false",
"-c", "killall Finder"]
let task = NSTask()
task.launchPath = "/bin/bash"
task.arguments = commands
task.launch()
I get no errors when running the code. But nothing actually happens when the button is clicked. Any suggestions?