Is it possible to execute the package (located in FTP) from terminal of Mac
Shell script: curl &amp; installer

If you can host the package on a web site, the installation can be reduced to the following two commands.


Download the file to the local computer:

/usr/bin/curl https://www.example.com/mypackage.pkg &gt; /tmp/mypackage.pkg

Install the downloaded file:

/usr/sbin/installer -pkg /tmp/mypackage.pkg -target /



You can combine these commands in a text file called install-mypackage.command:

#!/bin/bash

/usr/bin/curl https://www.example.com/mypackage.pkg &gt; /tmp/mypackage.pkg
/usr/sbin/installer -pkg /tmp/mypackage.pkg -target /
/bin/rm /tmp/mypackage.pkg


When the .command file is opened by the user, the package will be downloaded and installed.

This approach assumes:


The software is distributed as a flat .pkg file.
You can host the package somewhere privately.


Using sftp instead of curl

If your files are hosted on a Secure File Transfer Protocol (sftp) server, use the sftp client. To script the client, use a batch file or follow answers to Single Line sftp from Terminal.

Improvements

Please note this script has no error checking. Consider this script a starting point for your own script.

You could add a password to your web site and then use a URL with the credentials embedded, such as https://username:password@www.example.com/mypackage.pkg.

Given you have ssh access to the computers, you could run this script or commands remotely.