- Print
- DarkLight
Install the Backblaze Client Silently (Mac)
- Print
- DarkLight
For Apple's line of macOS operating systems, pushing an application to hundreds of users generally involves a mountable DMG file that contains an installer package. The Backblaze Computer Backup Installer for macOS works similarly. There are a few unique steps to deploy the client silently.
Decentralized Deployment (User-Managed Account)
The email parameter that is passed by the script must be unique to each user who is related to the endpoint at runtime.
Decentralized deployments involve an account for each endpoint that is then part of the business group that manages payment and admin activity (if enabled). In this scenario, the end user has access to their own data through the Backblaze portal.
Centralized Deployment (IT Managed Account)
The primary email will be hardcoded because it stays static.
Centralized deployments mean that every endpoint is logged into a primary Backblaze account that is managed by IT. In this scenario, the end user does not have access to their data on Backblaze and they must contact the manager of that centralized account. These deployments are quite simple because the email that is passed to the installer does not change per endpoint.
Use the Installer through the Command-Line Interface
Before you begin: You must have the following prerequisites.
- Mac OS 10.9 or newer
- An active Backblaze Group
- Either a static, centralized IT email or a dynamic email that is related to the particular deployment
- The value
region
is optional and can be used for deployments that must specify the region to which an email account will be deployed. Values are either us-west, us-east, or eu-central. - A
groupID
and agroupToken
These two values are used as authentication to log in after the email parameter. The script fails to deploy if the email account is not a user within the Group. You can retrieve these from your Backblaze portal.
Retrieve your groupID and groupToken
- Sign in to your Backblaze account.
- In the left navigation menu under Business Group, click Group Management.
- Navigate to the appropriate Group, and click Send Invites.
- Click Advanced Instructions.
The two parameters at the end of the command are your groupID and groupToken values, respectively.
Backblaze Installer
You can find the most current version of the macOS installer here: https://secure.backblaze.com/mac/install_backblaze.dmg.
The macOS package is controlled through the following parameters that you pass through Terminal.
Sign In Account Mode
Use the following command for deployments that involve a user who does not yet have a Backblaze account. You must enter values for <email>, <groupID>, and <groupToken>.
sudo /Volumes/Backblaze\ Installer/Backblaze\ Installer.app/Contents/MacOS/bzinstall_mate -nogui -createaccount_or_signinaccount <email> <groupid> <grouptoken>
Create Account Mode with Region
Use the following command for deployments that involve a user who already has a Backblaze account and is part of the group. You must enter values for <email>, <groupID>, and <groupToken>. The <region> parameter is optional.
sudo /Volumes/Backblaze\ Installer/Backblaze\ Installer.app/Contents/MacOS/bzinstall_mate -nogui -createaccount_or_signinaccount <email> <groupid> <grouptoken> <region>
Update Mode -silentupgrade
Use the following command for deployments that involve a user who already has Backblaze installed and only needs an update.
sudo /Volumes/Backblaze\ Installer/Backblaze\ Installer.app/Contents/MacOS/bzinstall_mate -silentupgrade bzdiy
Use a Shell Script
The shell script makes interfacing with the commands you saw in the previous section easier. If you use the script, you can dynamically complete the following workflows:
- Automatically handle both new account deployments (-createaccount) and existing account deployments (-signin) without the need to dictate ahead of time per deployment
- Upgrade deployments that already have the software installed and running
- Handle Jamf Pro environments that need to use a decentralized deployment
Click here to expand the macOS script.
#!/bin/bash
############### Backblaze Variables ###############
# Default values (can be overridden by command-line arguments)
group_id=""
group_token=""
email=""
region="" # Specify if account is to be deployed in specific region [us-west or eu-central]
# BZERROR MEANINGS
# BZERROR:190 - The System Preferences process is running on the computer. Close System Preferences and retry the installation.
# BZERROR:1000 - This is a general error code. One possible reason is that the Backblaze installer doesn't have root permissions and is failing. Please see the install log file for more details.
# BZERROR:1016/1003 - Login Error... Email account exists but is not a member of indicated Group, Group ID is incorrect, or Group token is incorrect,
################ FUNCTIONS #########################
function update_backblaze {
return=$(sudo /Volumes/Backblaze\ Installer/Backblaze\ Installer.app/Contents/MacOS/bzinstall_mate -silentupgrade bzdiy)
}
function signin_backblaze {
return=$(sudo /Volumes/Backblaze\ Installer/Backblaze\ Installer.app/Contents/MacOS/bzinstall_mate -nogui -createaccount_or_signinaccount "$email" "$group_id" "$group_token")
}
function create_region_account {
return=$(sudo /Volumes/Backblaze\ Installer/Backblaze\ Installer.app/Contents/MacOS/bzinstall_mate -nogui -createaccount_or_signinaccount "$email" "$group_id" "$group_token" "$region")
}
function email_validation {
[[ "$email" =~ ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$ ]]
rc=$?
if [ "$rc" != "0" ]; then
echo "Failed to retrieve valid email address. Parsed Email: [ $email ]"
echo "Please make sure variables are set"
exit 1
else
echo "Email: [ $email ] seems to be a valid email address"
echo "Continuing with install"
if
}
function success_exit {
echo "Unmounting Installer..."
diskutil unmount /Volumes/Backblaze\ Installer
echo "Cleaning up..."
rm install_backblaze.dmg
exit 0
}
function failure_exit {
echo "Unmounting Installer..."
diskutil unmount /Volumes/Backblaze\ Installer
echo "Cleaning up..."
rm install_backblaze.dmg
exit 1
}
function kill_syspref {
killall -KILL System\ Preferences > /dev/null 2>&1
}
function set_directory {
cd "$HOME" || { echo "Failed to cd to user directory"; exit 1; }
}
function download_backblaze {
echo "Downloading latest backblaze client..."
curl -s -O https://secure.backblaze.com/mac/install_backblaze.dmg
}
function mount_backblaze {
echo "Mounting Installer..."
hdiutil attach -quiet -nobrowse install_backblaze.dmg
}
###################################################
set_directory "$@"
download_backblaze
mount_backblaze
# Parse command-line arguments
while getopts "g:t:e:r:" opt; do
case $opt in
g) group_id="$OPTARG" ;;
t) group_token="$OPTARG" ;;
e) email="$OPTARG" ;;
r) region="$OPTARG" ;;
\?) echo "Invalid option -$OPTARG" >&2; exit 1 ;;
esac
done
# Validate email exists
email_validation
# Kill System Preferences process to prevent related BZERROR
kill_syspref
# Check to see if Backblaze is installed already, if so update it. Else continue as planned.
if open -Ra "Backblaze" ; then
echo "Backblaze already installed, attempting to update"
update_backblaze
if [ "$return" == "BZERROR:1001" ]; then
echo "Backblaze successfully updated"
success_exit
else
# Try upgrade again in case there was a file lock on the mounted dmg causing errors
update_backblaze
if [ "$return" == "BZERROR:1001" ]; then
echo "Backblaze successfully updated"
success_exit
else
echo "Backblaze was already installed but failed to update"
failure_exit
if
if
else
echo "Confirmed Backblaze isn't installed already, continuing with deployment..."
if
echo "Trying to sign in account"
if [ "$region" == "" ]; then
signin_backblaze
if [ "$return" == "BZERROR:1001" ]; then
echo "Backblaze successfully installed, $email signed in..."
success_exit
else
signin_backblaze
if [ "$return" == "BZERROR:1001" ]; then
echo "Backblaze successfully installed, $email signed in..."
success_exit
else
echo "Failed to install Backblaze, errorcode: $return"
failure_exit
if
if
else
create_region_account
if [ "$return" == "BZERROR:1001" ]; then
echo "Backblaze account successfully created in $region, $email signed in..."
success_exit
else
echo "Failed to install Backblaze, errorcode: $return"
failure_exit
if
if
Use the Shell Script to Silently Deploy
Before you run the script, you must hard code a few values depending on the type of deployment you need:
username="$3" groupid="$4" grouptoken="$5" email="$6" region="$7"
The $3-$7 variables are used for Jamf Pro deployments. If you are not using Jamf Pro, replace those variables with strings.
- (Required) username=
"username"
sets the directory to the proper user to prevent RMM tools from having Backblaze stuck in its working directory. - (Required) groupid="
groupID
" - (Required) groupToken="
groupToken
" - (Required) email="
email
" - (Optional) region="
region
"
The script automatically runs an update on any endpoint if it finds that Backblaze is already installed.
Troubleshooting
BZERROR:1001
message.The following output error codes indicate potential issues:
BZERROR:190
The System Preferences process is running on the computer. Close System Preferences, and retry the installation. (This should not appear because the script should be closing.)BZERROR:1000
This is a general error code. One possible reason is that the Backblaze Installer does not have root permissions, and it is failing. See the install log file for more details.BZERROR:1016
The intended email address already has a Backblaze account, the group ID is incorrect, or the group token is incorrect.
The (remote) computer's Backblaze install log is located in: /Library/Backblaze.bzpkg/install_log/install_logNN.log
, in which NN
represents the two-digit number that corresponds to the day of the month of the installation (for example, install_log08.log).
If you are unable to successfully install or you see a different error, contact the Support team. Provide Support with the install log from the computer for which you attempted a silent installation.
If you have more questions, contact the Backblaze Business Account team.