I prefer every item having both text and an icon. If I don't know what the icon mean, there's text there to explain it. If I do know what the icon means, i can scan just the icons and find what I need faster. In my opinion it's the best of both worlds. That being said, your first example might be even better, because a lot of those things like "close" or "versions" I'm not going to be clicking often, so if they had an icon I'd have to read the text to figure them out every time anyway
In case it’s useful to someone, in many native Mac apps you can get the main toolbar to show both. Try right-clicking on the toolbar -> Customize Toolbar -> Icon and Text. Doesn’t work everywhere though, but still super useful to me, I enable it whenever I can.
But it's not as compact as icons only, which to me is the main advantage of icons. All icon buttons should have hover text with the command name of course.