pr0crstnation101
pr0crstnation101

Reputation: 37

How can I install a plugin on Mac programmatically?

I need to install a plugin on a Mac programmatically. I know a plugin can be installed by simply copying the .plugin file to the Internet Plug-ins folder, but since you need to enter a password to write to that folder, I have not been able to do it programmatically. Is there any other way to install a plugin on a Mac? Or is there a way to get around the password for the plugins folder?

Upvotes: 1

Views: 453

Answers (1)

l'L'l
l'L'l

Reputation: 47229

I would recommend using productbuild to create an Installer package.

Typically it's the standard way of installing something needing elevated privileges in OS X. It's also easy for the end user too; Someone who downloads your installer package would simply double click on the icon, enter their administrator password and everything else would be taken care of by the installer.

How It Works

Your plugin for example would be archived into into a .pkg as part of a payload that also contains parameters such as where it needs to be installed, and the appropriate permissions which it requires. It can even include installer plugins, execute additional scripts during the installation process, or contain instructions/readme.

Using the commandline version of productbuild can seem a little daunting at first, although once you create your first installer you should have a better understanding of the process. Fortunately there's a nice application built on top of the Apple productbuild tool called Packages, which makes productbuild easier to work with and is entirely free — which I highly recommend.

In short, this is just one way to get the job done — but most importantly very practical and widely used.

Upvotes: 1

Related Questions