在 OSX 上未找到查找实用程序
Find util not found on OSX
我正在尝试 运行 一个使用 find
命令的 make 文件。我收到一条错误消息 make[3]: find: Command not found
。我已经尝试使用 brew 安装 findutils
,但它仍然无法正常工作。
~/.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"
生成文件
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"} \
$ ~ /0/{print " Missing coverage: " $}' cover.out
@go tool cover -func cover.out \
| awk -v min_coverage=$(MIN_COVERAGE) \
'$ ~ /(statements)/ { \
percent=$ + 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
运行 以下命令:
type find
它可以给出类似
的东西
/usr/local/opt/findutils/libexec/gnubin/find
然后你可以在你的 makefile 的开头加上 :
PATH := /usr/local/opt/findutils/libexec/gnubin:$(PATH)
我正在尝试 运行 一个使用 find
命令的 make 文件。我收到一条错误消息 make[3]: find: Command not found
。我已经尝试使用 brew 安装 findutils
,但它仍然无法正常工作。
~/.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"
生成文件
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"} \
$ ~ /0/{print " Missing coverage: " $}' cover.out
@go tool cover -func cover.out \
| awk -v min_coverage=$(MIN_COVERAGE) \
'$ ~ /(statements)/ { \
percent=$ + 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
运行 以下命令:
type find
它可以给出类似
的东西/usr/local/opt/findutils/libexec/gnubin/find
然后你可以在你的 makefile 的开头加上 :
PATH := /usr/local/opt/findutils/libexec/gnubin:$(PATH)