Broken on MacOS Sonoma 14.1.1
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:
- Run
brew install git-quick-stats - run
git-quick-stats
Expected behavior
The command to execute without errors.
Screenshots
Desktop (please complete the following information):
- OS: MacOS Sonoma 14.1.1 (23B81)
- OS Chip: Apple M1 Pro
- Version: 2.5.5
Yes, I have the same problem in OS Ventura
What happens if you do you following:
-
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" -
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.
What happens if you do you following:
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"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.
Is that a Linux path? there is not path from /usr/local/opt, opt does not exist.
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
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"
@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.
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
i can confirm it works on apple silicon. thanks for the quick fix :)
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!
None of the workarounds here seem to work for me. Apple Silicon Mac 14.6.1. Any tips?
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 ingnubin - What is the output of
echo $PATH<- You want to make sure the location of thegnubindir 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 ofgdatewhich is necessary to use this script. In which case, you may not have installed thecoreutilspackage
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!
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.