diff --git a/README.md b/README.md
index 4b866fb04cfb0a90594719ad9c6994adfa84996c..71d484eb81327e8389c8d48e7727e5ab6f4e6fed 100644
--- a/README.md
+++ b/README.md
@@ -48,6 +48,8 @@ On WSL or Debian based OSes `apt-get install build-essential libnewlib-dev gcc-r
 
 On Windows, download and install (to system) this copy of GCC10. https://gnutoolchains.com/risc-v/
 
+On macOS install the RISC-V toolchain with homebrew following the instructions at https://github.com/riscv-software-src/homebrew-riscv
+
 You can use the pre-compiled minichlink or 
 
 ## Running
diff --git a/ch32v003fun/ch32v003fun.h b/ch32v003fun/ch32v003fun.h
index 628640f1b3e861f855d1b11a3c17c531a1787571..eb4787d3aabd1b370d74320f8703f45178ed3937 100644
--- a/ch32v003fun/ch32v003fun.h
+++ b/ch32v003fun/ch32v003fun.h
@@ -4822,8 +4822,10 @@ extern "C" {
 #define DELAY_US_TIME (SYSTEM_CORE_CLOCK / 8000000)
 #define DELAY_MS_TIME (SYSTEM_CORE_CLOCK / 8000)
 
+#if defined(__riscv)
 void handle_reset()            __attribute__((naked)) __attribute((section(".text.handle_reset"))) __attribute__((used));
 void DefaultIRQHandler( void ) __attribute__((section(".text.vector_handler"))) __attribute__((naked)) __attribute__((used));
+#endif
 
 void DelaySysTick( uint32_t n );
 
diff --git a/minichlink/Makefile.macos b/minichlink/Makefile.macos
new file mode 100644
index 0000000000000000000000000000000000000000..d19f24dc30ea754dc989fbeed9e3721b364b4607
--- /dev/null
+++ b/minichlink/Makefile.macos
@@ -0,0 +1,19 @@
+TOOLS:=minichlink
+
+all : $(TOOLS)
+
+CFLAGS:=-O0 -Wall -Wno-asm-operand-widths -Wno-deprecated-declarations -Wno-deprecated-non-prototype -D__MACOSX__
+LDFLAGS:=-lpthread -lusb-1.0 -framework CoreFoundation -framework IOKit
+
+INCLUDES=-I /opt/homebrew/Cellar/libusb/1.0.26/include/libusb-1.0
+LIBINCLUDES=-L /opt/homebrew/Cellar/libusb/1.0.26/lib
+
+minichlink : minichlink.c pgm-wch-linke.c pgm-esp32s2-ch32xx.c
+	gcc -o $@ $^ $(LDFLAGS) $(CFLAGS) $(INCLUDES) $(LIBINCLUDES)
+
+inspect_bootloader : minichlink
+	./minichlink -r test.bin launcher 0x780
+	riscv64-unknown-elf-objdump -S -D test.bin -b binary -m riscv:rv32 | less
+
+clean :
+	rm -rf $(TOOLS)
diff --git a/minichlink/README.md b/minichlink/README.md
index 948f30fcba1a115b081de566b5fac94f9c884838..0c3cbce2304f00379f7181785a695f0799ea220b 100644
--- a/minichlink/README.md
+++ b/minichlink/README.md
@@ -8,6 +8,8 @@ On Windows, if you need to you can install the WinUSB driver over the WCH interf
 
 The exe here is about 18kB and contains everything except for the libusb driver.  In Linux you need `libusb-1.0-dev`.
 
+On macOS compile using `make -f Makefile.macos`, you need libusb installed which can be done with homebrew `brew install libusb`.
+
 ## Usage
 
 ```
diff --git a/minichlink/minichlink.c b/minichlink/minichlink.c
index c75da7220078999ead8ecb8f172b62f64540cea2..d0fc80f23417c6753e9ccee1b01f77436ac72a8a 100644
--- a/minichlink/minichlink.c
+++ b/minichlink/minichlink.c
@@ -720,7 +720,7 @@ static int DefaultWriteWord( void * dev, uint32_t address_to_write, uint32_t dat
 
 	iss->currentstateval += 4;
 
-	return 0;
+	return ret;
 }