Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Is there any possibility to create a unattended installation of an pkg package?

E.g. creating a mpkg and running a script which installed the package via console and installer.

Background: I had to deploy a package to many osx enduser. We have no apple desktop and no root access to these machines. these is an preconfigured pkg package, but if the user launch it in normal way, the pre configuration will be overwritten. On windows I realize this with an selfexecutable archive which launches an msi with silent installation. On linux I build rpm/deb packages but on osx I didn't find any proper way :(

share|improve this question
add comment

3 Answers 3

Short Answer: yes.

Long Answer: Yes, but…a full answer to this question includes a technical answer and a practical concern.

First, the technical answer

You can install a .pkg or .mpkg using this syntax:

sudo installer -verboseR -pkg "/path/to/pkg/foo.mpkg"

If the installer isn't 'signed' properly, you'll need to add -allowUntrusted

sudo installer -allowUntrusted -verboseR -pkg "/path/to/pkg/foo.mpkg"

You may also need to specify where you want it installed, using -target / (I'm not 100% certain this is required, but it's a good idea):

sudo installer -allowUntrusted -verboseR -pkg "/path/to/pkg/foo.mpkg" -target /

Now, the problem is that sudo is going to ask you for your administrator password when you try to run installer. If you want to automate this, you need to tell your Mac not to require your sudo password when running the installer. To do that, you can add this line to your /etc/sudoers file:

%admin ALL=NOPASSWD: /usr/sbin/installer

See man visudo for instructions on editing that file.

Second, the practical concern

If you are the only person who uses your Mac, adding the above line to /etc/sudoers is not a big deal.

However, if this is a shared Mac, then other people who are in the 'admin' group will be able to run /usr/sbin/installer without being prompted for their password.

Also, obviously if someone gets into your 'admin' account, they too could, theoretically, cause mischief with /usr/sbin/installer. Although I am at a loss to think of exactly what they would do, it's a trade-off of security versus convenience.

Third, a github script

I wrote pkginstall.sh to do some nice things like log the process, as well as tell you whether or not you are supposed to reboot after installing the package.

Last but not least: Automate "how?"

As far as how you want to automate the installation, that depends on more specifics of what you are trying to do. You could, for example, make a folder such as ~/Action/AutoInstallPKG/ and tell launchd to install any .pkg or .mpkg files that are added to that folder, and then move it aside afterwards.

I have been meaning to do something like this for a long time, and so I finally put it together. You can find it at https://github.com/tjluoma/autopkginstall. Installation instructions are included at Github, so I won't repeat them here.

share|improve this answer
    
Thx, this is a big step forward for me, but still not the final solution. I have to deploy a package to many different macs (so sudoes isn't an option), where user aren't allowed to change the configuration. So the best way (which works on windows and linux) where a file which the user can click and the rest will done automatically. But i'll check your solution, possible in combination with iceberg or packages I can find a matching solution. So hope this is ok if I leave this question open some more days so others can contribute there answers to... –  Megachip Dec 11 '13 at 23:18
2  
Also, for future reference, details like those would be helpful to include in your initial question. The answer for an end-user looking to automate installations on their system is completely different for someone trying to distribute to many Macs and many OSes. You're not likely to find a way which works the same way on Windows and Linux and Mac OS X. Even companies as big as Dropbox have different installers for each OS. –  TJ Luoma Dec 11 '13 at 23:22
    
You're right, sorry about that. Possible I should add this to the question. –  Megachip Dec 12 '13 at 9:11
    
Thanks again for all your work, I've concrete my question [here]( apple.stackexchange.com/questions/120026/…). Your autopkginstall is a nice thing, but it requires me to have this "installed" on every client, which isn't possible. Looks my question here was not concrete enough. Sorry for that –  Megachip Feb 5 at 20:58
add comment

I think you might be dancing very close to your own answer. You mention that you don't have Apple's Remote Desktop. I would recommend considering it for what you are trying to do. I use it as you are describing all of the time - I have a .pkg file that needs to be installed on multiple computers in my LAN, I highlight the computers I want it installed on, and tell Remote Desktop to install it. It does much more than this, but it WILL do these remote installs for you. It is $80 for a license with unlimited clients.

If the $80 is a sticking point - you could look at munki, which is

"a set of tools that, used together with a webserver-based repository of packages and package metadata, can be used by OS X administrators to manage software installs (and in many cases removals) on OS X client machines."

I have not used it myself, but have a lot of respect for the people coding it and using it in real life. It is a bit more set up and work than Remote Desktop - but has a lot more options as well.

Hopefully you can use one of these two programs to do what you are after.

share|improve this answer
    
Yeah, but far as I know you need root access for using remote desktop? –  Megachip Jan 8 at 12:10
    
You will need administrator access to set up remote desktop on the client machines. ARD will not let you just install files on any mac you see on a network will nilly. :) –  evilblender Jan 8 at 21:30
    
This possibility is not given, sorry. –  Megachip Feb 6 at 15:46
add comment
up vote 0 down vote accepted

Finally, thanks to dr.nixon solution of my concrete question, I've got to handle the creation of an unattended installation as described in the question via Platypus.

User has to start the app, the rest will done automatically.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.