diff --git a/Makefile b/Makefile
index 4879b7ee93256cc9cfb89e4a59ebb0535e4dfa91..07c4765287f6c539daa52e7ab1a424c0f0ee7678 100644
--- a/Makefile
+++ b/Makefile
@@ -2,19 +2,29 @@ SUBDIRS=compiler lib test examples packaging
 export LABCOMM_JAR=$(shell pwd)/compiler/labcomm2014_compiler.jar
 export LABCOMM=java -jar $(LABCOMM_JAR) 
 
+UNAME_S=$(shell uname -s)
+
 .PHONY: all
 all: $(SUBDIRS:%=all-%)
 
 .PHONY: all-%
 all-%:
+ifeq ($(UNAME_S),Darwin)
+	DYLD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $*
+else
 	LD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $*
+endif
 
 .PHONY: test
 test: $(SUBDIRS:%=test-%)
 
 .PHONY: test-%
 test-%:
+ifeq ($(UNAME_S),Darwin)
+	DYLD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $* test
+else
 	LD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $* test
+endif
 
 .PHONY: clean
 clean: $(SUBDIRS:%=clean-%)
diff --git a/test/Makefile b/test/Makefile
index e57f3fa27f325eab6173686b84302511fcc64332..dc3b8b735b9a24606719e8be46ee2f1960601421 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,8 +1,8 @@
 TESTS=basic simple nested ref
 LABCOMM_JAR=../compiler/labcomm2014_compiler.jar
 LABCOMM=java -jar $(LABCOMM_JAR)
-MONO_PATH=$(shell realpath ../lib/csharp)
-PYTHONPATH=$(shell realpath ../lib/python)
+MONO_PATH=$(shell pwd)/../lib/csharp
+PYTHONPATH=$(shell pwd)/../lib/python
 
 include ../lib/c/os_compat.mk