diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index f9c6ae3b4..da1195fe0 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -8854,9 +8854,10 @@ listcmds		Compiled with commands for the buffer list |:files|
 			and the argument list |arglist|.
 localmap		Compiled with local mappings and abbr. |:map-local|
 lua			Compiled with Lua interface |Lua|.
-mac			Any Macintosh version of Vim, but not all OS X.
-macunix			Compiled for OS X, with |mac-darwin-feature|
-osx			Compiled for OS X, with or w/o |mac-darwin-feature|
+mac			Any Macintosh version of Vim
+osx			Any macOS version of Vim
+macdarwin		Compiled for macOS with |mac-darwin-feature|
+macunix			(ditto)
 menu			Compiled with support for |:menu|.
 mksession		Compiled with support for |:mksession|.
 modify_fname		Compiled with file name modifiers. |filename-modifiers|
diff --git a/runtime/doc/os_mac.txt b/runtime/doc/os_mac.txt
index cff87dec2..39c2631ad 100644
--- a/runtime/doc/os_mac.txt
+++ b/runtime/doc/os_mac.txt
@@ -164,8 +164,9 @@ If you want to disable it, pass `--disable-darwin` to the configure script: >
 and then run `make` to build Vim.  The order of the options doesn't matter.
 
 To make sure at runtime whether or not the darwin feature is compiled in, you
-can use `has('macunix')` which returns 1 if the feature is compiled in; 0
-otherwise.
+can use `has('macdarwin')` which returns 1 if the feature is compiled in; 0
+otherwise.  For backward compatibility, you can still use 'macunix' instead of
+'macdarwin' for that purpose.
 
 Notable use cases where `--disable-darwin` is turned out to be useful are:
 
diff --git a/src/auto/configure b/src/auto/configure
index 7e4666202..86b377235 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -759,7 +759,6 @@ infodir
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -892,7 +891,6 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE}'
@@ -1145,15 +1143,6 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1291,7 +1280,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir runstatedir
+		libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1444,7 +1433,6 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -4390,6 +4378,8 @@ fi
 	with_x=no
       fi
     fi
+  else
+    CPPFLAGS="$CPPFLAGS -DMACOS_X"
   fi
 
         if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
@@ -12179,7 +12169,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -12225,7 +12215,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -12249,7 +12239,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -12294,7 +12284,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -12318,7 +12308,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
diff --git a/src/configure.ac b/src/configure.ac
index 918c36c1d..5970707f9 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -224,6 +224,8 @@ if test "`(uname) 2>/dev/null`" = Darwin; then
 	with_x=no
       fi
     fi
+  else
+    CPPFLAGS="$CPPFLAGS -DMACOS_X"
   fi
 
   dnl Avoid a bug with -O2 with gcc 4.0.1.  Symptom: malloc() reports double
diff --git a/src/evalfunc.c b/src/evalfunc.c
index cf9c8d8ec..97101a4ff 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -5545,12 +5545,13 @@ f_has(typval_T *argvars, typval_T *rettv)
 #endif
 #ifdef MACOS
 	"mac",
-#endif
-#if defined(MACOS_X_UNIX)
-	"macunix",  /* built with 'darwin' enabled */
-#endif
-#if defined(__APPLE__) && __APPLE__ == 1
-	"osx",	    /* built with or without 'darwin' enabled */
+# ifdef MACOS_X
+	"osx",		/* possibly, built without the darwin feat. */
+# endif
+# ifdef MACOS_X_UNIX
+	"macdarwin",	/* built with the darwin feat. */
+	"macunix",	/* ditto */
+# endif
 #endif
 #ifdef __QNX__
 	"qnx",
diff --git a/src/misc1.c b/src/misc1.c
index 8ae75e6d8..5f02228a3 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -4352,7 +4352,7 @@ vim_getenv(char_u *name, int *mustfree)
 		--pend;
 #endif
 
-#ifdef MACOS_X
+#ifdef MACOS_X_UNIX
 	    if (p == exe_name || p == p_hf)
 #endif
 		/* check that the result is a directory name */
