Add specific apps to the Dock on Mac

expand collapsive

Hey fellow admins! How do you add specific apps to the Dock on your Mac endpoints? Does anyone here use some sort of scripting solution that you’d be willing to share? Thanks.

All Replies

  • Participant

    Aika Patel

    Participant

    Here’s what we put together to run in our environment:

    —————————————————————————————————–

    #!/bin/bash

    LOGGED_USER=stat -f%Su /dev/console

    sudo su $LOGGED_USER -c ‘defaults delete com.apple.dock persistent-apps’

    dock_item() {

    printf ‘<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>%s</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>’, “$1”

    }

    # Declare all apps here

    notes=$(dock_item /System/Applications/Notes.app)

    chrome=$(dock_item /Applications/Google\ Chrome.app)

    mail=$(dock_item /Applications/Mail.app)

    sudo su $LOGGED_USER -c “defaults write com.apple.dock persistent-apps -array ‘$notes’ ‘$chrome’ ‘$mail'”

    killall Dock

    —————————————————————————————————–

    The script will detect the currently logged-in user and then customize the dock for that user account.

    • This reply was modified 2 months, 2 weeks ago by  Chris Wheeler.
    • This reply was modified 2 months, 2 weeks ago by  Chris Wheeler.
    • This reply was modified 2 months, 2 weeks ago by  Chris Wheeler.
    • This reply was modified 2 months, 2 weeks ago by  Aagosh tk.
    • This reply was modified 2 months, 2 weeks ago by  Chris Wheeler.
    • This reply was modified 2 months, 2 weeks ago by  Chris Wheeler.
    • This reply was modified 2 months, 2 weeks ago by  Chris Wheeler.
    • This reply was modified 2 months, 2 weeks ago by  Aagosh tk.
    • This reply was modified 2 months, 2 weeks ago by  Aagosh tk.
    • This reply was modified 2 months, 2 weeks ago by  Chris Wheeler.
    • This reply was modified 2 months, 2 weeks ago by  Chris Wheeler.
    • This reply was modified 2 months, 2 weeks ago by  Chris Wheeler.
    • This reply was modified 2 months, 2 weeks ago by  Chris Wheeler.
    • This reply was modified 2 months, 2 weeks ago by  Chris Wheeler.