Problem in defaults command when adding app with blanks in name to dock

Solution 1:

I recommend using dockutil for this. You can either download and install this directly from github, or you can install it using Homebrew with the command

brew install dockutil

Once installed, you can use a command like this to add an app with spaces in the path

dockutil --add '/Users/mac/Downloads/Yahoo News, Send & Weather2/YahooWeather.app'