简单 Mac OS 命令行工具的安装程序?
如何为 Mac OS X 命令行工具构建新手可用(可点击下载)的安装程序,以及二进制文件应安装在哪里,以便不了解 shell 路径的新手用户只需打开终端应用程序并输入“ foo”来运行新安装的 foo 工具?
安装程序还可以安装文档以便用户可以键入“man foo”吗?
是否应考虑使用任何其他选项来让 Mac 新手用户可以使用纯命令行(stdin、stdout)工具?
How can I build a novice-usable (clickable download) installer for a Mac OS X command-line tool, and where should the binary be installed so that a novice user with no knowledge of shell paths can just open the Terminal app and type "foo" to run the freshly installed foo tool?
Can the installer also install documentation so that the user can type "man foo"?
Are there any other options that should be considered to make the use of a pure command-line (stdin, stdout) tool accessible to a novice Mac user?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的目标 OS X 的最低版本是什么? 10.6(和 IIRC 10.5)在默认 PATH 中包含 /usr/local/bin,但 10.4 没有。只要您不需要支持 10.4,您就应该将可执行文件放在 /usr/local/bin 中,将手册页放在 /usr/local/share/man/man1 中(或任何适当的章节号)。
为了构建安装程序本身,您可以使用 Apple 的 PackageMaker 实用程序(Xcode 的一部分)。使用 bin 和 share/man/man1 子文件夹创建一个原型本地文件夹,并用您的文件填充它们。在 PackageMaker 中创建一个包项目,然后选择您的组织名称和最低目标操作系统。将原型文件夹拖到项目的内容侧栏中。将目标设置为 /usr/local。切换到“内容”选项卡并编辑安装文件时应使用的所有权和权限(所有者/组可能都是 root/admin,对文件夹和可执行文件使用 rwxrwxr-x 权限,对文件夹和可执行文件使用 rw-rw-r--手册页)。如果有任何不相关的文件(例如.DS_Store)潜入,请将其排除。查看您想要更改的任何其他设置,然后保存项目并构建安装程序。然后对其进行测试,以确保它符合您的预期。
What's the minimum version of OS X you're targeting? 10.6 (and IIRC 10.5) include /usr/local/bin in the default PATH, but 10.4 did not. As long as you don't need to support 10.4, you should just put the executable in /usr/local/bin and the man page in /usr/local/share/man/man1 (or whatever the appropriate chapter number is).
For building the installer itself, you can use Apple's PackageMaker utility (part of Xcode). Create a prototype local folder with bin and share/man/man1 subfolders and populate them with your files. Create a package project in PackageMaker, and choose your organization name and minimum target OS. Drag the prototype folder into the project's Contents sidebar. Set the Destination to /usr/local. Switch to the Contents tab and edit the ownership and permissions the files should be installed with (the owner/group should probably all be root/admin, with rwxrwxr-x perms on the folders and executable, rw-rw-r-- on the man page). If any irrelevant files (e.g. .DS_Store) snuck in, exclude them. Look around for any other settings you want to change, then save the project and build the installer. Then test it, to make sure it does what you expect.