Clearing and resetting dock on macOS

You can clear the dock’s persistent items (default apps that show up on dock) by running the following:

defaults write com.apple.dock persistent-apps -array; killall Dock

You can reset the dock using:

rm ~/Library/Preferences/com.apple.dock.plist; killall Dock

Note: it might not be necessary to kill the dock but I needed to run that on Monterey.