Hi there,
have you tried converting said plist to a .mobileconfig file with Tim Sutton's mcxToProfile? https://github.com/timsutton/mcxToProfile
This python script will convert your com.apple.sidebarplists into a .mobileconfig which you would then be able to upload to your jss or other mdm solution.
I have used this to manage custom sidebars and other similar prefs in Yosemite with success for the past year in an effort to discontinue using the user template folder for user template customisations, as Apple for the past few years has been encouraging us to move away from modifying the UserTemplate Folder and instead use config profiles and/or scripts to achieve similar outcomes.
As I have not began testing El-Cap in my environment yet, I am unable to say weather this method will resolve your sidebar issue in El-Cap, but could be worth a go.
Hope this points you in the right direction,
Jordan
I've been looking into other options to try and configure the sidebar favourites in El Capitan. I tried converting a plist into a Configuration Profile, but that didn't work either (I also want my users to be able to modify the sidebar afterwards).
I've tried https://github.com/matt4836/changeSidebarLists and http://errorfreeit.com.au/blog/2015/5/22/deploy-finders-sidebar-list-favorites but the python script appears to have some LSSharedFileList library issues in 10.11.
I then discovered https://github.com/Aeon/sidebarFinagler which is built for 10.11 and can export and import a set of favourites. This appears to work, but as it doesn't allow for the ~ character in the path of the favourite, it isn't the clean solution I was after.
I think I've also found out why my .plist solutions haven't been working, 10.11 appears to now store the sidebar favourites in ~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.FavoriteItems.sfl. I cant see an easy way to manage/configure this file.
If anyone has an elegant solution for adding the users Home folder to the sidebar in 10.11, I'm all ears! I'd prefer to be able to set something up in the user template, rather than a login script though.
Have you considered just setting new finder windows to open up in the user's home directory instead?
/usr/bin/defaults write "$USER_TEMPLATE"/Library/Preferences/com.apple.finder NewWindowTarget -string PfHm
Where $USER_TEMPLATE would be the /System/Library/User Template/<folder>
Have you considered just setting new finder windows to open up in the user's home directory instead?
Yeah, thats my current workaround. I don't like that this doesn't put the home directory in the sidebar though :(
I use "mysides" (https://github.com/mosen/mysides) on OS X Yosemite to add the user's network home folder to the sidebar at login. I don't see why the same can't be done for the user's local home directory.
It seems to work fine on El Cap too.
@morgrowe How do you use this? I'm not familiar with Xcode bundles.
@sancheeto
If you install Xcode on your computer, open the project file and run a Build, it will create binary which you can then put into /usr/local/bin on your machines to use. I had to dig the binary out of my ~/Library/Developer folder.
I've then setup some login scripts to populate the sidebar on first user login.
@plawrence How did you manage to script the adding ?
@chrisbju
After copying the mysides binary into /usr/local/bin/ I add the following code to my login script so that it only makes the modifications to the sidebar once per user.
# Add Sidebar Shortcuts
if [ ! -e /Users/$3/.sidebarshortcuts ]
then
echo "Adding Sidebar Shortcuts"
su - $3 -c "/usr/local/bin/mysides add Movies file:///Users/$3/Movies"
su - $3 -c "/usr/local/bin/mysides add Music file:///Users/$3/Music"
su - $3 -c "/usr/local/bin/mysides add Pictures file:///Users/$3/Pictures"
su - $3 -c "/usr/local/bin/mysides add $3 file:///Users/$3"
touch /Users/$3/.sidebarshortcuts
fi
Hi, I'm a new here so please forgive me a stupid question :) I created mysides files, put it to usr/local/bin, wrote script and no idea why it doesn't work when I created pkg file in Composer (version 9.82). If I run script in terminal separately with sudo name_of_script.sh, put password, everything is ok. Below my settings in Composer and script code below:
Composer:
mysides file attribute
owner: user
group: wheel
Attributes of folders without change
Script type: postinstall
#!/bin/sh
if [ -e "/Users/$SUDO_USER/.sidebarshortcuts" ]
then
mysides add Music "file:///Users/$SUDO_USER/Music"
mysides add Movies "file:///Users/$SUDO_USER/Movies"
mysides add $SUDO_USER "file:///Users/$SUDO_USER"
touch /Users/$SUDO_USER/.sidebarshortcuts
fi
@plawrence maybe you have a simple solution... :)
Thank You in advance for your help.
@maziboss How/when are you running your script, do you have it as part of a policy triggering on Login? My example above it part of a login script, which is why I use the $3 variable, it puts the current username into that variable. I also make use of the 'su' command to run the mysides binary as the user (rather than root).
@plawrence
I don't know why your script doesn't work. Probably the problem is the $3 variable.
I made a policy with mysides file (dmg) and this script (disable if...):
#!/bin/bash
USERS=$(dscl . -list /Users | grep -v _ | grep -v root | grep -v nobody | grep -v daemon | grep -v Shared | grep -v hadmin)
for dir in $USERS
do
echo "$dir"
#if [ ! -e /Users/${dir}/.sidebarshortcuts ]
#then
echo "Adding Sidebar Shortcuts"
su - "$dir" -c "/usr/local/bin/mysides add Movies file:///Users/${dir}/Movies"
su - "$dir" -c "/usr/local/bin/mysides add Music file:///Users/${dir}/Music"
su - "$dir" -c "/usr/local/bin/mysides add Pictures file:///Users/${dir}/Pictures"
su - "$dir" -c "/usr/local/bin/mysides add ${dir} file:///Users/${dir}"
touch /Users/${dir}/.sidebarshortcuts
#fi
done
and everything works correctly.
To check polisy, in terminal I used the command: sudo jamf policy -trigger Login
Hi guys,
I've got mysides working by calling it from a Launch Agent. What I'd like to do is to remove All My Files.
I've got the script as an at Login Policy in the JSS and its doing a job but not totally. Below is what I'm doing to clear out the sidebar but All My Files remains. I got the file path addresses using the information found when you type "mysides list" into Terminal.
This is how it looks at the moment:
#!/bin/bash
USERS=$(dscl . -list /Users | grep -v _ | grep -v root | grep -v nobody | grep -v daemon | grep -v Shared | grep -v hadmin)
for dir in $USERS
do
echo "$dir"
#if [ ! -e /Users/${dir}/.sidebarshortcuts ]
#then
echo "Adding Sidebar Shortcuts"
su - "$dir" -c "/usr/local/bin/mysides remove All My Files file:///System/Library/CoreServices/Finder.app/Contents/Resources/MyLibraries/myDocuments.cannedSearch/"
su - "$dir" -c "/usr/local/bin/mysides remove iCloud x-apple-finder:icloud"
su - "$dir" -c "/usr/local/bin/mysides remove AirDrop nwnode://domain-AirDrop"
su - "$dir" -c "/usr/local/bin/mysides remove Movies file:///Users/${dir}/Movies"
su - "$dir" -c "/usr/local/bin/mysides remove Music file:///Users/${dir}/Music"
su - "$dir" -c "/usr/local/bin/mysides remove Desktop file:///Users/${dir}/Desktop"
su - "$dir" -c "/usr/local/bin/mysides remove Documents file:///Users/${dir}/Documents"
su - "$dir" -c "/usr/local/bin/mysides remove Downloads file:///Users/${dir}/Downloads"
su - "$dir" -c "/usr/local/bin/mysides remove All My Files file:///System/Library/CoreServices/Finder.app/Contents/Resources/MyLibraries/myDocuments.cannedSearch/"
su - "$dir" -c "/usr/local/bin/mysides insert ${dir} file:///Users/${dir}"
touch /Users/${dir}/.sidebarshortcuts
#fi
done
All My Files is the only one that won't disappear - could it be because the file path is referencing a System folder location or that the file path points to a location inside an app bundle (Finder)?
Any ideas to kill off AirDrop @maziboss?
Hi @sancheeto
MySides requires that you use quotation marks when handling spaces in the Shortcut name. So instead of using All My Files, try "All My Files" instead. To remove AirDrop use domain-AirDrop instead of just AirDrop. Hope this helps.
I saw this forum entry and wanted something to know about the sfl files but unfortunately I found nothing in google. So I just searched on my system to configure those favorites easly and I found something...
In /usr/bin/ there is a tool named "sfltool", there is no man page and it was hard to get the commands working but I did it.
In my case it justs adds a sidebar item or a favorite network share, I have no idea how to restore or delete one.
sidebaritem: /usr/bin/sfltool add-item com.apple.LSSharedFileList.FavoriteItems file:///"pathtofolder"
favorite networkshare: /usr/bin/sfltool add-item -n “Displayname” com.apple.LSSharedFileList.FavoriteServers “Serverpath”
there is also a restore command "sfltool restore" I have no idea how it works but maybe someone else takes a look into that
nice find @jayd.ch
frogor aka mikeymikey aka pudquick aka .... does he go by any thing else?
anyways, he made this which may be helpful:
https://gist.github.com/pudquick/b85fcfd4a0479810e6aa
@mattm Heres what I went with in the end. I had to escape the spaces for All My Files rather than use quote marks.
#!/bin/bash
USERS=$(dscl . -list /Users | grep -v _ | grep -v root | grep -v nobody | grep -v daemon | grep -v Shared | grep -v hadmin)
for dir in $USERS
do
echo "$dir"
#if [ ! -e /Users/${dir}/.sidebarshortcuts ]
#then
echo "Adding Sidebar Shortcuts"
su - "$dir" -c "/usr/local/bin/mysides remove All My Files file:///System/Library/CoreServices/Finder.app/Contents/Resources/MyLibraries/myDocuments.cannedSearch/"
su - "$dir" -c "/usr/local/bin/mysides remove iCloud x-apple-finder:icloud"
su - "$dir" -c "/usr/local/bin/mysides remove domain-AirDrop nwnode://domain-AirDrop"
su - "$dir" -c "/usr/local/bin/mysides remove Movies file:///Users/${dir}/Movies"
su - "$dir" -c "/usr/local/bin/mysides remove Music file:///Users/${dir}/Music"
su - "$dir" -c "/usr/local/bin/mysides remove ${dir} file:///Users/${dir}"
su - "$dir" -c "/usr/local/bin/mysides add ${dir} file:///Users/${dir}"
su - "$dir" -c "/usr/local/bin/mysides add Desktop file:///Users/${dir}/Desktop"
su - "$dir" -c "/usr/local/bin/mysides add Documents file:///Users/${dir}/Documents"
su - "$dir" -c "/usr/local/bin/mysides add Downloads file:///Users/${dir}/Downloads"
su - "$dir" -c "/usr/local/bin/mysides add Movies file:///Users/${dir}/Movies"
su - "$dir" -c "/usr/local/bin/mysides add Music file:///Users/${dir}/Music"
su - "$dir" -c "/usr/local/bin/mysides add Pictures file:///Users/${dir}/Pictures"
# add a folder for inclusion in the sidebar and also the Dock by calling dockutil
mkdir /Users/Shared/Workspace
# make the new folder writable by anyone
chmod 777 /Users/Shared/Workspace
# add new folder to the sidebar
su - "$dir" -c "/usr/local/bin/mysides add Workspace file:///Users/Shared/Workspace"
# add folder to th end of the Dock replacing the default Downloads folder
/usr/local/bin/dockutil --add '/Users/Shared/Workspace/' --replacing 'Downloads' --allhomes
touch /Users/${dir}/.sidebarshortcuts
#fi
done
I scrapped the idea of the Launch Agent and use the Once per User per Computer @ login trigger in the JSS and attached this as an "After" script. Everything works well for Yosemite and El Capitan.
Mysides has been really good but I'm also going to check into @jayd.ch s find as it looks very interesting.
@jayd.ch Is there a way to use com.apple.LSSharedFileList.FavoriteItems to work on a network share?
@chrisbju Perfect. Thanks!!!
@shu Yes you can do it, first you need to check if the specific network share is mounted, then you can use "file:///Volumes/"mounted network share name"/path/to/folder" at the end of the command
And if you unmount the network share and if you click on the sidebar item it should prompt the login window for the network share or the folder if you saved your password in your keychain. First I was concerned about this because it uses a local path, but if you remount a network share via sidebar item it knows the server path somehow..
@jayd.ch It seems that /usr/bin/sfltool add-item will happily create duplicates in the Favorite Servers list.
But apparently we can use the dump-storage option first, to check whether the item already exists:
#!/bin/sh
/usr/bin/sfltool dump-storage ~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.FavoriteServers.sfl | awk '{print $NF}' | sort -u | sed -ne 's/^URL://p'
You must first connect to your network share (in this case we were connecting to a network share) for this to work:
sfltool add-item com.apple.LSSharedFileList.FavoriteItems file:///Volumes/NameOfShare
Working in 10.11.6
Does anyone know how I can remove all my favorites from my Finder Sidebar quickly?
At work I use the sidebar to store where the job lives on our server, I work on some 20 jobs a day, I never have deleted any, now my finder is supper sluggish, I think it is because of the hundreds and hundreds of favorites in my sidebar. I don't want to turn my sidebar off, all I want to do is delete all favorites in one step, and now having to right click on each one saying to remove.
I may post this other areas, since I'm eagerly wanting a solution, my last resort will be to create a new user.
@tjb2 Are you talking about sidebar items under Favorites, like Documents? Or does this include servers? Personally I've not heard of issues with the Finder related to having too many favorites.
We use mysides for quickly removing all sidebar favorites. A mysides remove all
will do the trick.