我正在使用 Swift kotlin 将 swift 代码转换为 kotlin,该代码正在 Xcode 项目上运行,但是当我尝试从 mac 终端执行时,它显示 SwiftKotlin not found 。 Github链接:https://github.com/angelolloqui/SwiftKotlin
-bash: swiftkotlin: command not found
Vivek-Mac-mini:~ vivekrawat$
最佳答案
看起来您需要将软件包安装到
/usr/local/bin/
Mac 上的文件夹,因此终端可以像其他命令行命令(如 cd、open 等)一样对待它。
From Xcode, run the desired target and copy the generated executables (you can find it under the Products generated folder) in a directory with executable rights for later use. Typically, you could use: swiftkotlin command line tool: /usr/local/bin/
为此,您可以尝试以下操作:
- 在 Xcode 的左侧 Pane 中找到最后一个名为 Products 的文件夹,将其打开。应该有一个扩展名为 .app 的文件。
- 尝试将扩展名为 .app 的文件从 XCode 拖到桌面,同时按住键盘上的
alt
键。 - 打开 Finder,单击
Shift+Cmd+G
并将/usr/local/bin/
粘贴到提示符中 - 将文件从桌面拖到该文件夹
- 重新启动终端并尝试再次使用该命令
关于ios - 未找到用于将 Swift 转换为 kotlin 的 Swiftkotlin 命令行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50951154/