Posted on 08-18-2020 01:47 PM
I'm running this script from a policy in Jamf.
#!/bin/sh
defaults write com.apple.Dock contents-immutable -bool true; killall Dock
It does not do anything. However, if I run it locally from Terminal, works like a charm. Any thoughts? What I am doing wrong or forgetting?
Posted on 08-18-2020 06:38 PM
You’re running it as the logged in user when you’re executing through the terminal. As a policy it’s running as root.
Posted on 08-20-2020 03:32 PM
Thanks for the info @poormatt . What syntax can I use to run the above script as logged in user?
Posted on 05-23-2021 07:31 PM
@pmckeehan Check out this article: scriptingosx.com: Running a Command as another User
Posted on 05-24-2021 03:28 AM
Open one of the applications you want to always be in the dock, and right click on its dock icon.
Toggle “Keep in Dock” to on in the Options menu.
Open Terminal OneVanilla Login
In the terminal window type: defaults write com.apple.dock contents-immutable -bool true.
Then type: killall Dock.
Posted on 08-13-2022 10:12 PM
When you run something through the terminal, you do so as the user who is currently logged in. It is operating as root by default.