Recommended way of deploying cross-platform mac application - macos

I am working on a job where we are developing a set of cross-platform applications using C++, Qt, and CMake (among other things). On the Mac we run into the problem that we need to package all of our shared libraries into each .app (currently there are 4 of them), which causes the size of the download and install to get large fairly rapidly.
We want to remain friendly to the Mac way of doing things, which means that we want to support the capacity to drag and drop applications. Does anybody have any ideas on how to do this while keeping the total size down?
The project is currently a set of four executables or apps that each use a common set of shared libraries (qt and in-house). There is also a set of ruby bindings that rely on the in-house libraries. I realize that you could probably create a Framework and install it in System/Library/Frameworks, but I haven't read about that much yet. Doing that way seems like it would break the ability to drag and drop the app between machines.
Does anybody know of any examples of applications that do a similar thing on the Mac? Any creative ideas would be most welcome.

Make an installer, preferably using the standard package maker which comes with XCode tools.
Having an installer for a suite of applications is not that uncommon. Apple's own iWork has an installer and shares libraries.
Making a standard .pkg is important if you want to distribute your app to a corporate customer: the IT admin would want to automate the install process remotely, which is possible for a standard .pkg but not if you write a custom installer yourself.
As for the file placements, you should understand File System Domains as described by Apple. Basically, all the directory structure is repeated three times:
/System/ : system domain
/ : local domain
/Users/name : user's domain
The first is reserved by Apple. The second is for things shared by users on a machine. The third is for a specific user.
The shared objects are put into directories called Library. So we have
/System/Library
/Library
/Users/name/Library
You'll typically install things in the last two. Inside Library, the directories should be organized as described here. Typically you put the frameworks in
Library/Frameworks/
or
Library/Application Support/your_app/Frameworks/

Related

What do we need installations for?

This is a conceptual question and I hope it fits into Stackoverflow's question and answer style. I wonder what the concept of installing applications is good for. In my naive understanding of operating systems we do not need a registry and to use an application it should be enough to just copy the executable and files onto your drive and launch that.
Am a Windows user but also worked with Linux a bit and noticed that there are package managers instead of installers. But even those do more than just a copy instruction, I guess.
I do not think that all the installers exist only because the common user expects them out of steady habit. So what is the advantage of installers in contrast to developing applications which are designed to run out of a single folder and copy that over?
I would really like if someone could explain that concept.
Installing applications is a way to embed them in the OS. It's a kind of standard, you offer procedures like installing and uninstalling that should have the same functionalities for all applications (even "change" under Windows).
Countless times I've "installed" applications with a single shell script that came with them, and then had troubles removing such programs, having to look for single files. If the programmer uses the standard of the OS to make an executable that can be installed, that won't happen.
You can also easily view a list of the installed programs at any time.
Under Linux, additionally, if we're talking about a package manager, it is convenient for the user to have an easy way to download and install a program by just typing its name.
Last but not least, some applications are required to be installed and recognized by the OS (for example services in Windows).

How to distribute a windows application?

What's the best way to distribute a windows application:
Which format should i use to distribute the application, an exe-file
or a zip-file?
Should i sign the application?
Are there any other points i should take into account?
I'm going to create an installer for the application using innosetup. The application is made using node-webkit.
(I'm not a Windows user, but) MSI package is better than both an exe-file and a zip-file. The freedom to choose interactive or unattended [un]installation, and the ability to handle dependencies and upgrades are enough to make it the best option. WiX makes MSI creation easier -- give it a try.
So long as the application deploys - it makes no functional difference the data format you choose to distribute in.
I will speak from a user perspective as opposed to a technical one here; please include a CLEARLY LABELED installer (MSI is the best for this; but if it is .exe, or .bat or whatever, label it as "Installer" or "Click to install" or something similar) and a useful readme, if you do choose to distribute in a .zip.
It all depends on what the exe entails. If it's just a simple .NET executable and it's self contained, all you need is the exe in a zip (pending it's < .NET 2.0 which is included). Each newer succeeding version of Windows has .NET runtimes built into the OS incrementing all the way up to 4.5 or 5.0?
So if you have the latest Windows, and it has the .NET 4.5 libraries on it, all you need is essentially the executable. However if it is an older OS, you may need to bundle or link the runtimes needed. Some apps need third party components installed and other DLL's. In which case your best bet would be to use a third party tool like Install Shield or Wise, or Orca, where you can customize the install and install third party components like SQL Server Personal, Oracle Personal or mySQL Database or Crystal report components.
Also if NTFS permissions and network permissions are required or registry values are required you'll need to script it with Wise, InstallShield, etc, and require elevated permissions. Microsoft also has some built in Deploy Once(?) tools that allows this to be done via the web, or network path or executable.
It all depends on the complexity of your exe, how much it effects your system etc. I've seen apps that require even firewall exceptions, etc. If you are in a corporate environment and have a domain you can deploy using SCCM/SMS or UniCenter. Like I said it all depends on complexity, and scope.
If it's a simple .NET 2.0 app, then all you need is the exe in a zip. The best way would be to copy the exe to a few different systems and test it.
MSI's are inherently able to execute from shell or run/explorer. Also you are allowed to compile your install into a self contained executable.
Bottom line, it all depends on your app :)

Installing a program without installation file

I've heard that you can take a program that is already installed in a PC and go home to you r own pc and write a program in any programming language to make it work without having to install the program. I wanted to know how does one go about in achieving that.
The class of applications you are describing are called Standalone or Portable Applications.
In such applications all files that are required to run the application are stored in the same directory as the application file itself. Which is not the way with most applications work, so, you cannot make all applications run in that fashion. There are various guides on Google when you search for 'creating portable applications'.
You might want to look at a good directory of portable applications here

Why use a Package Installer with your Macintosh App?

Why is it that some Mac Apps are perfectly happy to be simply copied into the /Applications folder, and others require installation-wizard software? Are there advantages to the wizards?
You may be interested in what Apple has to say on the subject. This is in Software Delivery Guide.
In particular, check out the two chapters Manual installs and Managed installs.
Some of the points in favor of package installers are:
support for custom installs
support for pre and post operations, such as quitting app and daemons before upgrading
In some cases it is necessary for an application to install support files in other locations; for example, some programs add libraries in "/usr/local/lib" or add binaries in "/usr/local/bin"; others need to install support files in "/Library/Frameworks" or in "/Library/Application Support". For those situations, using the *.pkg and *.mpkg installers is really the best solution available, since dragging and dropping the app won't cut it.
That said, if it is possible to simply drop your application into "/Applications", then distributing a ".dmg" file with your application in it and with instructions to drag-and-drop it to "/Applications" is a much better way of distributing your application than to rely on the "*.pkg" and "*.mpkg" installers. There are also some major downsides to using the *.pkg and *.mpkg installers... they can very easily clobber permissions and destroy important system files, so a drag-and-drop solution is much safer, simpler, and cleaner.

Creating a windows installer for a Visual Studio project

I want to create an installer for my project, primarily to handle the external dependencies which are starting to grow in number.
The problem is most of these components seem to be distributed in different manners, so I need an installer that can cope with all the following. Ive looked at various things around, however many dont seem to cover all the things I need (like how to install directX using a Visual Studio setup project...), or dont even create a proper windows installer (eg .msi).
Copy all my apps files to the target directory
Create start menu and desktop shortcuts
Install direct x (ie call dxsetup.exe /silent)
Install the VC9 CRT redist (seems to be a "merge module" looking at msdn whatever that is...)
Only requires administrative rights if one of the following is true
DirectX and/or the VC9 CRT is not already present, or needs updating
Installing for all users
Installing to a directory the user doesnt have write permission for
Can roll back everything if installation is aborted before completion
Generates an uninstaller as well as an installer
Ensures the user accepts all required EULA's (my one, VC9 Redist, DirectX, etc)
For example I got the VS2008 Setp Project working for my app files and the VC9 CRT, however I dont see anyway to tell it to just run dxsetup.exe with the /silent argument and NOT extract it and all the other dx installer to the app directory or something...
EDIT:
Also it would be really nice if I could have a unified installer for x86 and x86-64, which installers the correct components (eg myapp_x86.exe or myapp_x64.exe) depending on if the OS is 64bit or not.
EDIT2:
Forgot to mention but either a free or low cost solution would be welcome as well, since I need a solution for some of my smaller personal stuff as well.
WiX is what you want. You'll want to read through the v3 documentation and examples, as it is not a simple thing to use. Once you get going, you'll have follow-up questions which you should post as new questions.
See also the WiX tutorial, but keep in mind it refers to v2, and a lot of it is out-of-date or obsolete in v3.
If you can afford it, Installshield does all this very well and professionally. It will include the merge file and seamlessly install as well. Installshield has its quirks, but it is incredibly easy to use and robust. Once you write your app, you don't want to think a lot about the installer.
Some nice features I liked
Creates patch installs by diff'ing the source so you can distribute patches with a small size.
Create upgrades that update the registry and version number of your app. Prevents older versions from being installed.
Creates an nice uninstaller.
It's Easy to add merge modules.
Scriptible if you need it to be, GUI if not (most of the time you don't need to script a thing).
If you can't afford that, go with NSIS. It is very powerful and well used, but prepared to write code in a text editor.
Follow these STeps

Resources