git-quick-stats icon indicating copy to clipboard operation
git-quick-stats copied to clipboard

Broken on MacOS Sonoma 14.1.1

Open soundstep opened this issue 1 year ago • 11 comments

Describe the bug

I have install the tool using brew on a mac laptop, but I've got errors displayed when I try to run it.

$ git-quick-stats
ERROR: You must have GNU date installed.
If you're on macOS, please use brew to install this utility.
Make sure the GNU version of date is symlinked to 'date', too.

I also link date to the GNU version gdate but the error remains:

$ alias date="gdate"
$ date --version
date (GNU coreutils) 9.5

To Reproduce

Steps to reproduce the behavior:

  1. Run brew install git-quick-stats
  2. run git-quick-stats

Expected behavior

The command to execute without errors.

Screenshots

Screenshot 2024-05-14 at 12 50 50 Screenshot 2024-05-14 at 13 02 43

Desktop (please complete the following information):

  • OS: MacOS Sonoma 14.1.1 (23B81)
  • OS Chip: Apple M1 Pro
  • Version: 2.5.5

soundstep avatar May 14 '24 12:05 soundstep

Yes, I have the same problem in OS Ventura

agoalofalife avatar May 14 '24 14:05 agoalofalife

What happens if you do you following:

  1. export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
  2. git quick-stats (or whatever your preferred way of launching is)

Using my 2015 MacBook Pro with macOS 14.4.1, and this appears to work on my end.

tomice avatar May 14 '24 23:05 tomice

What happens if you do you following:

  1. export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
  2. git quick-stats (or whatever your preferred way of launching is)

Using my 2015 MacBook Pro with macOS 14.4.1, and this appears to work on my end.

though the path wasn't included in my env PATH, adding it still doesn't work for me (2023 M2 MBP macOS 14.4.1)

~/repo main
❯ export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

~/repo main
❯ date --version
date (GNU coreutils) 9.5
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.

~/repo main
❯ git quick-stats
ERROR: You must have GNU date installed.
If you're on macOS, please use brew to install this utility.
Make sure the GNU version of date is symlinked to 'date', too.

zekida avatar May 15 '24 08:05 zekida

Is that a Linux path? there is not path from /usr/local/opt, opt does not exist.

soundstep avatar May 15 '24 11:05 soundstep

I'm double-checking the Homebrew documentation from here: https://docs.brew.sh/Installation

It appears the path will be different depending on if you're on an Intel machine (like mine) or on an ARM machine:

"The script installs Homebrew to its default, supported, best prefix (/opt/homebrew for Apple Silicon, /usr/local for macOS Intel and /home/linuxbrew/.linuxbrew for Linux) so that you don’t need sudo after Homebrew’s initial installation when you brew install"

And further discussion on when it happened: https://github.com/orgs/Homebrew/discussions/664

The exact location will depend on where you installed it to and at what point in Homebrew's life you had happened to install it (previously, it appears it would install into /usr/local/bin), so I guess I should adjust the check I'm asking people to run. The above version should work for anybody on Intel with the most recent version of Homebrew as of May 2024 who used the default install paths for everything.

For everyone else, you'll need to find out where your gnubin folder is and add it to your path like I showed above. The coreutils brew package itself, I believe, says you can maybe do this:

export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"

The goal is to find where the coreutils are installed and add that gnubin folder to your PATH

tomice avatar May 15 '24 13:05 tomice

export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"

Yes it works - thank a lot My path was (for example) export PATH="/opt/homebrew/Cellar/coreutils/9.5/libexec/gnubin/:$PATH"

agoalofalife avatar May 15 '24 13:05 agoalofalife

@soundstep and @zekida , can you also confirm the above example works? If so, I'll go ahead and update our documentation to make it more clear what users on macOS will need to do to get this to work for them.

tomice avatar May 15 '24 14:05 tomice

export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"

i can confirm it works on apple silicon. thanks for the quick fix :)

zekida avatar May 16 '24 11:05 zekida

Thanks @tomice for looking into that. It is working with:

export PATH="$PATH:/opt/homebrew/Cellar/coreutils/9.5/libexec/gnubin/"

And:

alias date="gdate"

gdate is the GNU version, testable with date --version which doesn't work with the other one

Probably worth adding to a doc? Cheers!

soundstep avatar May 16 '24 14:05 soundstep

None of the workarounds here seem to work for me. Apple Silicon Mac 14.6.1. Any tips?

esthor avatar Aug 23 '24 20:08 esthor

None of the workarounds here seem to work for me. Apple Silicon Mac 14.6.1. Any tips?

Hi there! I just upgraded my M1 Air to 14.6.1, and things appear to be working as expected. Couple questions:

  • What is the output of date --version? <- If this says illegal option, it means that your shell is unable to find the date utility that resides in gnubin
  • What is the output of echo $PATH <- You want to make sure the location of the gnubin dir is in here
  • What is the output of command -v gdate <- If this comes back empty, it means your shell isn't able to find the location of gdate which is necessary to use this script. In which case, you may not have installed the coreutils package

You can run find /opt /usr -type d -name gnubin to find the location of where gnubin resides on your computer. If it doesn't exist, you'll need to install it via brew install coreutils. You'll need to add that to your path by typing something like PATH=/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH

Thanks!

tomice avatar Aug 24 '24 16:08 tomice

Haven't heard back regarding this. Closing for now as GNU's version of date, provided by Homebrew, should solve all issues related to this. It should just be a matter of finding where it resides on the system and adding it to PATH.

tomice avatar Oct 01 '24 21:10 tomice