How to set dock icon size on macOS from the command-line

I don’t particularly love the dock on macOS. In fact, I don’t particularly like docks at all. I don’t use them to launch apps, and I find it abysmal that many macOS apps use the dock to communicate status, new messages and such.

Keeping true to my vain attempts to create a consistent experience between macOS and GNOME, I have both systems configured about the same. This is mostly just me configuring the macOS dock to closely mimic the behavior of the GNOME dash. I have the dock at the bottom, it’s default position, and hidden so it’s out of the way.

Because of some applications communicating status, I do bounce between hiding and not hiding the dock. Because of this, I’ve dabbled a lot with the size of the macOS dock icons.

In an attempt to create an inviting and user friendly experience, macOS tends to bury complex settings under a simple UI. One such example are the size of the dock icons. Your options are small to large, with no indication of what those values are, or the steps in between.

I dabbled with small to take up less vertical space. I dabbled with larger icons to consume more horizontal space, and try to defeat that big empty gap. Eventually I gave up, leaving the dial somewhere in the low to medium range, roughly 25% of the way.

Great, except I had no idea what the value is. Plus the next time I make any adjustments to the size, it probably won’t be exactly the same. When it’s not exactly the same, and the dock is not hidden, all of my windows will need to be resized to accommodate.

Setting the dock icon size

Even though macOS protects you from the complexity of things, they still give you the tools to unlock that additional potential. With access to the defaults command, you not only set the exact settings you’d like, but you can also script things so you can apply them to new systems easily.

If you can script it, you can stash it in your dotfiles!

To set the exact value of the dock icons, you’ll need to not only set it with defaults but you’ll also need to restart the dock. You could do this by logging out and back in, or even rebooting, or just use killall after you set the icon size:

# Set the size of the dock icons
defaults write com.apple.Dock tilesize -int 48
# Restart the dock
killall -HUP Dock

# Put it all together in one command
defaults write com.apple.Dock tilesize -int 48 && killall -HUP Dock
Zsh

The number 48 can be changed to whatever you’d like to set the icon size to be from 1 up to 128. I tried some values higher than 128 but the size didn’t change, or if it did, it didn’t change much.

For reference, the macOS dock size slider ranges from 16 to 128.

Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.


If you found this article helpful, please consider buying me a coffee.