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.
Prerequisites
- Create a Mac Device Profile
- The devices should have Mac version 10.14 and above
- Mac Devices should be enrolled with Scalefusion
- Scalefusion - MDM Client is installed on the enrolled Mac device
- Make sure that you have required storage in Enterprise Store. To know more about space allocation, please visit here.
- Enterprise App package and the following details from the developer,
- shell script (.sh) file
- File size should be less than 2GB
Uploading and Installing a Shell script
Follow the steps below to upload and install a Shell script,
- Sign In to Scalefusion Dashboard. Navigate to Application Management > Enterprise Store
- Click on Upload New App > Upload macOS App
- In the Upload macOS app window, choose Upload Shell script to upload .sh file that will execute the script.
- This will open the Upload Shell Scripts wizard. Follow the steps below to upload the file.
- Enter Script Name: This is used for identification inside Device Profiles
- Upload Scripts File: Select how you want to upload the script file,
- Upload Local File: Use this option if you have the .sh file available locally.
- 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.
- Run Script as signed-in user: Select whether the script has to be run as signed in user or not:
- Yes (default): Permissions of the logged in user will be used at the time of script execution.
- No: The script will be executed at the root level.
- Click Save
- 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,
- Navigate to Application Management > Enterprise Store
- Click on the Shell script that you uploaded earlier to see the script information wizard, Click on Uninstall
- Select the Device Profiles where you want to uninstall the application from and click on UnInstall
- 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,
- In the script information wizard, Click on Delete button
- You will get a confirmation box. Click OK