What is the best way to test an install script on macOS?

I have written an installation script so that others can easily install the program qme-ng which I forked and am working on.

However testing the script is very hard. I can manually uninstall all the dependencies, Boost and gmp, each time and see whether my script can properly reinstall them but it is very costly. Furthermore I'm worried about the possibility of dependency removal that isn't complete which can complicate the issue.

  • 3
    Get macOS running in a VM :-) – nohillside Jun 22 '18 at 20:53
  • @nohillside Sure! Well, I thought about that before..does that cost any extra money? – Ying Zhou Jun 22 '18 at 21:08
  • 1
    Depends on the VM software you use. VirtualBox is free, Parallels/VMware cost something – nohillside Jun 23 '18 at 7:46
  • 1
    @nohillside Partially incorrect. The full version of Parallels costs but in the App Store there is “Parallels Lite” which is free. Parallels lite can run macOS and Linux free, just can’t run Windows free. – JBis Jun 25 '18 at 11:50
  • 1
    @jbis indeed, the restrictions are amazingly small kb.parallels.com/en/123796 – nohillside Jun 25 '18 at 17:23

Your best bet is to create a macOS VM for testing. Install VirtualBox (it's free), create a macOS virtual machine, and then create a snapshot before testing your script. Once you've finished testing your script you can restore the VM to its previous, unmodified state using the snapshot feature. Hope this helps!

  • 1
    +1 Great idea with the snapshot! – JBis Jun 25 '18 at 11:51
  • I can confirm that this method works beautifully with VirtualBox. I am creating an installation script to automate the creation of a desktop environment for FreeBSD 11 and the snapshot feature works great for resetting back to an initial state. – Allan Jun 25 '18 at 12:34

You must log in to answer this question.

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