在Mac OSx和VS Code中,从终端启动时出现“LSGetApplicationForInfo() failed with error”的错误。

15 浏览
0 Comments

在Mac OSx和VS Code中,从终端启动时出现“LSGetApplicationForInfo() failed with error”的错误。

我安装了VS Code并根据文档(以及在这个答案中找到的方法)运行了Shell Command: Install \'code\' command in PATH

起初它能够正常工作,但是在重新启动后(我猜是在重启后),我无法从终端启动code(这非常有用)。

这是我得到的错误:

LSGetApplicationForInfo() failed with error -10814 while trying to determine the application with bundle identifier com.microsoft.VSCodeInsiders.

不确定是否有帮助:如果我键入which code,我得到/usr/local/bin/code

admin 更改状态以发布 2023年5月24日
0
0 Comments

以上来自marco的解决方案有效,为了使其更加友好,我将其添加到了我的~/.aliases文件中

alias code='open -b com.microsoft.VSCode'

然后,我可以再次使用code .,并在当前路径中打开vscode。

0
0 Comments

解决这个问题的一个可能的方案是:

  1. 打开终端
  2. 找到你正在遇到问题的 OS X 应用程序的路径
  3. 运行以下命令:
    mdls -name kMDItemCFBundleIdentifier -r

这将返回 bundle 名称的实际名称(com.microsoft.VSCodeInsiders 不是实际名称)。

然后,您可以通过输入 open -b 打开应用程序,后面可以跟上任何参数。

提示:
- 您的 可能包含空格,在这种情况下,您应该将其用引号 "(quotes)括起来。
- 是以 .app 结尾的目录的路径——在终端中,文件夹的名称将以 .app 结尾。

0