简体   繁体   中英

How can I install a plugin on Mac?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM