There are actually two ways to remove the device icons from your desktop. The icons aren’t actually removed but are hidden instead so you can get them back whenever you want.
Using Finder to Hide the Device Icons
Make sure you are inside a Finder window. If you are on your desktop, you are already there.
Click on the “Finder” menu on the top and select “Preferences…”
When the panel opens, make sure you are in the General tab. Under the “Show these items on the desktop” section are the items that are visible on your Mac’s desktop. What you need to do is uncheck all of them so that they are no longer a part of your desktop.
As soon as the items are unchecked, they will be removed from your desktop helping you keep your desktop uncluttered.
There’s another way that uses Terminal to get the same job done.
Using Terminal to Hide the Device Icons
Launch Terminal by clicking on Launchpad in your dock and searching for and clicking on Terminal.
When Terminal launches, type in the following command and press Enter. It will hide the device icons on your desktop.
You need to relaunch Finder so that the changes can be applied. Enter in the following command into Terminal and press Enter to do so.
All the device icons are gone from your desktop. It is as neat and clean as it should be.
If you would like to get the device icons back for any reason, just run the following command in Terminal.
Conclusion
If you would prefer your Mac desktop not be cluttered with the device icons, the above guide should help you get rid of them on your machine.