Skip to content

Instantly share code, notes, and snippets.

@kvannotten
Created May 4, 2014 12:37
Show Gist options
  • Save kvannotten/0014369e0061c2054e05 to your computer and use it in GitHub Desktop.
Save kvannotten/0014369e0061c2054e05 to your computer and use it in GitHub Desktop.
Toggle OSx dock's mutability
#!/usr/bin/env ruby
# get current state
immutable = `defaults read com.apple.dock contents-immutable`.to_i == 1
# toggle the state
immutable = !immutable
# write the state
`defaults write com.apple.dock contents-immutable -bool #{immutable ? "YES" : "NO"}`
`defaults write com.apple.dock size-immutable -bool #{immutable ? "YES" : "NO"}`
# kill the dock application
`killall Dock`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment