0

Is it at all possible to create a DMG file which will run a few terminal commands when opened? These are examples for the commands:

  1. create a new folder with specific name.
  2. Place it in a specific location.
  3. Download a few files from my server and save them into that new folder.

What I've done:

I've created a file which include a basic script to create a new folder on my desktop and named it file.command and then opened my terminal and typed chmod +x file.command and then double clicked the file and it ran.

But I don't like this process. I want to be able to bundle a few processes in a DMG file so I can distribute that to my colleagues who are not the tech savvy. And they can simply run that DMG file and it executes a few scripts for them.

Now I'm not sure whether this is at all possible because I have never tried this. So I'm looking for some advice.

2

I’m not aware of any autorun mechanism inside DMGs. You’re describing a scenario, however, which could probably be solved using a package installer. Packages can have file and folder payloads and may also contain pre and post installation scripts which are automatically executed as part of the installation process.

Have a look at this freeware tool which allows you to comfortably create packages using the GUI: http://s.sudre.free.fr/Software/Packages/about.html

  • Thank you for this. I didn't know you could use packages. Again Thanks! – Skywalker Sep 18 '17 at 7:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .