diff --git modules/lua/vlc.c modules/lua/vlc.c
index df235d0..b753346 100644
@@ -232,10 +232,22 @@ int vlclua_dir_list( const char *luadirname, char ***pppsz_dir_list )
- if( likely(asprintf( &ppsz_dir_list[i],
+ if( strcasestr (psz_datapath, "/share") == NULL
+ && likely(asprintf( &ppsz_dir_list[i],
"%s"DIR_SEP"share"DIR_SEP"lua"DIR_SEP"%s",
psz_datapath, luadirname ) != -1) )
+ // When installed through MacPorts (or Fink, or HomeBrew, or...?) we do have
+ // meta/reader under LibDir/lua (/opt/local/lib/vlc/lua for MacPorts's standard install prefix)
+ // so we add that location at the end.
+ char *psz_libpath = config_GetLibDir();
+ if( likely(psz_libpath != NULL) )
+ if( likely(asprintf( &ppsz_dir_list[i], "%s"DIR_SEP"lua"DIR_SEP"%s",
+ psz_libpath, luadirname ) != -1) )
diff --git src/darwin/dirs.c src/darwin/dirs.c
index 381729c..9174602 100644
-char *config_GetLibDir (void)
+// 20150205: we should do case-insensitive filename comparisons. HFS is case-insensitive by default,
+// and while it strives to preserve case there is no guarantee that case folding will never occur,
+// especially in directory components.
+// @p libDirIsPosix is set to true in if getLibDir() detects we're installed
+// in a (linux-specific) posix way, like e.g. MacPorts would do.
+char *getLibDir (bool *libDirIsPosix)
+ *libDirIsPosix = FALSE;
/* Get the full program path and name */
/* First try to see if we are linked to the framework */
- for (unsigned i = 0; i < _dyld_image_count(); i++)
+ for (unsigned i = 0; i < _dyld_image_count(); i++) {
const char *psz_img_name = _dyld_get_image_name(i);
- const char *p = strstr( psz_img_name, "VLCKit.framework/Versions/" );
+ const char *p = strcasestr( psz_img_name, "VLCKit.framework/Versions/" );
/* Check for "VLCKit.framework/Versions/Current/VLCKit",
* as well as "VLCKit.framework/Versions/A/VLCKit" and
@@ -61,18 +67,18 @@ char *config_GetLibDir (void)
/* If the string ends with VLCKit then we've found a winner */
- if (!strcmp( p, "/VLCKit"))
+ if (!strcasecmp( p, "/VLCKit"))