MacOS: where to install global application data with r/w access - macos

To where a pkg installer package on MacOS should install global application data ? All users of this specific system as well as the app itself should have read and write access to this data. Atm I install it to /Library/Application Support/"mycompany"/"MyApp" and modify the permissions. Is this a good practise for all MacOS versions ?
Thank you !
EDIT:
Meanwhile I have tested to r/w access files in this directory on Sierra and Mojave. It works like a charm when I set the permissions in my custom library folder recursively with chmod -R 777 (well, less would be enough).
BTW I do this with a batch post installation shell script in the packages app here. It's a great UI based app (instead of using a bunch of command line tools). Building the pkg can be automated by a single command line: /usr/local/bin/packagesbuild /path/to/the/project.pkgproj, so integration into a flawless workflow is easy.

Yes. The only change I'm aware of related to this was in 10.7 when Apple changed the /Library folder to a hidden directory. (unlisted in finder unless specified) The path remains unchanged.
https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html

Related

Mono.framework is missing on my mac ... but it's... there?

Please help me interwebs.
I'm having trouble getting my xamarin app to work. I've done a reinstall of Mac OS X and installed Xamarin using the installer, which adds mono and all the rest of it.
Now when I open up terminal and type which mono i get
/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono
...which is what I expect.
But when I navigate to that place (again in terminal) there's nothing there.
From my root folder I go "cd System/Library/Frameworks " and then hit ls and I get a looooong list of installed frameworks but no Mono.framework.
If I go to Apple > About this Mac > System Report > Frameworks Mono IS listed. I can execute Mono commands on the command line. If I look in paths.d the specified path for mono is /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono but I can't find that location so how is it even a thing?
My linux skills are not great, can anyone please help me understand what's going on here?
I think you are looking in the 'wrong' Library folder. There are a few different Library folders. There is one under the Disk Drive (root) directory, one under the User directory, one under the System directory. I think they are all hidden by default. So you need to set your folder/view options explicitly to show the Library folder since it might be hidden by default. The directory you are looking for is directly under you Disk Drive (root).

How to include OSXFUSE and SSHFS into my Cocoa app Distribution?

I'm creating a Cocoa Application using SSHFS but I want to make a package installer when user install, it will install OSXFuse and SSHFS to their macbook. How can I do that?
Installing OSXFuse means simply copying several files go global locations, which requires admin privileges. Its not that simple actually, since there's a handful of stuff to copy, but its very doable.
What you need to do is hold a copy of the following files with your app, and copy it to the destination using the installer (you must have it before running your app itself or it may crash).
List of files/folders to copy:
/Library/Frameworks/OSXFUSE.framework
/Library/Filesystems/osxfusefs.fs
/usr/local/include/osxfuse
/usr/local/lib/libosxfuse_i32.2.dylib
/usr/local/lib/libosxfuse_i32.la
/usr/local/lib/libosxfuse_i64.2.dylib
/usr/local/lib/libosxfuse_i64.la
/usr/local/lib/pkgconfig/osxfuse.pc
Note that you will also have to create some symbolic links in /usr/local/lib/ and in /usr/local/lib/pkgconfig/. If you actually get to doing it and need help, let me know.
Using PackageMaker that is rather simple.
In order to get a copy of the mentioned files and folders, you could install OSXFuse and copy it yourself from the mentioned locations.
Reference:
https://github.com/osxfuse/osxfuse/wiki/FAQ#12-what-is-osxfuse-versiondmg

Using productbuild for mac os x app with additional tools and files

For one of my projects i used building script using packagemaker. Packagemaker allows specify all files i need install from root, so my root had following structure:
Applications
My Application.app
Library
Preferences
MyCompanyName
some.xml
another.xml
tmp
default.p12
usr
local
bin
sometool
I.e. it had following features:
Some configuration files preinstalled for all users, to global Preferences (some.xml, another.xml)
Some command line tool being used as by main app as user in /usr/local/bin
Program uses certificates and there is one default certificate which will be moved to right place in postflight
How to do same with productbuild? Possible?
The basic tool that does the packaging you want is pkgbuild, not productbuild. pkgbuild will let you specify a root directory that, upon installation, will be expanded to '/'. So, you can use that for all of what you discuss in your question (though an installer putting something in /tmp is a bit weird - I'd suggest baking the cert right into your postinstall script).

Installer for a simple Mac OS command-line tool?

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?
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.

What is the correct directory layout for a web server under Mac OS X?

I'm packing the Cherokee Web Server, a very very fast webserver with a nice web-based GUI for configuration written by the spanish hacker Alvaro Lopez Herrera and available from http://www.cherokee-project.com.
So far, I've managed to create a .pkg installer using Apple's PackageMaker.app that comes with Xcode but i'm installing everything under /opt/cherokee.
I guess I'd like to have the binaries go to a dir that is already in the path and the same for the manpages and other stuff.
I looks like installing everything with prefix=/usr could work nicely, except for the config files that should go to /etc/cherokee and the document root with could go to /var/www but i'm not sure.
Would that work or should I use some directory structure under /Library? like /Library/Cherokee/VERSION/ ???
Apple's bundled Apache seems to be instaling with prefix=/usr but config files in /etc/apache2 and CGIs and the manual to /Library/WebServer with the document root in /Library/WebServer/Documents.
Maybe my docroot should be /Library/Cherokee/Documents or something like that...
For reference, Cherokee's default layout is like this: (only dirs)
http://pastebin.com/f57bc2d21
Thanks for the help in advance! :)
Do not install it directly in /usr. That's Apple's domain. Though /opt might be okay, it will not be in the default path and is not commonly used as a default installation location for third-party Unix software in Mac OS X.
My advice is to install everything under /usr/local. Apple will not touch this area (e.g., during system updates, etc.), /usr/local/bin should be in the default path for users, and I have observed many other Mac OS X server software packages using this location.
Most Mac OS X packages I've used (and most software I've built from source on Mac OS X) will create a /usr/local/whatever/... containing directory, however. So, for example, all of MySQL would be under /usr/local/mysql/... That means the MySQL binaries are in /usr/local/mysql/bin/... which is not in the default path for users. But I think the improved isolation of that extra level of directory structure is worth this sacrifice. (Another option is to install everything under /usr/local/whatever/... but then add symlinks to your most important executable(s) under /usr/local/bin)

Resources