From 81d5cb161a992651f5478503da19b8d7f9276620 Mon Sep 17 00:00:00 2001 From: i3d Date: Thu, 29 Apr 2021 23:47:17 -0700 Subject: [PATCH 1/2] don't hardcode the Cellar path, use the env variable --- src/fetch.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/fetch.c b/src/fetch.c index 4729b80..6cfb086 100644 --- a/src/fetch.c +++ b/src/fetch.c @@ -415,7 +415,13 @@ void *os() info.col7 = BMAGENTA " :_________`-;" BYELLOW; info.col8 = BBLUE " `.__.-.__.' " BYELLOW; info.getPkgCount = - "ls /usr/local/Cellar/* | grep ':' | wc -l | xargs"; + "ls $HOMEBREW_CELLAR/* | grep ':' | wc -l | xargs"; + if (!getenv("HOMEBREW_CELLAR")) { + fprintf(stderr, "HOMEBREW_CELLAR not set. Consider put\n\t" + "HOMEBREW_PREFIX=\n\t" + "eval $(${HOMEBREW_PREFIX}/bin/brew shellenv)\ninto your shell rc file.\n\n"); + info.getPkgCount = "echo unsupported"; + } char *macVer = malloc(64); strcpy(macVer, "macOS "); From 06764fe5b3354672a0bb261a02c9862a15449893 Mon Sep 17 00:00:00 2001 From: i3d Date: Sun, 16 May 2021 13:38:06 -0700 Subject: [PATCH 2/2] Change install to /Users/jimxu/.local since /usr/local may not writable --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d88e781..cf923e0 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ CC ?= cc CFLAGS = -O2 -std=c99 -Wall -Wextra LDFLAGS = -lpthread DEBUGFLAGS = -g -Og -std=c99 -Wall -Wextra -PREFIX ?= /usr/local +PREFIX ?= ${HOME}/.local all: afetch