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 persistent-apps -array; killall Dock

You can reset the dock using:

rm ~/Library/Preferences/; killall Dock

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