I would like to be able to resize the Dock in macOS strictly using keybindings. Ideally, this would be incrementally and work similar to the way that volume/brightness increase/decrease keys work.

I use BetterTouchTool for most of my gesture/shortcut customizations, and I have been able to achieve just about everything I've needed with it, but this is one thing I've yet to figure out.

Has anyone ever successfully achieved this? If so, what was your approach (software, tools, etc.)?

  • 1
    on how to use the BTT your question is better suited here community.folivora.ai/c/discussion – Ruskes Nov 12 '18 at 17:42
  • 1
    I do not know how to do it incrementally but this works defaults write com.apple.dock tilesize -int 32; killall Dock – Ruskes Nov 12 '18 at 19:25

The approach I ended up taking was a variation of @Paolo's solution, and is simple to implement using a tool like BetterTouchTool (as @blizzrdof77 mentions in his original question).

Instead of preparing two AppleScripts, this single script takes one argument - a numeric value between -1.5 and 1.5 - which determines whether the dock will increase or decrease in size.

The AppleScript:
Create a new file called "change-dock-size.applescript" with the following content:

on run argv
    tell application "System Events"
        -- Get dock size
        set docksize to dock size of dock preferences
        -- Increase or decrease based on argument version
        set docksize to docksize + (item 1 of argv)
        -- Constrain value to 0.1 -- 1.5
        if docksize > 1.5 then docksize = 1.5
        if docksize < 0.1 then docksize = 0.1
        -- Set dock to the new size
        set dock size of dock preferences to docksize
    end tell
end run

Running It From The Command Line:
You can run this from the command line using osascript - like this:

# Increase Dock Size
osascript /path/to/script/change-dock-size.applescript 0.01

# Decrease Dock Size
osascript /path/to/script/change-dock-size.applescript -0.01

Adding Keybindings to BetterTouchTool:
To use this in BTT, add two new shortcuts with the "Execute Terminal Command" action, and use the above examples as the commands (I've provided a screenshot of my setup below). I hope this helps!

Resize Dock in MacOS With BetterTouchTool Using Keybindings Screenshot


First you have to prepare two AppleScripts, one to increase the size of the Dock and one to decrease.

You may run AppleScript Editor, write and test them.

tell application "System Events"

    -- get dock size (decimal in range 0 -- 1)
    set docksize to dock size of dock preferences

    -- increase version
    set docksize to docksize + 0.05

    -- decrease version (commented)
    -- set docksize to docksize - 0.05

    -- constrain value to 0.1 -- 1.0

    if docksize > 1 then docksize = 1
    if docksize < 0.1 then docksize = 0.1

    -- set dock size
    set dock size of dock preferences to docksize
end tell

The dock size is a value ranging from 0 to 1.

The above script increases / decreases the size by 0.05 steps.

You may choose a different formula according to your needs.

The next steps are

  1. Create and save a new service with Automator that run an AppleScript

  2. Assign a keyboard shortcut to the service created via System Preferences

Do it twice: for the increase and decrease shortcut.

When you create the services with Automator the AppleScripts run are the ones you prepared for increase/decrease the Dock size.

Instructions on how to create the service and assign an AppleScript to run are here:

How do I assign a keyboard shortcut to an AppleScript I wrote?

Bottom note:

Some suggested in the comments to resize the dock by issuing the following terminal commands

defaults write com.apple.dock tilesize -int 32; killall Dock

so I did in the first version of this answer. However this approach involves restarting the Dock application with several drawbacks.

As user3439894 suggested the Dock may be resized via AppleScript using System Events. This way the action takes place faster and more gracefully, so I updated my answer.

  • 1
    The problem I have with your answer is it uses a totally unnecessary method that involves quitting the Dock, which can also be extremely disruptive. For example, I work across multiple Desktops with many windows on each in which some are minimized and quitting the Dock restores these windows. This is both visually disruptive and then I need to spend time minimizing the particular windows that got restored. AppleScript's System Events has a built in non-disruptive method to resize the Dock. Have a look at the Dock Preferences Suite in System Events AppleScript Dictionary. – user3439894 Nov 14 '18 at 13:43
  • In other words, there is no need to shell out and use defaults which in this use case requires quitting the Dock for the changes to take. -- "dock size (real) : size/height of the items (between 0.0 (minimum) and 1.0 (maximum))", so e.g.: tell application "System Events" to set dock size of dock preferences to 0.5 instantly changes the size of the dock and the only visual is the Dock itself resizing, not quitting and disappearing and reappearing and restoring any minimized windows. – user3439894 Nov 14 '18 at 14:09
  • @user3439894 great advice, thank you! I updated the AppleScript in the answer in order to use System Events – Paolo Nov 14 '18 at 14:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .