[GNC] Launching on Mac (was Repeatable Mac crash)

John Ralls jralls at ceridwen.us
Fri Oct 5 10:25:40 EDT 2018


That’s the way GnuCash used to launch, with a bash script, but bash can’t AFAIK get the filename from LaunchServices. AppleScript or Automator script might work.

Christoph, if you want to try that, the approach would be to rename Gnucash.app/Contents/MacOS/Gnucash to something else and name the script Gnucash.

Regards,
John Ralls

> On Oct 4, 2018, at 9:52 PM, Tommy Trussell <tommy.trussell at gmail.com> wrote:
> 
> If it works to call gnucash with the files on the command line, can you put the automator script (or a bash script or applescript) into the GnuCash bundle, set the bundle's plist to call the script, and pass the command line arguments to the gnucash binary using the script?
> 
> I don't have a modern Mac set up anymore -- I think my newest runs snow leopard -- so I can't try this myself with the latest binary. 
> 
> 
> On Wed, Oct 3, 2018 at 8:01 PM John Ralls <jralls at ceridwen.us <mailto:jralls at ceridwen.us>> wrote:
> Christoph,
> 
> Indeed that would be confusing.
> 
> Regards,
> John Ralls
> 
> 
> > On Oct 3, 2018, at 11:46 AM, Christoph R <subscriptions+listen at rohland.net <mailto:subscriptions%2Blisten at rohland.net>> wrote:
> > 
> > Hi John,
> > 
> > I realized that it has a flaw in general use: The automator script and Gnucash are treated as two different programs by MacOS and show up in the dock independently. So it would be pretty confusing for a normal user. 
> > 
> > Cheers,
> > Christoph
> > 
> >> Am 01.10.2018 um 22:34 schrieb John Ralls <jralls at ceridwen.us <mailto:jralls at ceridwen.us>>:
> >> 
> >> Christoph,
> >> 
> >> I’d never even considered putting Automator into the launch process. Instead I tried to catch the OpenFile notification from LaunchServices. The problem with that is that we don’t get the notification until the event loop is started and GnuCash loads the file before starting the event loop. I didn’t figure that out until November or December and by that point I wasn’t willing to rearrange the start up so close to the release, especially since we were already struggling with the Gtk3 changes. Getting Automator to catch the notification and adjust the command line is a clever hack.
> >> 
> >> How would it work for installation? IIUC we’d still need the Gnucash.app bundle alongside the Automator script and I suppose the Automator script would also need to know the installed path of the bundle in order to start it from its shell.
> >> 
> >> Regards,
> >> John Ralls
> >> 
> >> 
> >> 
> >>> On Oct 1, 2018, at 8:41 AM, Christoph R <subscriptions+listen at rohland.net <mailto:subscriptions%2Blisten at rohland.net>> wrote:
> >>> 
> >>> Hi John,
> >>> 
> >>> reading this I instantly created an Automator Shell Script which opens with “—nofile” when double clicked and with the file when I drop a file on it. After changing the file information too I can now double click on a .gnucash file to open it.
> >>> 
> >>> What’s the reason that we cannot implement this - or something similar - in the standard package?
> >>> 
> >>> Cheers,
> >>> Christoph
> >>> 
> >>>> Am 01.10.2018 um 16:17 schrieb John Ralls <jralls at ceridwen.us <mailto:jralls at ceridwen.us>>:
> >>>> 
> >>>> 
> >>>> 
> >>>>> On Oct 1, 2018, at 4:02 AM, Robert Kesterson <robertk at robertk.com <mailto:robertk at robertk.com>> wrote:
> >>>>> 
> >>>>> On 30 Sep 2018, at 9:06, John Ralls wrote:
> >>>>> 
> >>>>>>> … >
> >>>>>> Since you’re running two instances of GnuCash it’s likely that the trace file will be garbled, so if you could use the following from the command line instead:
> >>>>>> /Applications/Gnucash.app/Contents/MacOS/Gnucash --logto=~/gnucash.trace
> >>>>>> That will create a separate trace file in your user directory that you can also attach to the bug report. You could even add the file path for the file you really want to open to the end of that and save yourself the “can’t get the lock” drill.
> >>>>> 
> >>>>> It appears that this works around the issue.  I did as you suggested and launched with the binary rather than the app package, and I gave it the alternate log location and specified the path to open on the command line. Since this is a pretty long command line that I don’t want to type often, I saved it as an executable shell script, one for each set of books.  Now when I run them both, they both run.  No crash. Should I still run them the old way and file a bug?  The workaround seems reliable, and I’m happy…
> >>>> 
> >>>> I don’t know why you’d want to run the way that causes a crash, but you should file a bug.
> >>>> 
> >>>> Regards,
> >>>> John Ralls
> >>>> 
> >>>> 
> >>>> _______________________________________________
> >>>> gnucash-user mailing list
> >>>> gnucash-user at gnucash.org <mailto:gnucash-user at gnucash.org>
> >>>> To update your subscription preferences or to unsubscribe:
> >>>> https://lists.gnucash.org/mailman/listinfo/gnucash-user <https://lists.gnucash.org/mailman/listinfo/gnucash-user>
> >>>> If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists <https://wiki.gnucash.org/wiki/Mailing_Lists> for more information.
> >>>> -----
> >>>> Please remember to CC this list on all your replies.
> >>>> You can do this by using Reply-To-List or Reply-All.
> >>> 
> >>> 
> >>> 
> >>> 
> >>> Gruß,
> >>> Christoph
> >>> 
> >> 
> > 
> 
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org <mailto:gnucash-user at gnucash.org>
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user <https://lists.gnucash.org/mailman/listinfo/gnucash-user>
> If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists <https://wiki.gnucash.org/wiki/Mailing_Lists> for more information.
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.



More information about the gnucash-user mailing list