Script to uninstall Box Sync

royjovero
New Contributor II

Hi all,

A client of mine would like to have a script, or series of scripts, created to uninstall Box Sync from all computers in preparation of switching to Box Drive. Here are the uninstall instructions per Box

Follow the steps on how to uninstall Box sync in Mac.

  1. If Box Sync is currently running, you will see a b in the upper right hand corner
  2. Click on the b and select Quit
  3. Click on your background of your computer
  4. Click on the ""Go"" in the upper left hand toolbar
  5. Click on Home
  6. Change the title of ""Box Sync"" to ""Box Sync (OLD)""
  7. Move the Box Sync (OLD) folder to your Desktop
  8. Close the window
  9. Navigate to the Library folder in your User profile Click on the ""Go"" in the upper left hand toolbar Hold the Alt/Option key on your keyboard and select Library']}
  10. In the library folder, delete the items below: Macintosh HD/Users/[username]/Library/Logs/Box/Box Sync/ Macintosh HD/Users/[username]/Library/Application Support/Box/Box Sync/
  11. Navigate to your HD library Click the magnifying glass in your upper right corner of the screen In the Spotlight Search, type ""HD"" Select ""Macintosh HD"" Click ""Library""
  12. Delete these items in this library: Macintosh HD/Library/PrivilegedHelperTools/com.box.sync.bootstrapper Macintosh HD/Library/PrivilegedHelperTools/com.box.sync.iconhelper
  13. Close this finder window

Does anyone have input on how to best achieve this? Thanks in advance!

9 REPLIES 9

Asnyder
Contributor III

Please test this as we don't use the application so I don't have a way to test it.

#!/bin/bash

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

#quit box sync
sudo pkill boxsync
#Copy old data
cp "/Users/$loggedInUser/Box Sync" "/Users/$loggedInUser/Desktop/Box Sync (OLD)"

# Remove old Files
rm -rf "/Users/$loggedInUser/Library/Logs/Box/Box Sync/"

rm -rf "/users/$loggedInUser/Library/Application Support/Box/Box Sync/"

rm -rf "/Library/PrivilegedHelperTools/com.box.sync.bootstrapper"

rm -rf "/Library/PrivilegedHelperTools/com.box.sync.iconhelper"

royjovero
New Contributor II

Executing Policy Uninstall Box Sync
Running script Uninstall Box Sync...
Script exit code: 0
Script result: cp: /Users/royjovero/Box Sync is a directory (not copied).

Asnyder
Contributor III

@royjovero change that one to cp -R instead of just cp

royjovero
New Contributor II

@Asnyder

Executing Policy Uninstall Box Sync
Running script Uninstall Box Sync...
Script exit code: 0
Script result: Submitting log to https://casper.itjones.com:8443/

Asnyder
Contributor III

@royjovero Looks like it worked then. Just make sure everything happened on the client machine that should have.

dcgagne
Contributor

In light of Box Drive slowly becoming the de facto client software, I wanted to add a bit to this thread.

Box Drive throws up a warning if Box Sync is installed, even when deployed via Self Service/Jamf. I made some modifications to the above script to completely kill and remove Box Sync because some things appear to have changed since it was created. For my environment, we don't touch the Box Sync folder to prevent any data loss or panicking, but I left it to keep things consistent

#!/bin/bash

#Set the variable for the currently logged in user
loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

#Quit Box Sync
killall "Box Sync"

#Copy old user data. Change cp to mv if you prefer to move it
cp "/Users/$loggedInUser/Box Sync" "/Users/$loggedInUser/Desktop/Box Sync (OLD)"

# Remove old Box Sync application data
rm -rf "/Applications/Box Sync.app"

rm -rf "/Users/$loggedInUser/Library/Logs/Box/Box Sync/"

rm -rf "/users/$loggedInUser/Library/Application Support/Box/Box Sync/"

rm -rf "/Library/PrivilegedHelperTools/com.box.sync.bootstrapper"

rm -rf "/Library/PrivilegedHelperTools/com.box.sync.iconhelper"

In my testing/pilot, the Box Drive app is deployed through Self Service with the script running before. No errors from the uninstall/install, and data is intact.

donmontalvo
Esteemed Contributor III

@dcgagne might want to dump the receipts, by adding to your script something like:

boxReceipts=$(pkgutil --pkgs=<receiptName>*)
for r in $boxReceipts;
do
    pkgutil --forget "$r"
done
--
https://donmontalvo.com

sam_g
Contributor
Contributor

The next version of Box Drive's installer will include a way to automatically uninstall Box Sync. Info here: https://community.box.com/t5/Getting-Started-with-Box-Drive/Uninstalling-Box-Sync-Using-the-Box-Drive-Installer/ta-p/66249?

donmontalvo
Esteemed Contributor III

@float0n wow thanks for the heads up, looks like they're thinking like enterprise folks. :)

--
https://donmontalvo.com