diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index aaf94592359a961443c43ba11020d3aa884f3ff0..96efd73156cfb6dc8e646be3414655bf5d9fe3aa 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,6 +9,7 @@ before_script:
   - if [ "$HTTP_PROXY" != "" ]; then printf "{http_proxy,\"$HTTP_PROXY\"}.\n" >> ~/.config/rebar3/rebar.config; fi
   - if [ "$HTTPS_PROXY" != "" ]; then printf "{https_proxy,\"$HTTPS_PROXY\"}.\n" >> ~/.config/rebar3/rebar.config; fi
   - curl -jksSL -o rebar3 https://s3.amazonaws.com/rebar3/rebar3 && chmod +x rebar3
+  - rebar3 update
 
 stages:
   - compile
@@ -18,12 +19,12 @@ stages:
 compile:
   stage: compile
   script:
-    - ./rebar3 as production do compile
+    - rebar3 as production do compile
 
 test:
   stage: test
   script:
-    - ./rebar3 do eunit --cover --dir=test, cover --verbose
+    - rebar3 as test do eunit --cover --dir=test, cover --verbose
     - coverage.escript _build/test/cover/eunit.coverdata
 
 publish:
@@ -31,5 +32,5 @@ publish:
   only:
     - /^\d+[.]\d+[.]\d+$/ # Only publish HEAD tagged with semantic version
   script:
-    - ./rebar3 update
-    - echo Y | ./rebar3 hex publish
+    - rebar3 update
+    - echo Y | rebar3 hex publish
diff --git a/Makefile b/Makefile
index c1c4f229e3e9071c153268bc00a9b94cb205c06a..33df7b3a83084b823251b754ca2d2070c488fbf1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,33 +1,29 @@
-REBAR ?= $(CURDIR)/rebar3
-REBAR_URL ?= https://s3.amazonaws.com/rebar3/rebar3
-define get_rebar
-	curl -s -L -o $(REBAR) $(REBAR_URL) || rm $(REBAR)
-	chmod +x $(REBAR)
-endef
-export REBAR
+REBAR_VERSION := $(shell rebar3 --version 2>/dev/null)
+ifdef REBAR_VERSION
+REBAR := rebar3
+else
+REBAR := $(CURDIR)/rebar3
+$(shell if ! [ -e "$(REBAR)" ]; then curl -jksSL -o $(REBAR) https://s3.amazonaws.com/rebar3/rebar3; chmod +x $(REBAR); fi)
+endif
 
-all: test
+all: tests
 
-$(REBAR):
-	@$(call get_rebar)
-	@$(REBAR) update
-
-compile: $(REBAR)
+compile:
 	@$(REBAR) compile
 
-test: $(REBAR)
+tests:
 	@$(REBAR) do eunit --cover --dir=test, cover --verbose
 
-analyze: $(REBAR)
+analyze:
 	@$(REBAR) dialyzer
 
-release: $(REBAR)
+release:
 	@$(REBAR) release
 
-docs: $(REBAR)
+docs:
 	@$(REBAR) edoc
 
-clean: $(REBAR)
+clean:
 	@$(REBAR) clean
 
 distclean: