Skip to main content
Question

Post Install SH Script Fails

  • March 29, 2016
  • 3 replies
  • 15 views

KyleEricson
Forum|alt.badge.img+17

I'm trying to make the Office 2016 Items show up on the dock via a post install script. I want to use Apple's built in tool. I run the following command in terminal and it works. I then that it and place it in the post install script and it doesn't do anything.

SH Script:

!/bin/sh

postinstall

defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft Word.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'

defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft PowerPoint.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'

defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft Excel.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'

defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft OneNote.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'

defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft Outlook.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'

defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft Lync.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'

killall Dock

3 replies

Forum|alt.badge.img+15
  • Contributor
  • March 29, 2016

Because it is running as root when it installs via policy so it's trying to modify root's dock. You need to either run as user, or address the user's dock.


KyleEricson
Forum|alt.badge.img+17
  • Author
  • Valued Contributor
  • March 29, 2016

How do I run this as the current user?


Forum|alt.badge.img+15
  • Contributor
  • March 29, 2016

There are many many posts about that process. so I won't replicate here. Give one a try. You'll need to find out who the logged in user is, then 'sudo' as that username.