Skip to main content
Question

Locking Contents of Dock

  • August 18, 2020
  • 5 replies
  • 20 views

Forum|alt.badge.img+3

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?

5 replies

Forum|alt.badge.img+5
  • New Contributor
  • 18 replies
  • August 19, 2020

You’re running it as the logged in user when you’re executing through the terminal. As a policy it’s running as root.


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • 5 replies
  • August 20, 2020

Thanks for the info @poormatt . What syntax can I use to run the above script as logged in user?


elliotjordan
Forum|alt.badge.img+12
  • Valued Contributor
  • 143 replies
  • May 24, 2021

  • 0 replies
  • May 24, 2021

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.


Forum|alt.badge.img
  • New Contributor
  • 1 reply
  • August 14, 2022

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.

 

Onevanilla