There is no simple command or action that will allow you to backup your widgets, but it is still possible. Widgets, when installed, create files in the Library folder (which is hidden by default). Backing up widgets is really as easy as copying a bunch of files. The trick is to know which ones to copy.
Before you can start the backup process, you will have to first to show all hidden files; you can use a Mac Lion tweaking app or run the following command in Terminal
defaults write com.apple.finder AppleShowAllFiles TRUE
Once all hidden files are visible, you will see a Library folder in your Users directory. Open Users/Your User Name Folder/Library/Preferences. Find the following files in this folder and copy them to your backup location.
In the same folder, locate all files that are named widget-com* (the * denotes any and all names that appear after widget-com). Copy all these files to your backup location. Return to the Library folder and search for the Widgets folder. Copy all these files and your backup is complete.
In order to restore the widgets, you simply have to copy the files you backed up to the same folders they were copied from i.e. the com .apple files to Library/Preferences, the widget-com files to Library/Preferences and the Widget files to Library/Widget. Doing so will restore all your widgets. You will have to run the killall Dock command in Terminal. Alternatively, you can log out and log back in again.
If you want to selectively restore widgets, copy the com.apple files back, but when you copy widgets-com and the widget files themselves, make sure you only copy those for the widget you want to restore. Say, for example, we restored a widget named Wikipedia. The files that we copied back to their original location were
That’s all that goes in to backing up your widgets. As stated earlier, it isn’t difficult or complicated; it just isn’t a one or two click process.