diff --git a/a/src/macdeployqt/macdeployqt/main.cpp b/b/src/macdeployqt/macdeployqt/main.cpp
index 8914e83..920627f 100644
--- a/a/src/macdeployqt/macdeployqt/main.cpp
+++ b/b/src/macdeployqt/macdeployqt/main.cpp
@@ -27,6 +27,7 @@
 ****************************************************************************/
 #include <QCoreApplication>
 #include <QDir>
+#include <QLibraryInfo>
 
 #include "../shared/shared.h"
 
@@ -58,6 +59,7 @@ int main(int argc, char **argv)
         qDebug() << "   -appstore-compliant           : Skip deployment of components that use private API";
         qDebug() << "   -libpath=<path>               : Add the given path to the library search path";
         qDebug() << "   -fs=<filesystem>              : Set the filesystem used for the .dmg disk image (defaults to HFS+)";
+        qDebug() << "   -plugins-dir=<path>           : Set plugins directory";
         qDebug() << "";
         qDebug() << "macdeployqt takes an application bundle as input and makes it";
         qDebug() << "self-contained by copying in the Qt frameworks and plugins that";
@@ -103,6 +105,7 @@ int main(int argc, char **argv)
     extern bool appstoreCompliant;
     extern bool deployFramework;
     extern bool secureTimestamp;
+    QString plugin_dir;
 
     for (int i = 2; i < argc; ++i) {
         QByteArray argument = QByteArray(argv[i]);
@@ -202,6 +205,13 @@ int main(int argc, char **argv)
                 LogError() << "Missing filesystem type";
             else
                 filesystem = argument.mid(index+1);
+        } else if (argument.startsWith(QByteArray("-plugins-dir"))) {
+            LogDebug() << "Argument found:" << argument;
+            int index = argument.indexOf('=');
+            if (index == -1)
+                LogError() << "Missing filesystem type";
+            else
+                plugin_dir = argument.mid(index+1);
         } else if (argument.startsWith("-")) {
             LogError() << "Unknown argument" << argument << "\n";
             return 1;
@@ -237,11 +247,27 @@ int main(int argc, char **argv)
                           deploymentInfo.deployedFrameworks.end()).values();
     }
 
-    if (plugins && !deploymentInfo.qtPath.isEmpty()) {
-        deploymentInfo.pluginPath = deploymentInfo.qtPath + "/plugins";
-        LogNormal();
-        deployPlugins(appBundlePath, deploymentInfo, useDebugLibs);
-        createQtConf(appBundlePath);
+    if (plugins) {
+        if (plugin_dir.isEmpty()) {
+            deploymentInfo.pluginPath = QLibraryInfo::path(QLibraryInfo::PluginsPath);
+        }
+        else {
+            deploymentInfo.pluginPath = plugin_dir;
+        }
+        if (deploymentInfo.pluginPath.isEmpty()) {
+            LogError() << "Missing Qt plugins path\n";
+            return 1;
+        }
+        if (!QDir(deploymentInfo.pluginPath).exists()) {
+            LogError() << "Plugins path does not exist" << deploymentInfo.pluginPath << "\n";
+            return 1;
+        }
+        Q_ASSERT(!deploymentInfo.pluginPath.isEmpty());
+        if (!deploymentInfo.pluginPath.isEmpty()) {
+            LogNormal();
+            deployPlugins(appBundlePath, deploymentInfo, useDebugLibs);
+            createQtConf(appBundlePath);
+        }
     }
 
     if (runStripEnabled)
diff --git a/a/src/macdeployqt/shared/shared.cpp b/b/src/macdeployqt/shared/shared.cpp
index e72ca8e..5bd2ce3 100644
--- a/a/src/macdeployqt/shared/shared.cpp
+++ b/b/src/macdeployqt/shared/shared.cpp
@@ -192,16 +192,25 @@ OtoolInfo findDependencyInfo(const QString &binaryPath)
     }
 
     outputLines.removeFirst(); // remove line containing the binary path
+
     if (binaryPath.contains(".framework/") || binaryPath.endsWith(".dylib")) {
         const auto match = regexp.match(outputLines.first());
         if (match.hasMatch()) {
-            info.installName = match.captured(1);
-            info.compatibilityVersion = QVersionNumber::fromString(match.captured(2));
-            info.currentVersion = QVersionNumber::fromString(match.captured(3));
-        } else {
+            QString installname = match.captured(1);
+            if (QFileInfo(binaryPath).fileName() == QFileInfo(installname).fileName()) {
+              info.installName = installname;
+              info.compatibilityVersion = QVersionNumber::fromString(match.captured(2));
+              info.currentVersion = QVersionNumber::fromString(match.captured(3));
+              outputLines.removeFirst();
+            }
+            else {
+              info.installName = binaryPath;
+            }
+        }
+        else {
             LogError() << "Could not parse otool output line:" << outputLines.first();
+            outputLines.removeFirst();
         }
-        outputLines.removeFirst();
     }
 
     for (const QString &outputLine : outputLines) {
@@ -850,6 +859,11 @@ void changeInstallName(const QString &bundlePath, const FrameworkInfo &framework
         if (!canonicalInstallName.isEmpty() && canonicalInstallName != framework.installName) {
             changeInstallName(canonicalInstallName, deployedInstallName, binary);
         }
+        // Homebrew workaround, resolve symlink /usr/local/opt/library to /usr/local/Cellar/library
+        if (framework.installName.startsWith("/usr/local/opt/") && framework.installName.count('/') >= 5) {
+            canonicalInstallName = QFileInfo(framework.installName.section('/', 0, 4)).canonicalFilePath() + "/" + framework.installName.section('/', 5);
+            changeInstallName(canonicalInstallName, deployedInstallName, binary);
+        }
     }
 }
 
