Execute Shell scripts on macOS devices with Scalefusion

In Mac ecosystem, Shell scripts are a useful tool to perform system-level tasks, finding patterns in a file, processing the data in a file based on the user inputs, etc. With shell scripts you can combine many common tasks into one script, saving you time and possible errors when performing similar tasks over and over.

Moving a step forward towards enhancing Device Management of Mac devices, Scalefusion MDM enables uploading shell script files and then executing those scripts remotely on Scalefusion managed Mac devices.

This document describes how Shell scripts can be uploaded and deployed on managed Mac devices.


  1. Create a Mac Device Profile
  2. The devices should have Mac version 10.14 and above
  3. Mac Devices should be enrolled with Scalefusion
  4. Scalefusion - MDM Client is installed on the enrolled Mac device
  5. Make sure that you have required storage in Enterprise Store. To know more about space allocation, please visit here.
  6. Enterprise App package and the following details from the developer,
    1. shell script (.sh) file
    2. File size should be less than 2GB

Uploading and Installing a Shell script

Follow the steps below to upload and install a Shell script,

  1. Sign In to Scalefusion Dashboard. Navigate to Application Management > Enterprise Store
  2. Click on Upload New App > Upload macOS App
  3. In the Upload macOS app window, choose Upload Shell script to upload .sh file that will execute the script.
  4. This will open the Upload Shell Scripts wizard. Follow the steps below to upload the file.
    1. Enter Script Name: This is used for identification inside Device Profiles
    2. Upload Scripts File: Select how you want to upload the script file,
      1. Upload Local File: Use this option if you have the .sh file available locally.
      2. Shell Script URL: Use this option if you have hosted/uploaded the file on your servers and have a link that is accessible publicly. Provide the URL to the externally hosted file. This URL should be publicly available.
    3. Run Script as signed-in user: Select whether the script has to be run as signed in user or not:
      1. Yes (default): Permissions of the logged in user will be used at the time of script execution.
      2. No: The script will be executed at the root level.
    4. Click Save
  5. Once you click on SAVE, Scalefusion will process the script and if the processing succeeds then the following dialog will be shown. Here you can select the Device Profiles where you want to publish the script and click Publish

Checking Execution Status

After publishing, you can check the status whether the shell script pushed from enterprise store has been executed or not, by using the View Status option,

A script that is well executed on the device, shows the status as Executed and if not then the status shows as Pending or Execution Failed.

On Device

The shell script executed will reflect on the device. As for example, in the above step we have uploaded and published a script to add user. On the enrolled device, you will find the added user under Users & Groups.

Uninstalling Shell Script

Shell scripts can be uninstalled from the devices remotely. Follow the steps below to Uninstall a previously deployed script,

  1. Navigate to Application Management > Enterprise Store
  2. Click on the Shell script that you uploaded earlier to see the script information wizard, Click on Uninstall
  3. Select the Device Profiles where you want to uninstall the application from and click on UnInstall
  4. Once this step is done, the script will no longer be force installed and executed on the devices. However the users need to Uninstall the application on the device.

Deleting Shell Script

A Shell script file can also be deleted. It deletes the script file from Enterprise Store on Scalefusion Dashboard as well as from device. To delete a script file,

  1. In the script information wizard, Click on Delete button
  2. You will get a confirmation box. Click OK

How did we do?

Powered by HelpDocs (opens in a new tab)