diff --git a/.travis.yml b/.travis.yml
index 4bfef9f0600db75fb2b619ad33437cdbcf08bc3f..b84b84a5aafcfc5740a2dcfa1a6641fbfdcc9da3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,23 +1,55 @@
 language: c
+
+os:
+  - linux
+  - osx
+
+env:
+  matrix:
+    - BUNDLEDLIBTOM=--disable-bundled-libtom WEXTRAFLAGS=-Werror
+    - BUNDLEDLIBTOM=--enable-bundled-libtom
+    - MULTI=1
+    - NOWRITEV=1
+
+# TODO: remove this section when libtomcrypt compiles on OSX: https://github.com/libtom/libtomcrypt/issues/82
+matrix:
+  exclude:
+    - os: osx
+      env: BUNDLEDLIBTOM=--disable-bundled-libtom WEXTRAFLAGS=-Werror
+    - os: osx
+      env: MULTI=1
+    - os: osx
+      env: NOWRITEV=1
+
 compiler:
   - gcc
+  - clang
+
+# container-based builds
+sudo: false
+addons:
+  apt:
+    packages:
+    # packages list: https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
+    - zlib1g-dev
+    - libtomcrypt-dev
+    - libtommath-dev
+
 
-script: 
-  - autoconf && autoheader && ./configure $BUNDLEDLIBTOM CFLAGS="-O2 -Wall -Wno-pointer-sign $WEXTRAFLAGS" --prefix=$HOME/inst 
-  - test "$NOWRITEV" && sed -i s/HAVE_WRITEV/DONT_HAVE_WRITEV/ config.h || true
-  - make install
+before_install:
+  - if [ "$CC" = "clang" ]; then WEXTRAFLAGS="$WEXTRAFLAGS -Wno-error=incompatible-library-redeclaration" ; fi  # workaround
+
+install:
+  - if [ "$TRAVIS_OS_NAME" = "osx" -a "$BUNDLEDLIBTOM" != "--enable-bundled-libtom" ]; then brew update > /dev/null && brew install libtomcrypt libtommath ; fi
+
+script:
+  - autoconf && autoheader && ./configure "$BUNDLEDLIBTOM" CFLAGS="-O2 -Wall -Wno-pointer-sign $WEXTRAFLAGS" --prefix="$HOME/inst"
+  - if [ "$NOWRITEV" = "1" ]; then sed -i s/HAVE_WRITEV/DONT_HAVE_WRITEV/ config.h ; fi
+  - make -j3 install
+
+after_success:
   - ~/inst/bin/dropbearkey -t rsa -f testrsa
   - ~/inst/bin/dropbearkey -t dss -f testdss
   - ~/inst/bin/dropbearkey -t ecdsa -f testec256 -s 256
   - ~/inst/bin/dropbearkey -t ecdsa -f testec384 -s 384
   - ~/inst/bin/dropbearkey -t ecdsa -f testec521 -s 521
