I don't think there are default shortcuts for that. But I assume you could make one using AppleScript or other automation programs.

I found this post from 2012 asking the same question. I tried making the script provided in the comments but couldn't make it work.

I'm not sure if it isn't working because Apple Scripts are different now, or because the script per se doesn't work or because there are steps I'm skipping.

When I try to save the script it says

“Expected “given”, “with”, “without”, other parameter name, etc. but found identifier.”

Any idea?

2 Answers 2


This AppleScript code works for me using the latest version of macOS Mojave.

tell application "System Events" to tell dock preferences
    if screen edge is bottom then
        set screen edge to left
    else if screen edge is left then
        set screen edge to bottom
    end if
end tell

In Automator, create a new Service or Quick Action and add a run AppleScript action to that workflow, adding the above AppleScript code. Then in System Preferences you can create a keyboard shortcut for that new service.

  • Nice! +1 I seem to always forget about dock preferences in System Events. :) Apr 6, 2019 at 3:51
  • Awesome! I was just looking for a way to make this exact same toggle (left vs bottom) without using killall Dock. Thanks!
    – TJ Luoma
    Aug 25, 2020 at 14:42
  • This works, unlike the defaults write approach. Which is annoying because that is a lot shorter. May 31, 2021 at 6:04

The reason you get the Syntax Error:

Expected “given”, “with”, “without”, other parameter name, etc. but found identifier.


defaults write com.apple.Dock orientation -string left;killall Dock

In Script Editor is because it is not AppleScript code!

It's a compound command to run in Terminal; however, it can be run in AppleScript by using the do shell script command:

do shell script "defaults write com.apple.Dock orientation -string left;killall Dock"

That said though, I'd choose not to use it because the result of killall Dock with unhide all hidden windows and can be very disruptive and messy.

An alternative is to use UI Scripting1 with System Preferences, and this can be done in a less disruptive manner then killall Dock. 1Note that using UI Scripting may require accessibility privileges be granted.

The following example AppleScript code will toggle the position of the Dock between the Bottom and the Left side of the screen:

This was tested in Script Editor and works under macOS High Sierra.

if running of application "System Preferences" then
        tell application "System Preferences" to quit
    on error
        do shell script "killall 'System Preferences'"
    end try
end if

repeat while running of application "System Preferences" is true
    delay 0.01
end repeat

tell application "System Preferences" to ¬
    reveal anchor "Main" of pane id "com.apple.preference.dock"

tell application "System Events" to tell application process "System Preferences"
    repeat while not (exists (window "Dock"))
        delay 0.1
    end repeat
    tell radio group 1 of window "Dock"
        if value of radio button "Bottom" is 1 then
            click radio button "Left"
        else if value of radio button "Left" is 1 then
            click radio button "Bottom"
        end if
    end tell
end tell

quit application "System Preferences"

This example AppleScript code can be used in an Automator Service (Quick Action in macOS Mojave) using a Run AppleScript action, and assigned a keyboard shortcut in: System Preferences > Keyboard > Shortcuts > Services

Note: The example AppleScript code is just that and does not contain any error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors. Additionally, the use of the delay command may be necessary between events where appropriate, e.g. delay 0.5, with the value of the delay set appropriately.

  • Hmmm.. Some of those lines look familiar LOL. Gonna have to +1 ;-)
    – wch1zpink
    Apr 6, 2019 at 2:10
  • Yes, we both have gleaned code from each other! :) Thanks for the +1 Apr 6, 2019 at 2:12

You must log in to answer this question.

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