diff --git a/minichlink/Makefile b/minichlink/Makefile
index e3f1b3809bbbcbadb4b6b83e8c44e6a7a18052d6..1aeb8ac6bc208fb38eb9b73760e5a31175fcadf9 100644
--- a/minichlink/Makefile
+++ b/minichlink/Makefile
@@ -19,8 +19,8 @@ else
 	ifeq ($(OS_NAME),darwin)
 		LDFLAGS:=-lpthread -lusb-1.0 -framework CoreFoundation -framework IOKit
 		CFLAGS:=-O0 -Wall -Wno-asm-operand-widths -Wno-deprecated-declarations -Wno-deprecated-non-prototype -D__MACOSX__
-		INCLUDES:=-I /opt/homebrew/Cellar/libusb/1.0.26/include/libusb-1.0
-		LIBINCLUDES:=-L /opt/homebrew/Cellar/libusb/1.0.26/lib 
+		INCLUDES:=$(shell pkg-config --cflags-only-I libusb-1.0)
+		LIBINCLUDES:=$(shell pkg-config --libs-only-L libusb-1.0)
 		INCS:=$(INCLUDES) $(LIBINCLUDES)
 	endif
 endif
diff --git a/minichlink/microgdbstub.h b/minichlink/microgdbstub.h
index 3d802f55bdfb690121ef300dcf0b0d0b2a465a66..da9246f835ff697825a706f14ffb6111982df523 100644
--- a/minichlink/microgdbstub.h
+++ b/minichlink/microgdbstub.h
@@ -72,12 +72,15 @@ int WSAAPI WSAPoll(struct pollfd * fdArray, ULONG       fds, INT         timeout
 #include <arpa/inet.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <linux/in.h>
 #include <unistd.h>
 #include <poll.h>
 #endif
 #endif
 
+#ifdef __linux__
+#include <linux/in.h>
+#endif
+
 char gdbbuffer[65536];
 uint8_t gdbchecksum = 0;
 int gdbbufferplace = 0;