Adding Favourites Finder Sidebar

rajrajan
New Contributor III

Dear All,

I need a bash script for adding "Favourites Finder Sidebar items" in macOS Monterey or Custom Payload profile.

 

Please advise.

 

Thanks!

Raj.

4 REPLIES 4

rajrajan
New Contributor III

Dear All,

Please check the script below: It is not working when pushed from Jamf but working using the terminal.

 

Thoughts?

 

Thanks!

Raj.

#!/bin/sh

#Finds current username and defines a variable
currentuser=`stat -f "%Su" /dev/console`

#Substituting as user stored in variable to modify plist
#su "$currentuser" -c "<command to run>"

#Add Movies, Music, Pictures, <username>, to Finder Favorites sidebar.

su "$currentuser" -c "mysides add com.apple.LSSharedFileList.FavoriteItems file:///Applications"

su "$currentuser" -c "mysides add com.apple.LSSharedFileList.FavoriteItems file:///Users/$currentuser"

su "$currentuser" -c "mysides add com.apple.LSSharedFileList.FavoriteItems file:///Users/$currentuser/Movies"

su "$currentuser" -c "mysides add com.apple.LSSharedFileList.FavoriteItems file:///Users/$currentuser/Music"

su "$currentuser" -c "mysides add com.apple.LSSharedFileList.FavoriteItems file:///Users/$currentuser/Pictures"

su "$currentuser" -c "mysides add com.apple.LSSharedFileList.FavoriteItems file:///Users/$currentuser/Downloads"

su "$currentuser" -c "mysides add com.apple.LSSharedFileList.FavoriteItems file:///Users/$currentuser/Documents"

#Restarts cfprefsd and Finder

killAll cfprefsd
killAll Finder

echo "Finder Preferences set"

exit 0

pcurtner
New Contributor II

"mysides" is a separate application that can be installed via homebrew; it is not included by default on macOS.

If you distributed mysides first and then ran this script with the complete path to the binary (say /usr/local/bin/mysides), your changes should take effect.

I can second this. I figured out how to use it, and it works. You can also install it from the "Releases" section on GitHub (Releases · mosen/mysides (github.com)). You may to re-sign the package using your Jamf Pro signing certificate (I had to do this), then deploy the signed package to your mcabooks. After it is deployed, you can create a script to run the mysides commands that you want.

thehandeman
New Contributor

Hello Raj,

I am also trying to figure this out.I'd like to try and collaborate with this one, if you are still interested. Some questions I have for you...

Does this script require any 3rd party tools, or does it work for you using "vanilla" macOS?

Which macOS version have you tested this on where it works successfully?

Is there any more contextual technical information you can provide on what was required for this script work for you?

Thanks.