Skip to main content
Question

Post Install SH Script Fails


KyleEricson
Forum|alt.badge.img+16

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
  • 589 replies
  • 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+16
  • Author
  • Valued Contributor
  • 444 replies
  • March 29, 2016

How do I run this as the current user?


Forum|alt.badge.img+15
  • Contributor
  • 589 replies
  • 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.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings