diff --git a/R/create-docs.sh b/R/create-docs.sh
index 4194172a2e115bd0bd5ef9edbc91e3f045edc322..af47c0863bdd01e15991af57df225370bc964a42 100755
--- a/R/create-docs.sh
+++ b/R/create-docs.sh
@@ -23,6 +23,9 @@
 # After running this script the html docs can be found in 
 # $SPARK_HOME/R/pkg/html
 
+set -o pipefail
+set -e
+
 # Figure out where the script is
 export FWDIR="$(cd "`dirname "$0"`"; pwd)"
 pushd $FWDIR
diff --git a/R/install-dev.sh b/R/install-dev.sh
index 55ed6f4be1a4a3278b3fb19ead9b96a35a43b355..b9e25270359945ff278decbb38f2097fa6aa507d 100755
--- a/R/install-dev.sh
+++ b/R/install-dev.sh
@@ -26,6 +26,8 @@
 # NOTE(shivaram): Right now we use $SPARK_HOME/R/lib to be the installation directory
 # to load the SparkR package on the worker nodes.
 
+set -o pipefail
+set -e
 
 FWDIR="$(cd `dirname $0`; pwd)"
 LIB_DIR="$FWDIR/lib"