diff --git a/src/option.c b/src/option.c
index a1304c944..b0a35b00d 100644
--- a/src/option.c
+++ b/src/option.c
@@ -1452,7 +1452,7 @@ static struct vimoption options[] =
     {"guioptions",  "go",   P_STRING|P_VI_DEF|P_RALL|P_FLAGLIST,
 #if defined(FEAT_GUI)
 			    (char_u *)&p_go, PV_NONE,
-# if defined(UNIX) && !defined(MACOS)
+# if defined(UNIX) && !defined(FEAT_GUI_MAC)
 			    {(char_u *)"aegimrLtT", (char_u *)0L}
 # else
 			    {(char_u *)"egmrLtT", (char_u *)0L}
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 21d6aa988..8ad235853 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -1605,7 +1605,7 @@ fun! Test_normal30_changecase()
 
   " Turkish ASCII turns to multi-byte.  On Mac the Turkish locale is available
   " but toupper()/tolower() don't do the right thing.
-  if !has('mac') && !has('osx')
+  if !has('osx')
     try
       lang tr_TR.UTF-8
       set casemap=
diff --git a/src/testdir/test_quotestar.vim b/src/testdir/test_quotestar.vim
index b7d31583d..095d56935 100644
--- a/src/testdir/test_quotestar.vim
+++ b/src/testdir/test_quotestar.vim
@@ -6,7 +6,7 @@ endif
 
 source shared.vim
 
-func Do_test_quotestar_for_macunix()
+func Do_test_quotestar_for_macdarwin()
   if empty(exepath('pbcopy')) || empty(exepath('pbpaste'))
     return 'Test requires pbcopy(1) and pbpaste(1)'
   endif
@@ -138,8 +138,8 @@ func Test_quotestar()
 
   let quotestar_saved = @*
 
-  if has('macunix')
-    let skipped = Do_test_quotestar_for_macunix()
+  if has('macdarwin')
+    let skipped = Do_test_quotestar_for_macdarwin()
   elseif has('x11')
     if empty($DISPLAY)
       let skipped = "Test can only run when $DISPLAY is set."
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index c7ff89ee6..b869a58d2 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -460,7 +460,7 @@ endfunction
 
 func Test_terminal_noblock()
   let g:buf = term_start(&shell)
-  if has('mac')
+  if has('osx')
     " The shell or something else has a problem dealing with more than 1000
     " characters at the same time.
     let len = 1000
diff --git a/src/version.c b/src/version.c
index 652704c1b..2a4fb873a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -3042,12 +3042,12 @@ list_version(void)
 #ifdef MACOS
 # ifdef MACOS_X
 #  ifdef MACOS_X_UNIX
-    MSG_PUTS(_("\nMacOS X (unix) version"));
+    MSG_PUTS(_("\nmacOS version with darwin feature"));
 #  else
-    MSG_PUTS(_("\nMacOS X version"));
+    MSG_PUTS(_("\nmacOS version"));
 #  endif
-#else
-    MSG_PUTS(_("\nMacOS version"));
+# else
+    MSG_PUTS(_("\nMac OS version"));
 # endif
 #endif
 
diff --git a/src/vim.h b/src/vim.h
index 93dc951fb..bc0bf1662 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -86,15 +86,17 @@
 
 /*
  * MACOS_CLASSIC compiling for MacOS prior to MacOS X
- * MACOS_X_UNIX  compiling for MacOS X (using os_unix.c)
- * MACOS_X       compiling for MacOS X (using os_unix.c)
+ * MACOS_X       compiling for MacOS X (possibly, without the darwin feat.)
+ * MACOS_X_UNIX  compiling for MacOS X (with the darwin feat.)
  * MACOS	 compiling for either one
  */
 #if defined(macintosh) && !defined(MACOS_CLASSIC)
 # define MACOS_CLASSIC
 #endif
 #if defined(MACOS_X_UNIX)
-# define MACOS_X
+# if !defined(MACOS_X)
+#  define MACOS_X
+# endif
 # ifndef HAVE_CONFIG_H
 #  define UNIX
 # endif
@@ -227,7 +229,7 @@
 #endif
 
 /* The Mac conversion stuff doesn't work under X11. */
-#if defined(FEAT_MBYTE) && defined(MACOS_X)
+#if defined(FEAT_MBYTE) && defined(MACOS_X_UNIX)
 # define MACOS_CONVERT
 #endif
 
@@ -301,7 +303,9 @@
 # if defined(__MRC__) || defined(__SC__) /* MPW Compilers */
 #  define HAVE_SETENV
 # endif
-# include "os_mac.h"
+# if defined(MACOS_X_UNIX)
+#  include "os_mac.h"
+# endif
 #endif
 
 #ifdef __QNX__
