Home > Enterprise >  Find util not found on OSX
Find util not found on OSX

Time:10-08

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

CodePudding user response:

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)
  • Related