导语
因为要通过 ssh 隧道连接 redis 数据库,所以需要一个 redis 客户端,最好用的,当然非 rdm(RedisDesktopManager) 莫属了。
开始按照网上搜索的结果,使用 brew 即可安装,但是并没有安装成功,就随便找了个叫 keylord 的替代品,今天要连接 redis,发现这个 keyload 各种崩溃,还是习惯以前的 rdm(RedisDesktopManager)。
经过了解,官方以前是在 github release 提供了各个发行版的二进制打包程序,比如参考2文中提到的redis-desktop-manager-0.8.3-2550.dmg(link: https://github.com/uglide/RedisDesktopManager/releases/download/0.8.3/redis-desktop-manager-0.8.3-2550.dmg)
文件也是在 release 内的,当然,这个链接已经404了。
现在情况是,如官方下载页面所示:
- Linux
近乎支持所有的发行版:
- debian
- ubuntu
- opensuse
- gentoo
- arch
- fedora
提供所有的功能,没有限制功能或者隐藏的限制。
- Mac OS X/Windows
- 支持的 Mac OS X 版本: 10.13+ High Sierra
- 支持的 Windows 版本: 10+
- 需要付费订阅.
只有付费订阅的用户才能下载二进制.
这也太草了吧。。。cnm下个二进制包都要付费。。自己编译就是了。。
网上能够很容易搜到的 https://blog.csdn.net/wangdajiao/article/details/80838643 中提供的 redis-desktop-manager-0.8.3-2550.dmg
但是如果百度盘链接失效了呢,这个好像是一个对大多数人致命的问题,但是还有个严重但是容易被忽略的问题,安装包不是从官网下载的,会不会打包后门(在网上你得假设其他所有人都不可信任),运营商会不会搞劫持,谁也无法保证。(我是不会说,有大佬先于我发现了rdm不提供macOS程序后,自己学习qt编译打包,并共享到github:https://github.com/onewe/RedisDesktopManager-Mac 并记录打包过程到博客:https://onew.me/2018/03/29/mac-compile-RDM/)
这种第三方的我是有些担惊受怕的,因为 redis 的 shell 可以写 ssh 公钥,况且我的 redis 需要 ssh 通道登陆,那么服务器登陆信息就直接漏了。
所以,本菜🐔决定手动编译,首次 build macOS app 并记录编译过程。
Build on OS X
编译信息:
- Xcode 10 (最新版 Xcode 10.1 编译会失败,参见#4284)
- rdm 0.9.8
自 0.9.9 版本后,RDM 默认不支持 SSH 隧道 (那没办法了,我的版本永远停留在了 0.9.9 (默哀) )
参考:http://docs.redisdesktop.com/en/latest/install/#build-from-source
必要依赖
如果要从上面的链接去下载,还需要填写 survey 表格(国外网站提供下载文件的一个尿性)。
但是从 参考2 的文中,我发现,qt 的下载内容页面是单独的,我们可以绕过 survey,直接去下载。类似 CentOS/Debian 使用 http/ftp 去分发他们的系统镜像(image)文件一样(国外网站提供下载文件的另一个尿性)。
我直接下载 5.9 版本中最新的一个小版本 - 5.9.7
链接:
http://download.qt.io/official_releases/qt/5.9/5.9.7/qt-opensource-mac-x64-5.9.7.dmg
访问这个连接后会自动选择离你最近的镜像(mirror)网站,比如给我跳转到中科大的镜像网站了:
http://iso.mirrors.ustc.edu.cn/qtproject/archive/qt/5.9/5.9.7/qt-opensource-mac-x64-5.9.7.dmg
注意,只是个installer(安装器), 需要双击安装安装过程中还需要Qt的账号(可当场注册以继续安装),然后弹了个窗:
显示需要 8.2 及以上版本的 xcode 和 command line tools,现在已经是 10.1 了,所以这是个提示,并不是检测了你的组件版本不符合云云。。
这里需要勾选:
- MacOS
- Qt Creator(必选,无法取消勾选)
- Qt 5.9.x 组中的 Qt Charts 模块
(如果要全部安装,则需要23G。。。窝的马。。。)
同意协议
接着就开始了安装,跑完进度条就安装成功了
编译过程
- 拉取最新的release版本,可在github release页面查看,目前最新的版本号是 0.9.8
我不喜欢下载release的打包文件(指zip/tar.gz打包),因为下载前看不到文件大小,下载时看不到进度,解压出来没有git文件。
所以我选择通过tag的方式,git clone,到本地:1
git clone -b 0.9.8 --recursive https://github.com/uglide/RedisDesktopManager
--recursive
,因为rdm仓库中使用到了第三方的模块,使用此选项进行自动拉取,具体原因见后。
- 在源码目录运行:
1
└─[$] <git:(fbffb389)> cd ./src && cp ./resources/Info.plist.sample ./resources/Info.plist
fbffb389
即是tag 0.9.8 的commit id。
安装 RDM 所需依赖,比如 openssl 和 cmake
1
brew install openssl cmake
编译 RDM 所需依赖
1
./configure
如果遇到报错,参见后面的 troubleshooting 部分。
在Qt Creator打开./src/rdm.pro
先点击configure project,大概需要1分钟
再点击左边绿色的▶️,大概3分钟后,rdm就开始运行了。
生成app文件
在rdm.pro
文件中注释以下行:1
debug: CONFIG-=app_bundle
再次build,可以生成app文件,但仅限本机运行,分享到其他的机器了似乎会因为“未知开发者”的原因,无法使用。
已经有dalao编译打包好了mac app,在github分享,下载地址:https://github.com/onewe/RedisDesktopManager-Mac/releases
使用脚本编译(未成功)
参考:
https://zhuanlan.zhihu.com/p/21993520
https://zhuanlan.zhihu.com/p/34536708
似乎可以从 rdm仓库中的 travis配置文件的脚本中得到一些灵感(?
于是有dalao写出了osx编译rdm的脚本,意思是不需要在qt creator操作了?
参见 https://github.com/Praying/RedisDesktopManagerBuildScriptForOSX 这个仓库
1 | brew update # > /dev/null |
但是我测试,无论是0.9版本还是0.9.8版本,在进行到crashreporter的make中都会报错:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20src/main.cpp:30:34: error: use of undeclared identifier 'APP_NAME'
).arg(QString(APP_NAME))
^
src/main.cpp:31:34: error: use of undeclared identifier 'APP_VERSION'
.arg(QString(APP_VERSION))
^
src/main.cpp:32:34: error: use of undeclared identifier 'CRASH_SERVER_URL'
.arg(QString(CRASH_SERVER_URL))
^
src/main.cpp:40:17: error: use of undeclared identifier 'APP_NAME'
QString(APP_NAME),
^
src/main.cpp:41:17: error: use of undeclared identifier 'CRASH_SERVER_URL'
QString(CRASH_SERVER_URL),
^
src/main.cpp:42:17: error: use of undeclared identifier 'APP_VERSION'
QString(APP_VERSION),
^
6 errors generated.
make: *** [/.crash_reporter_build/main.o] Error 1
但是我们可以在网上下载编译好的crashreporter
,比如 mac版rdm的编译 - csdn 中提供的 crashreporter(链接: https://pan.baidu.com/s/1htC6QpA 密码: ges8)
将crashreporter
放到 rdm/bin/osx/release ,这样就直接跳过 crashreporter 的编译,执行后面的命令:1
2
3
4
5
6
7cd ../../src/resources
cp ./Info.plist.sample Info.plist
cd ..
qmake CONFIG-=debug
make -s -j4
cd ../bin/osx/release
macdeployqt rdm.app
rdm.app 会出现在 rdm/bin/osx/release 中。
但是打开后并没有出现窗口。
troubleshooting
xcode-select: error: tool ‘xcodebuild’ requires Xcode, but active developer directory
./configure
报错如下1
2
3
4└─[$] <git:(fbffb389*)> ./configure
Warning: coreutils 8.30 is already installed and up-to-date
To reinstall 8.30, run `brew reinstall coreutils`
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
以上错误是因为安装了 xcode , 但并不是系统默认的位置, 所以可以使用以下命令把 xcode 的路径修改为你安装的位置即可
我的位置是:/Applications/Xcode.app/Contents/Developer
所以修改位置命令如下:1
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
xcodebuild: error: ‘src/client/mac/Breakpad.xcodeproj’ does not exist.
同样是./configure
的报错:1
2
3
4└─[$] <git:(fbffb389*)> ./configure
Warning: coreutils 8.30 is already installed and up-to-date
To reinstall 8.30, run `brew reinstall coreutils`
xcodebuild: error: 'src/client/mac/Breakpad.xcodeproj' does not exist.
搜索之,参考官方仓库issue#3702,原来是git clone
的时候,没有使用--recursive
的option。
--recursive
这个选项,上次我曾在介绍git submodule一文(水文)提到过,克隆使用了submodule的git仓库需要用到这个选项。
所以rdm也是用到了submodule,很明显是根目录下的3rdparty
error: Compiling for earlier than macOS 10.6 is no longer supported.
./configure
的报错:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15└─[$] <git:(fbffb389*)> ./configure
Warning: coreutils 8.30 is already installed and up-to-date
To reinstall 8.30, run `brew reinstall coreutils`
=== BUILD TARGET breakpadUtilities OF PROJECT Breakpad WITH CONFIGURATION Release ===
warning: no rule to process file '/Users/meoww/workspace/RedisDesktopManager/3rdparty/gbreakpad/src/common/mac/arch_utilities.h' of type sourcecode.c.h for architecture x86_64
=== BUILD TARGET crash_report_sender OF PROJECT Breakpad WITH CONFIGURATION Release ===
/* com.apple.ibtool.document.notices */
/Users/meoww/workspace/RedisDesktopManager/3rdparty/gbreakpad/src/client/mac/sender/Breakpad.xib:48: note: View is clipping its content
/Users/meoww/workspace/RedisDesktopManager/3rdparty/gbreakpad/src/client/mac/sender/Breakpad.xib:116: note: View is clipping its content
/Users/meoww/workspace/RedisDesktopManager/3rdparty/gbreakpad/src/client/mac/sender/Breakpad.xib:66: note: View is clipping its content
/* com.apple.ibtool.document.warnings */
/Users/meoww/workspace/RedisDesktopManager/3rdparty/gbreakpad/src/client/mac/sender/Breakpad.xib:global: warning: This file is set to build for a version older than the deployment target. Functionality may be limited.
/* com.apple.ibtool.document.errors */
/Users/meoww/workspace/RedisDesktopManager/3rdparty/gbreakpad/src/client/mac/sender/Breakpad.xib:global: error: Compiling for earlier than macOS 10.6 is no longer supported.
** BUILD FAILED **
不过这是官方bug,#4284
作者给的解决方案竟然是,降级Xcode到9.4.1 或者 10.0。
我哭了,你呢?
issue中已经有人尝试过9.4.1 可以编译成功,我这边尝试了降级到10.0,也是可以编译成功的。所以放心食用。(🤩
到 https://developer.apple.com/download/more/ 降级:
- Xcode_10.xip
这个解压出来是app文件,直接移动到”应用程序”目录即可。 - Command_Line_Tools_macOS_10.13_for_Xcode_10.dmg(我还没有升级10.14 Mojave)
双击打开后是pkg安装器,一路点下一步安装即可。
参考: