diff --git a/macosx/Makefile b/macosx/Makefile
index a8ee850e67a..71103726ac9 100644
--- a/macosx/Makefile
+++ b/macosx/Makefile
@@ -86,7 +86,8 @@ install-macosxapp:
$(INSTALL) app/build_html_user_index.sh ${INST_DIR_TARGET}/etc
$(INSTALL) app/build_gui_user_menu.sh ${INST_DIR_TARGET}/etc
$(INSTALL) app/python_wrapper ${INST_DIR_TARGET}/bin/python
- $(INSTALL_DATA) app/app.icns ${PREFIX_TARGET}/${MACOSX_APP_NAME}/Contents/Resources
+ $(INSTALL_DATA) app/AppIcon.icns ${PREFIX_TARGET}/${MACOSX_APP_NAME}/Contents/Resources
+ $(INSTALL_DATA) app/GRASSDocument_gxw.icns ${PREFIX_TARGET}/${MACOSX_APP_NAME}/Contents/Resources
$(INSTALL_DATA) app/${OBJDIR}/Info.plist ${PREFIX_TARGET}/${MACOSX_APP_NAME}/Contents
$(INSTALL_DATA) app/PkgInfo ${PREFIX_TARGET}/${MACOSX_APP_NAME}/Contents
$(INSTALL) app/${OBJDIR}/GRASS.scpt ${PREFIX_TARGET}/${MACOSX_APP_NAME}/Contents/Resources/Scripts/
@@ -111,7 +112,7 @@ install-basic-macosx:
-e 's#'@LD_LIBRARY_PATH_VAR@'#'$(LD_LIBRARY_PATH_VAR)'#g' \
-e 's#'@CONFIG_PROJSHARE@'#'$(PROJSHARE)'#g' \
$(ARCH_DISTDIR)/$(GRASS_NAME).tmp > $(INST_DIR_TARGET)/$(GRASS_NAME)
- -chmod a+x $(UNIX_BIN)/$(GRASS_NAME)
+ -chmod a+x $(INST_DIR_TARGET)/$(GRASS_NAME)
-rm -f $(INST_DIR_TARGET)/$(GRASS_NAME).tmp
-chmod -R a+rX ${PREFIX_TARGET}/${MACOSX_APP_NAME} 2>/dev/null
-touch ${PREFIX_TARGET}/${MACOSX_APP_NAME}
diff --git a/macosx/app/app.icns b/macosx/app/AppIcon.icns
similarity index 100%
rename from macosx/app/app.icns
rename to macosx/app/AppIcon.icns
diff --git a/macosx/app/GRASSDocument_gxw.icns b/macosx/app/GRASSDocument_gxw.icns
new file mode 100644
index 00000000000..9f30e8de5f8
Binary files /dev/null and b/macosx/app/GRASSDocument_gxw.icns differ
diff --git a/macosx/app/GRASSDocument_gxw.svg b/macosx/app/GRASSDocument_gxw.svg
new file mode 100644
index 00000000000..1a812ca553d
--- /dev/null
+++ b/macosx/app/GRASSDocument_gxw.svg
@@ -0,0 +1,400 @@
+
+
diff --git a/macosx/app/Info.plist.in b/macosx/app/Info.plist.in
index 578b3baa54a..a9bc5b73f50 100644
--- a/macosx/app/Info.plist.in
+++ b/macosx/app/Info.plist.in
@@ -3,45 +3,41 @@
CFBundleDevelopmentRegion
- English
+ en
CFBundleExecutable
GRASS
- CFBundleGetInfoString
- GRASS GIS @GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@.@GRASS_VERSION_RELEASE@-@GRASS_VERSION_BUILD@
+ NSHumanReadableCopyright
+ Copyright © 1999–@GRASS_VERSION_DATE@ GRASS Development Team
CFBundleIconFile
- app.icns
+ AppIcon
+ CFBundleName
+ GRASS-@GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@
+ CFBundleDisplayName
+ GRASS-@GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@
CFBundleIdentifier
- org.osgeo.grass@GRASS_VERSION_MAJOR@_@GRASS_VERSION_MINOR@
+ org.osgeo.grass
CFBundleInfoDictionaryVersion
6.0
CFBundlePackageType
APPL
CFBundleShortVersionString
- GRASS GIS @GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@.@GRASS_VERSION_RELEASE@
- CFBundleSignature
- ????
+ @BUNDLE_VERSION@
CFBundleVersion
- @GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@.@GRASS_VERSION_RELEASE@-@GRASS_VERSION_BUILD@
- NSMainNibFile
- MainMenu.nib
- NSPrincipalClass
- NSApplication
+ @BUNDLE_VERSION@
CFBundleDocumentTypes
- CFBundleTypeExtensions
-
- ****
-
CFBundleTypeName
- FolderType
- CFBundleTypeOSTypes
+ GRASS Workspace File
+ CFBundleTypeExtensions
- fold
+ gxw
- CFBundleTypeRole
- Editor
+ CFBundleTypeIconFile
+ GRASSDocument_gxw
+ LSMinimumSystemVersion
+ @DEPLOYMENT_TARGET@
diff --git a/macosx/app/Makefile b/macosx/app/Makefile
index c6199edec23..5025bc050a2 100644
--- a/macosx/app/Makefile
+++ b/macosx/app/Makefile
@@ -15,6 +15,40 @@ APPDIR = $(ARCH_DISTDIR)/${MACOSX_APP_NAME}/Contents
MAKE_DIR_CMD = mkdir -p -m 755
GRASS_VERSION_BUILD = `/bin/date "+%y%m%d"`
+BUNDLE_VERSION := ${GRASS_VERSION_NUMBER}
+# add git commit hash to bundle version if it is a development release
+ifneq (,$(findstring dev,$(GRASS_VERSION_RELEASE)))
+BUNDLE_VERSION := ${GRASS_VERSION_NUMBER} (${GRASS_VERSION_GIT})
+endif
+
+# Figure out version for MACOSX_DEPLOYMENT_TARGET, with following order:
+# - if MACOSX_SDK is set then it will be used
+# - the result of `xcrun --show-sdk-path`
+# - check if Command Line Tools' SDKs is present, and use the default version
+# - use the MacOS version of building machine
+SDK_CMD = ""
+ifeq ($(strip $(MACOSX_SDK)),)
+SDK_CMD = xcrun --show-sdk-path
+else
+SDK_CMD = echo "${MACOSX_SDK}" | cut -d \ -f 2
+endif
+SDK := $(shell $(SDK_CMD))
+
+ifeq ($(SDK),)
+ifneq ($(wildcard /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/.*),)
+SDK = /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
+endif
+endif
+
+ifneq ($(SDK),)
+DEPLOYMENT_TARGET_CMD = plutil -extract DefaultProperties.MACOSX_DEPLOYMENT_TARGET \
+ xml1 -o - $(SDK)/SDKSettings.plist | awk -F '[<>]' '/string/{print $$3}'
+else
+DEPLOYMENT_TARGET_CMD = sw_vers -productVersion | cut -d . -f 1,2
+endif
+
+DEPLOYMENT_TARGET := $(shell $(DEPLOYMENT_TARGET_CMD))
+
# ugly hack - assume gdal prefix starts with -L flag
ifndef GDAL_BIN
GDAL_BIN = `echo "${GDALLIBS}" | sed -e "s,-L,," -e "s,/lib.*$$,/bin:,"`
@@ -51,8 +85,9 @@ $(OBJDIR)/Info.plist: Info.plist.in
$(MAKE_DIR_CMD) $(OBJDIR)
sed -e "s,@GRASS_VERSION_MAJOR@,$(GRASS_VERSION_MAJOR),g" \
-e "s,@GRASS_VERSION_MINOR@,$(GRASS_VERSION_MINOR),g" \
- -e "s,@GRASS_VERSION_RELEASE@,$(GRASS_VERSION_RELEASE),g" \
- -e "s,@GRASS_VERSION_BUILD@,$(GRASS_VERSION_BUILD),g" \
+ -e "s,@GRASS_VERSION_DATE@,$(GRASS_VERSION_DATE),g" \
+ -e "s,@BUNDLE_VERSION@,$(BUNDLE_VERSION),g" \
+ -e "s,@DEPLOYMENT_TARGET@,$(DEPLOYMENT_TARGET),g" \
$< > $@
$(OBJDIR)/GRASS.scpt: GRASS.applescript