Mac OSx和VS Code:从终端启动时,`LSGetApplicationForInfo()失败并出现错误

问题描述 投票:1回答:1

我按照文档安装了VS Code并运行Shell Command: Install 'code' command in PATH(和this answer中一样)

起初它正在工作,但重启后(我想)我无法从终端启动代码(这非常有用)。

这是我得到的错误:

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

不确定是否有用:如果我输入which code,我会得到/usr/local/bin/code

macos visual-studio-code
1个回答
0
投票

一种可能的解决方案是执行以下操作:

  1. 打开终端
  2. 找到您遇到此问题的OS X应用程序的路径
  3. 运行以下命令:mdls -name kMDItemCFBundleIdentifier -r <app-path>

由此返回的包名称将是包的实际名称(com.microsoft.VSCodeInsiders不是。)

然后,您可以通过键入open -b <bundle-name>以及之后的任何args来打开应用程序。

提示: - 你的<app-path>可能包含空格,在这种情况下你应该用“(引号)”包围它。 - <app-path>是以.app结尾的目录的路径 - 你在应用程序的finder中看到的“icon”的路径在终端中,文件夹的名称将以.app结尾。

© www.soinside.com 2019 - 2024. All rights reserved.