-
-before_install:
-  - sudo apt-get update -qq
-  - sudo apt-get install -qq libz-dev libtomcrypt-dev libtommath-dev
-
-env: 
-  - BUNDLEDLIBTOM=--disable-bundled-libtom WEXTRAFLAGS=-Werror
-  - BUNDLEDLIBTOM=--enable-bundled-libtom
-  - MULTI=1
-  - NOWRITEV=1
diff --git a/cli-runopts.c b/cli-runopts.c
index ab25d3718042b0b81c89505b8be6c4523c2c3dbe..8d1edeeb832598af488318c5c5de57d5881f4c4f 100644
--- a/cli-runopts.c
+++ b/cli-runopts.c
@@ -538,7 +538,7 @@ multihop_passthrough_args() {
 
 	if (opts.recv_window != DEFAULT_RECV_WINDOW)
 	{
-		int written = snprintf(ret+total, len-total, "-W %d ", opts.recv_window);
+		int written = snprintf(ret+total, len-total, "-W %u ", opts.recv_window);
 		total += written;
 	}
 
diff --git a/cli-tcpfwd.c b/cli-tcpfwd.c
index fec5dbaaef89f7f790bfedb636641a0bb83b4d82..b32d9e07ecd8bace1c491470c7736e426d69f199 100644
--- a/cli-tcpfwd.c
+++ b/cli-tcpfwd.c
@@ -273,7 +273,7 @@ static int newtcpforwarded(struct Channel * channel) {
 		goto out;
 	}
 	
-	snprintf(portstring, sizeof(portstring), "%d", fwd->connectport);
+	snprintf(portstring, sizeof(portstring), "%u", fwd->connectport);
 	channel->conn_pending = connect_remote(fwd->connectaddr, portstring, channel_connect_done, channel);
 
 	channel->prio = DROPBEAR_CHANNEL_PRIO_UNKNOWABLE;
diff --git a/compat.c b/compat.c
index a689a146b10b6c48a429adfe85705292267b29b5..71558a58e891881bad15677b0e40315f4f78cf62 100644
--- a/compat.c
+++ b/compat.c
@@ -235,7 +235,7 @@ void setusershell() {
 
 static char **initshells() {
 	/* don't touch this list. */
-	const char *okshells[] = { "/bin/sh", "/bin/csh", NULL };
+	static const char *okshells[] = { "/bin/sh", "/bin/csh", NULL };
 	register char **sp, *cp;
 	register FILE *fp;
 	struct stat statb;
diff --git a/svr-authpam.c b/svr-authpam.c
index 101017c5ac0f5751657562d3da9305a3a9b140cc..98505ba8684def05e0b0e2128f5373975292eeea 100644
--- a/svr-authpam.c
+++ b/svr-authpam.c
@@ -218,7 +218,7 @@ void svr_auth_pam() {
 	}
 
 	/* just to set it to something */
-	if ((rc = pam_set_item(pamHandlep, PAM_TTY, "ssh") != PAM_SUCCESS)) {
+	if ((rc = pam_set_item(pamHandlep, PAM_TTY, "ssh")) != PAM_SUCCESS) {
 		dropbear_log(LOG_WARNING, "pam_set_item() failed, rc=%d, %s",
 				rc, pam_strerror(pamHandlep, rc));
 		goto cleanup;
diff --git a/svr-session.c b/svr-session.c
index f777b5f3ae566b7a065adb49ebb7056cbc659a6d..254a747e6beb901628070c1e9006fc4af64dc50a 100644
--- a/svr-session.c
+++ b/svr-session.c
@@ -160,7 +160,7 @@ void svr_dropbear_exit(int exitcode, const char* format, va_list param) {
 	} else if (ses.authstate.pw_name) {
 		/* we have a potential user */
 		snprintf(fmtbuf, sizeof(fmtbuf), 
-				"Exit before auth (user '%s', %d fails): %s",
+				"Exit before auth (user '%s', %u fails): %s",
 				ses.authstate.pw_name, ses.authstate.failcount, format);
 	} else {
 		/* before userauth */
diff --git a/svr-tcpfwd.c b/svr-tcpfwd.c
index d2f142711022ac05adb559c42b0987e418c285c3..9d051bfe9231f084b0d384f04e70019f53cfb9ac 100644
--- a/svr-tcpfwd.c
+++ b/svr-tcpfwd.c
@@ -269,7 +269,7 @@ static int newtcpdirect(struct Channel * channel) {
 		goto out;
 	}
 
-	snprintf(portstring, sizeof(portstring), "%d", destport);
+	snprintf(portstring, sizeof(portstring), "%u", destport);
 	channel->conn_pending = connect_remote(desthost, portstring, channel_connect_done, channel);
 
 	channel->prio = DROPBEAR_CHANNEL_PRIO_UNKNOWABLE;
diff --git a/svr-x11fwd.c b/svr-x11fwd.c
index 7fe9a3a7dd714434c32eb8d87001be2c9668eaf5..2af41411eb1d8b840e133f1b523b40557ef1bdbf 100644
--- a/svr-x11fwd.c
+++ b/svr-x11fwd.c
@@ -165,7 +165,7 @@ void x11setauth(struct ChanSess *chansess) {
 	}
 
 	/* create the DISPLAY string */
-	val = snprintf(display, sizeof(display), "localhost:%d.%d",
+	val = snprintf(display, sizeof(display), "localhost:%d.%u",
 			chansess->x11port - X11BASEPORT, chansess->x11screennum);
 	if (val < 0 || val >= (int)sizeof(display)) {
 		/* string was truncated */
@@ -175,7 +175,7 @@ void x11setauth(struct ChanSess *chansess) {
 	addnewvar("DISPLAY", display);
 
 	/* create the xauth string */
-	val = snprintf(display, sizeof(display), "unix:%d.%d",
+	val = snprintf(display, sizeof(display), "unix:%d.%u",
 			chansess->x11port - X11BASEPORT, chansess->x11screennum);
 	if (val < 0 || val >= (int)sizeof(display)) {
 		/* string was truncated */
diff --git a/tcp-accept.c b/tcp-accept.c
index 445692026ec8c331444c3c01861b8261e6670d1a..f1f51a7dbc17b699d4a303621b4575dd5bc17515 100644
--- a/tcp-accept.c
+++ b/tcp-accept.c
@@ -121,7 +121,7 @@ int listen_tcpfwd(struct TCPListener* tcpinfo) {
 	TRACE(("enter listen_tcpfwd"))
 
 	/* first we try to bind, so don't need to do so much cleanup on failure */
-	snprintf(portstring, sizeof(portstring), "%d", tcpinfo->listenport);
+	snprintf(portstring, sizeof(portstring), "%u", tcpinfo->listenport);
 
 	nsocks = dropbear_listen(tcpinfo->listenaddr, portstring, socks, 
 			DROPBEAR_MAX_SOCKS, &errstring, &ses.maxfd);