Category filter

Script to deploy ZIP file to Macs using a URL

Jump To

In enterprise environments, IT administrators often need to deploy applications to a large number of macOS devices. One way to accomplish this is by creating a ZIP file of the application and distributing it to the devices through a download URL. In this context, a script to deploy a ZIP file can automate the deployment process which saves time and effort for administrators. Use Hexnode’s Execute Custom Script feature to deploy the script that downloads the ZIP file and its extracted content on the devices using a download URL.

Scripting Language – Bash

File extension – .sh

Disclaimer:


The sample scripts provided below are adapted from third-party open-source sites.

Deploy ZIP file

The below script downloads the ZIP folder and unzips its contents on the device.

The cd /tmp command changes the current working directory to the /tmp directory, and curl -k makes an HTTP request to download data from a URL.

[Download_URL]: Replace this with the server URL that contains the ZIP file. For example, https://example.com/myapp.zip.

[FOLDER_NAME].zip: Specify the name of the ZIP file in the URL. For example, myapp.zip.

After the execution of the script, the ZIP file, along with its extracted content, will be downloaded to the device’s /tmp directory. To navigate to this directory, please follow these steps on the device:

  1. Open Finder by clicking on the Finder icon in the Dock or searching for it in Spotlight.
  2. In the Finder menu, click on “Go” and select “Go to Folder”.
  3. In the “Go to Folder” dialog box, type /tmp and press “Enter”. This will open the /tmp folder in Finder.
  4. The user must navigate to the /tmp folder, identify the installer and install the app manually.

Here is an example script:

Notes:

  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository