Add specific apps to the Dock on MacSolved

Participant
Discussion
3 years ago

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.

Replies (2)

Marked SolutionPending Review
Participant
3 years ago
Marked SolutionPending Review

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 years, 6 months ago by  Chris.
  • This reply was modified 2 years, 6 months ago by  Chris.
  • This reply was modified 2 years, 6 months ago by  Chris.
  • This reply was modified 2 years, 6 months ago by  Aagosh.
  • This reply was modified 2 years, 6 months ago by  Chris.
  • This reply was modified 2 years, 6 months ago by  Chris.
  • This reply was modified 2 years, 6 months ago by  Chris.
  • This reply was modified 2 years, 6 months ago by  Aagosh.
  • This reply was modified 2 years, 6 months ago by  Aagosh.
  • This reply was modified 2 years, 6 months ago by  Chris.
  • This reply was modified 2 years, 6 months ago by  Chris.
  • This reply was modified 2 years, 6 months ago by  Chris.
  • This reply was modified 2 years, 6 months ago by  Chris.
  • This reply was modified 2 years, 6 months ago by  Chris.
Marked SolutionPending Review
Participant
3 years ago
Marked SolutionPending Review

@aika This is great! Appreciate it.