0

I'm trying to run a make file that uses the find command. I'm getting an error saying make[3]: find: Command not found. I've tried installing findutils using brew but it's still not working.

~/.zshrc

eval "$(rbenv init -)"
eval "$(pyenv init -)"

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="/Users/antarr.byrd/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"

plugins=(git)

source $ZSH/oh-my-zsh.sh
export EDITOR='nano'

export GOPATH=~/go/
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin

export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
export VIRTUALENVWRAPPER_PYTHON=/Users/antarr.byrd/.pyenv/versions/3.8.8/bin/python
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
source /usr/local/bin/virtualenvwrapper.sh
export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"
export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"
export PATH="/usr/local/sbin:$PATH"
export PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"

Makefile

TEMPLATES = $(shell find . -type f -name 'template.yml')
GO_FILES = $(shell find . -type f -name '*.go') go.mod

.PHONY: coverage
coverage: $(GO_FILES) format
    @echo "* Running tests"
    go test ./... -coverprofile cover.out
    @awk 'BEGIN {print "** checking coverage"} \
          $$3 ~ /0/{print "  Missing coverage: " $$1}' cover.out
    @go tool cover -func cover.out \
    | awk -v min_coverage=$(MIN_COVERAGE) \
      '$$2 ~ /(statements)/ { \
         percent=$$3 + 0.0; \
         passed=(percent >= min_coverage); \
         passed_str=(passed?"yes":"no"); \
         print "overall total: " percent "% (" min_coverage "% or more: " passed_str ")"; \
         exit !passed}'
.PHONY: validate
validate: $(TEMPLATES)
    for template in $^ ; do sam validate -t $${template} ; done
Antarr Byrd
  • 24,863
  • 33
  • 100
  • 188
  • Could you share the relevant/offending part of the makefile? – frippe Oct 07 '21 at 16:23
  • I've added it @frippe – Antarr Byrd Oct 07 '21 at 16:28
  • Thanks. Feels kinda rude to even ask, but you've checked that `find` is found in an interactive shell (/bin/sh or whatever shell you've set to be used by make), right? And inspected PATH to make sure there's nothing wonky there? – frippe Oct 07 '21 at 16:36
  • @frippe The find command works fine when running in the shell. I'm not really sure what to look for in the path this is what it looks like `/usr/local/opt/findutils/libexec/gnubin:/usr/local/sbin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/gnu-getopt/bin:/Users/antarr.byrd/.pyenv/bin:/Users/antarr.byrd/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Users/antarr.byrd/go//bin:/usr/local/opt/go/libexec/bin` – Antarr Byrd Oct 07 '21 at 16:43
  • You can use `which find` in a terminal window to find where it is. And then you could try the full path in your makefile. – tromgy Oct 07 '21 at 16:47

1 Answers1

0

Run following command :

type find

It can give something like

/usr/local/opt/findutils/libexec/gnubin/find

Then you can put at the beginning of your makefile :

PATH := /usr/local/opt/findutils/libexec/gnubin:$(PATH)
Philippe
  • 20,025
  • 2
  • 23
  • 32
  • I don't think this should be the accepted answer since it's a hard-coded workaround and doesn't solve the root issue that something messes up/with PATH – frippe Oct 07 '21 at 18:58