diff --git a/build-mac.sh b/build-mac.sh
new file mode 100755
index 0000000..0d853b6
--- /dev/null
+++ b/build-mac.sh
@@ -0,0 +1,124 @@
+#!/bin/bash
+
+# Build script to create Mac App Bundle and DMG for pgAdmin4 runtime
+
+export WD=$(cd `dirname $0` && pwd)
+export BUILDROOT=$WD
+export VIRTUALENV=venv
+
+if [ "x$PYTHON_HOME" == "x" ]; then
+    echo "PYTHON_HOME not set. Setting it to default"
+    export PYTHON_HOME=/System/Library/Frameworks/Python.framework/Versions/2.7
+    export PYTHON_VERSION=27
+fi
+
+# Check if Python is working and calculate PYTHON_VERSION
+if $PYTHON_HOME/bin/python2 -V > /dev/null 2>&1; then
+    export PYTHON_VERSION=`$PYTHON_HOME/bin/python2 -V 2>&1 | awk '{print $2}' | cut -d"." -f1-2 | sed 's/\.//'`
+elif $PYTHON_HOME/bin/python3 -V > /dev/null 2>&1; then
+    export PYTHON_VERSION=`$PYTHON_HOME/bin/python3 -V 2>&1 | awk '{print $2}' | cut -d"." -f1-2 | sed 's/\.//'`
+else
+    echo "Error: Python installation missing!"
+    exit 1
+fi
+
+if [ "$PYTHON_VERSION" -gt "34" -a "$PYTHON_VERSION" -lt "26" ]; then
+    echo "Python version not supported"
+    exit 2
+fi
+
+if [ "$PYTHON_VERSION" -ge "30" ]; then
+    export PYTHON=$PYTHON_HOME/bin/python3
+    export PIP=pip3
+    export REQUIREMENTS=requirements_py3.txt
+else
+    export PYTHON=$PYTHON_HOME/bin/python2
+    export PIP=pip
+    export REQUIREMENTS=requirements_py2.txt
+fi
+
+if [ "x$QTDIR" == "x" ]; then
+    echo "QTDIR not set. Setting it to default"
+    export QTDIR=~/Qt/5.5/clang_64
+fi
+export QMAKE=$QTDIR/bin/qmake
+if ! $QMAKE --version > /dev/null 2>&1; then
+    echo "Error: qmake not found. QT installation is not present or incomplete."
+    exit 1
+fi
+
+if [ "x$PGDIR" == "x" ]; then
+    echo "PGDIR not set. Setting it to default"
+    export PGDIR=/usr/local/pgsql
+fi
+export PATH=$PGDIR/bin:$PATH
+
+_get_version() {
+    export pgadmin4_major=`grep "^APP_MAJOR" web/config.py | cut -d"=" -f2 | sed 's/ //g'`
+    export pgadmin4_minor=`grep "^APP_MINOR" web/config.py | cut -d"=" -f2 | sed 's/ //g'`
+    export pgadmin4_revision=`grep "^APP_REVISION" web/config.py | cut -d"=" -f2 | sed 's/ //g'`
+    export LONG_VER=$pgadmin4_major.$pgadmin4_minor.$pgadmin4_revision
+    export SHORT_VER=`echo $LONG_VER | cut -d . -f1,2`
+    export pgadmin4_suffix=`grep "^APP_SUFFIX" web/config.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g"`
+    if [ ! -z $pgadmin4_suffix ]; then
+        export LONG_VER=$LONG_VER-$pgadmin4_suffix
+    fi
+}
+
+_cleanup() {
+    echo "Cleaning up the old environment and app bundle"
+    rm -rf $BUILDROOT/$VIRTUALENV
+    rm -rf $BUILDROOT/runtime/pgAdmin4.app
+    rm -rf $BUILDROOT/pgAdmin4.app
+    rm -f $BUILDROOT/pgAdmin4.dmg
+}
+
+_create_python_virtualenv() {
+    cd $BUILDROOT
+    test -d $VIRTUALENV || virtualenv -p $PYTHON $VIRTUALENV
+    source $VIRTUALENV/bin/activate
+    $PIP install -r $BUILDROOT/$REQUIREMENTS || (echo "PIP install failed. Please resolve the issue and rerun the script"; exit 3)
+}
+
+_build_runtime() {
+    _create_python_virtualenv || exit 3
+    cd $BUILDROOT/web
+    sed -e 's/SERVER_MODE = True/SERVER_MODE = False/' config.py > config_local.py
+    python setup.py
+    cd $BUILDROOT/runtime
+    $QMAKE
+    make
+    cp -pR pgAdmin4.app $BUILDROOT
+}
+
+_complete_bundle() {
+    cd $BUILDROOT/pkg/mac
+    test -d $BUILDROOT/pgAdmin4.app/Contents/Resources || mkdir -p $BUILDROOT/pgAdmin4.app/Contents/Resources
+    
+    # Replace the place holders with the current version
+    sed -e "s/PGADMIN_LONG_VERSION/$LONG_VER/g" -e "s/PGADMIN_SHORT_VERSION/$SHORT_VER/g" pgadmin.Info.plist.in > pgadmin.Info.plist
+
+    # copy Python private environment to app bundle
+    cp -pR $BUILDROOT/$VIRTUALENV $BUILDROOT/pgAdmin4.app/Contents/Resources/
+
+    # remove the python bin from app bundle as it is not needed
+    rm -rf $BUILDROOT/pgAdmin4.app/Contents/Resources/$VIRTUALENV/bin $BUILDROOT/pgAdmin4.app/Contents/Resources/$VIRTUALENV/.Python
+
+    # run complete-bundle to copy the dependent libraries and frameworks and fix the rpaths
+    ./complete-bundle.sh $BUILDROOT/pgAdmin4.app
+
+    # copy the web directory to the bundle as it is required by runtime
+    cp -pR $BUILDROOT/web $BUILDROOT/pgAdmin4.app/Contents/Resources/
+
+}
+
+_create_dmg() {
+    cd $BUILDROOT
+    sh ./pkg/mac/create-dmg.sh
+}
+
+_get_version
+_cleanup
+_build_runtime
+_complete_bundle
+_create_dmg
diff --git a/pkg/mac/.gitignore b/pkg/mac/.gitignore
new file mode 100644
index 0000000..7d29cb0
--- /dev/null
+++ b/pkg/mac/.gitignore
@@ -0,0 +1,3 @@
+# Global excludes across all subdirectories
+debug.pgadmin.Info.plist
+pgadmin.Info.plist
diff --git a/pkg/mac/PkgInfo b/pkg/mac/PkgInfo
new file mode 100644
index 0000000..bd04210
--- /dev/null
+++ b/pkg/mac/PkgInfo
@@ -0,0 +1 @@
+APPL????
\ No newline at end of file
diff --git a/pkg/mac/README.txt b/pkg/mac/README.txt
new file mode 100644
index 0000000..da8392f
--- /dev/null
+++ b/pkg/mac/README.txt
@@ -0,0 +1,30 @@
+Building pgAdmin4.dmg on Mac OS X
+=================================
+
+Required Packages (Either build the sources or get them from macports or similar):
+
+1. Python installation
+  - Python 2.6 or above from https://www.python.org/
+
+2. QT installation
+  - Qt 4 or 5 from http://www.qt.io/
+
+3. PostgreSQL installation
+  - PostgreSQL 9.1 or above from http://www.postgresql.org/
+
+Building:
+
+1. Set the PYTHON_HOME environment variable to the Python root installation directory, e.g.
+
+   export PYTHON_HOME=/System/Library/Frameworks/Python.framework/Versions/2.7
+
+2. Set the QTDIR environment variable to the QT root installation directory, e.g.
+
+   export QTDIR=~/Qt/5.5/clang_64
+
+3. Set the PGDIR environment variable to the PostgreSQL installation directory, e.g.
+
+   export PGDIR=/usr/local/pgsql
+
+4. Go to the pgAdmin4 root directory and run build-mac.sh. This will compile the runtime
+   and create the app bundle pgAdmin4.app and DMG pgAdmin4.dmg in the current directory.
diff --git a/pkg/mac/complete-bundle.sh b/pkg/mac/complete-bundle.sh
new file mode 100755
index 0000000..adadf4c
--- /dev/null
+++ b/pkg/mac/complete-bundle.sh
@@ -0,0 +1,127 @@
+#!/bin/sh
+
+bundle="$1"
+
+if ! test -d "$bundle" ; then
+	echo "$bundle is no bundle!" >&2
+	exit 1
+fi
+
+
+test -d "$bundle/Contents/Resources" || mkdir -p "$bundle/Contents/Resources" || exit 1
+# Create qt.conf so that app knows where the Plugins are present
+cat >> "$bundle/Contents/Resources/qt.conf" << EOF
+[Paths]
+Plugins = PlugIns
+EOF
+
+test -d "$bundle/Contents/Frameworks" || mkdir -p "$bundle/Contents/Frameworks" || exit 1
+test -d "$bundle/Contents/PlugIns/platforms" || mkdir -p "$bundle/Contents/PlugIns/platforms" || exit 1
+cp -f $QTDIR/plugins/platforms/libqcocoa.dylib "$bundle/Contents/PlugIns/platforms"
+cp -f $PGDIR/libpq.5.dylib "$bundle/Contents/Frameworks" || (echo libpq.5.dylib not found in $PGDIR; exit 1)
+
+function CompleteSingleApp() {
+	local bundle=$1 tag=$(basename "$1") todo todo_old fw_relpath lib lib_bn nested_app na_relpath
+
+	echo "Completing app: $bundle"
+	pushd "$bundle" > /dev/null
+
+	#We skip nested apps here - those are treated specially
+	todo=$(file `find ./ -perm +0111 ! -type d ! -path "*.app/*" ! -name "*.app"` | grep -E "Mach-O 64-bit" | awk -F ':| ' '{ORS=" "; print $1}' | uniq)
+
+	echo "App: $tag: Found executables: $todo"
+	while test "$todo" != ""; do
+		todo_old=$todo ;
+		todo="" ;
+		for todo_obj in $todo_old; do
+			echo "App: $tag: Post-processing: $todo_obj"
+
+			#Figure out the relative path from todo_obj to Contents/Frameworks
+			fw_relpath=$(echo "$todo_obj" |\
+				sed -n 's|^\(\.//*\)\(\([^/][^/]*/\)*\)[^/][^/]*$|\2|gp' | \
+				sed -n 's|[^/][^/]*/|../|gp' \
+			)"Contents/Frameworks"
+			fw_relpath_old=$fw_relpath
+
+			fw_loc="Contents/Frameworks"
+
+			#Find all libraries $todo_obj depends on, but skip system libraries
+			for lib in $(
+				otool -L $todo_obj | \
+				grep "Qt\|dylib\|Frameworks\|PlugIns" | grep -v ":" | sed 's/(.*//' | egrep -v '(/usr/lib)|(/System)|@executable_path@' \
+			) $(otool -L $todo_obj | grep "Python" | grep -v ":" | sed 's/(.*//' \
+			); do
+				if echo $lib | grep "PlugIns\|libqcocoa"  > /dev/null; then
+					lib_loc="Contents/PlugIns/platforms"
+				elif echo $lib | grep "Qt" > /dev/null; then
+					qtfw_path="$(dirname $lib | sed 's|.*\(Qt.*framework\)|\1|')"
+					lib_loc="Contents/Frameworks/$qtfw_path"
+					if [ "$(basename $todo_obj)" = "$lib" ]; then
+						lib_loc="$(dirname $todo_obj)"
+						qtfw_path=$(echo $lib_loc | sed 's/Contents\/Frameworks\///')
+					fi
+				elif echo $lib | grep "Python" > /dev/null; then
+					pyfw_path="$(dirname $lib | sed 's|.*\(Python.*framework\)|\1|')"
+					lib_loc="Contents/Frameworks/$pyfw_path"
+					if [ "$(basename $todo_obj)" = "$lib" ]; then
+						lib_loc="$(dirname $todo_obj)"
+						pyfw_path=$(echo $lib_loc | sed 's/Contents\/Frameworks\///')
+					fi
+				else
+					lib_loc="Contents/Frameworks"
+				fi
+				lib_bn="$(basename "$lib")" ;
+				if ! test -f "$lib_loc/$lib_bn"; then
+                                        target_file=""
+					target_path=""
+					echo "App: $tag: Adding symlink: $lib_bn (because of: $todo_obj)"
+					if echo $lib | grep Qt > /dev/null || echo $lib | grep Python > /dev/null ; then
+						cp -R $(dirname $lib)/../../../$lib_bn.framework "$fw_loc/"
+					else
+						cp -R "$lib" "$lib_loc/$lib_bn"
+					fi
+					if ! test -L "$lib_loc/$lib_bn"; then
+						chmod 755 "$lib_loc/$lib_bn"
+					else
+						target_file=$(readlink "$lib")
+						target_path=$(dirname "$lib")/$target_file
+					        echo "App: $tag: Adding symlink target: $target_path"
+						cp "$target_path" "$lib_loc/$target_file"
+						chmod 755 "$lib_loc/$target_file"
+					fi
+					echo "Rewriting ID in $lib_loc/$lib_bn to $lib_bn"
+                                        install_name_tool \
+                                                -id "$lib_bn" \
+                                                "$lib_loc/$lib_bn" || exit 1
+					todo="$todo ./$lib_loc/$lib_bn"
+				fi
+				if echo $lib | grep Qt > /dev/null ; then
+					fw_relpath="$fw_relpath/$qtfw_path"
+				fi
+				if echo $lib | grep Python > /dev/null ; then
+					fw_relpath="$fw_relpath/$pyfw_path"
+				fi
+				echo "Rewriting library $lib to @loader_path/$fw_relpath/$lib_bn in $todo_obj"
+				install_name_tool -change \
+					"$lib" \
+					"@loader_path/$fw_relpath/$lib_bn" \
+					"$todo_obj" || exit 1
+                                install_name_tool -change \
+                                        "$target_path" \
+                                        "@loader_path/$fw_relpath/$target_file" \
+                                        "$todo_obj" || exit 1
+				fw_relpath="$fw_relpath_old"
+			done
+		done
+	done
+
+	# Fix the rpaths for psycopg module
+	find $bundle/Contents/Resources/venv/ -name _psycopg.so | xargs install_name_tool -change libpq.5.dylib @loader_path/../../../../../../Frameworks/libpq.5.dylib
+	find $bundle/Contents/Resources/venv/ -name _psycopg.so | xargs install_name_tool -change libssl.1.0.0.dylib @loader_path/../../../../../../Frameworks/libssl.1.0.0.dylib
+	find $bundle/Contents/Resources/venv/ -name _psycopg.so | xargs install_name_tool -change libcrypto.1.0.0.dylib @loader_path/../../../../../../Frameworks/libcrypto.1.0.0.dylib
+
+	echo "App completed: $bundle"
+	popd > /dev/null
+}
+
+CompleteSingleApp "$bundle"
diff --git a/pkg/mac/create-dmg.sh b/pkg/mac/create-dmg.sh
new file mode 100644
index 0000000..cbf8e54
--- /dev/null
+++ b/pkg/mac/create-dmg.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+DMG_SOURCES="./pgAdmin4.app"
+DMG_LICENCE=./pkg/mac/licence.r
+DMG_IMAGE=./pgAdmin4.dmg
+DMG_NAME=pgAdmin4
+HDIUTIL=/usr/bin/hdiutil
+REZ="/usr/bin/Rez /System/Library/Frameworks/Carbon.framework/Versions/A/Headers/*.r"
+
+DMG_DIR=$DMG_IMAGE.src
+
+if test -e "$DMG_DIR"; then
+	echo "Directory $DMG_DIR already exists. Please delete it manually." >&2
+	exit 1
+fi
+
+echo "Cleaning up"
+rm -f "$DMG_IMAGE" || exit 1
+mkdir "$DMG_DIR" || exit 1
+
+echo "Copying data into temporary directory"
+for src in $DMG_SOURCES; do
+	cp -R "$src" "$DMG_DIR" || exit 1
+done
+
+echo "Creating image"
+$HDIUTIL create -quiet -srcfolder "$DMG_DIR" -format UDZO -volname "$DMG_NAME" -ov "$DMG_IMAGE" || exit 1
+rm -rf "$DMG_DIR" || exit 1
+
+echo "Attaching License to image"
+$HDIUTIL unflatten -quiet "$DMG_IMAGE" || exit 1
+$REZ "$DMG_LICENCE" -a -o "$DMG_IMAGE" || exit 1
+$HDIUTIL flatten -quiet "$DMG_IMAGE" || exit 1
diff --git a/pkg/mac/licence.r b/pkg/mac/licence.r
new file mode 100644
index 0000000..88a89af
--- /dev/null
+++ b/pkg/mac/licence.r
@@ -0,0 +1,42 @@
+data 'LPic' (5000) {
+	$"0000 0001 0000 0000 0000"
+};
+
+resource 'STR#' (5000, "English buttons") {
+    {   /* array StringArray: 9 elements */
+        /* [1] */
+        "English",
+        /* [2] */
+        "Agree",
+        /* [3] */
+        "Disagree",
+        /* [4] */
+        "Print",
+        /* [5] */
+        "Save...",
+        /* [6] */
+        "IMPORTANT - Read this License Agreement carefully before clicking on "
+        "the \"Agree\" button.  By clicking on the \"Agree\" button, you agree "
+        "to be bound by the terms of the License Agreement.",
+        /* [7] */
+        "Software License Agreement",
+        /* [8] */
+        "This text cannot be saved. This disk may be full or locked, or the file "
+        "may be locked.",
+        /* [9] */
+        "Unable to print. Make sure you've selected a printer."
+    }
+};
+
+data 'TEXT' (5000, "English") {
+    "pgAdmin 4\n"
+    "\n"
+    "Copyright (C) 2013 - 2016, The pgAdmin Development Team\n"
+    "\n"
+    "Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.\n"
+    "\n"
+    "IN NO EVENT SHALL THE PGADMIN DEVELOPMENT TEAM BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE PGADMIN DEVELOPMENT TEAM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
+    "\n"
+    "THE PGADMIN DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN \"AS IS\" BASIS, AND THE PGADMIN DEVELOPMENT TEAM HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.\n"
+};
+
diff --git a/pkg/mac/pgadmin.Info.plist.in b/pkg/mac/pgadmin.Info.plist.in
new file mode 100644
index 0000000..fb57ac8
--- /dev/null
+++ b/pkg/mac/pgadmin.Info.plist.in
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleExecutable</key>
+	<string>pgAdmin4</string>
+	<key>CFBundleGetInfoString</key>
+	<string>pgAdmin4 PGADMIN_LONG_VERSION</string>
+	<key>CFBundleIconFile</key>
+	<string>pgAdmin4.icns</string>
+	<key>CFBundleIdentifier</key>
+	<string>org.postgresql.pgadmin</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>PGADMIN_SHORT_VERSION</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>PGADMIN_LONG_VERSION</string>
+	<key>CSResourcesFileMapped</key>
+	<true/>
+</dict>
+</plist>
