# 从命令行安装插件

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/zh-cn/help/idea/llms.txt).

通过插件 ID 从 [JetBrains Marketplace](https://plugins.jetbrains.com/) 或 [自定义插件库](managing-plugins.html#repos) 安装插件。

> **Note: 在运行此命令之前，请退出 IntelliJ IDEA！**
> 安装插件意味着将它们放入 [plugins 目录](directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html#plugins-directory)。 如果您在全新 IntelliJ IDEA 安装上运行此命令，那么首次启动时，IDE 将不再建议从之前的安装导入设置，因为设置将不再为空。

Windows:

可以在 [安装目录](directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html)下的  `bin`  中找到用于运行 IntelliJ IDEA 的可执行文件。 要将此可执行文件用作命令行启动器，请按照 [命令行界面](working-with-the-ide-features-from-command-line.html) 中的说明将其添加到系统  `路径` 。

语法
: ```PLAINTEXT
: idea64.exe installPlugins <plugin-id ...> [repository-url ...]
:
: ```

示例
: 安装 [GitHub 插件](https://plugins.jetbrains.com/plugin/13115-github/)：
:
:
:
:
: ```SHELL
: idea64.exe installPlugins org.jetbrains.plugins.github
:
: ```
:
:
:
: 从自定义仓库  `http://plugins.example.com:8080/updatePlugins.xml`  安装 ID 为  `com.example.myplugin`  的插件:
:
:
:
:
: ```SHELL
: idea64.exe installPlugins com.example.myplugin http://plugins.example.com:8080/updatePlugins.xml
:
: ```

macOS:

默认情况下，IntelliJ IDEA 不提供命令行启动器。 有关为 IntelliJ IDEA 创建启动脚本的更多信息，请参阅 [命令行界面](working-with-the-ide-features-from-command-line.html)。

语法
: ```PLAINTEXT
: idea installPlugins <plugin-id ...> [repository-url ...]
:
: ```

示例
: 安装 [GitHub 插件](https://plugins.jetbrains.com/plugin/13115-github/)：
:
:
:
:
: ```SHELL
: idea installPlugins org.jetbrains.plugins.github
:
: ```
:
:
:
: 从自定义仓库  `http://plugins.example.com:8080/updatePlugins.xml`  安装 ID 为  `com.example.myplugin`  的插件:
:
:
:
:
: ```SHELL
: idea installPlugins com.example.myplugin http://plugins.example.com:8080/updatePlugins.xml
:
: ```

Unix / Linux:

可以在 [安装目录](directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html)下的  `bin`  中找到用于运行 IntelliJ IDEA 的脚本。 要将此脚本用作命令行启动器，请按照 [命令行界面](working-with-the-ide-features-from-command-line.html) 中的说明将其添加到系统  `路径` 。

语法
: ```PLAINTEXT
: idea.sh installPlugins <plugin-id ...> [repository-url ...]
:
: ```

示例
: 安装 [GitHub](https://plugins.jetbrains.com/plugin/13115-github/) 插件：
:
:
:
:
: ```SHELL
: idea.sh installPlugins org.jetbrains.plugins.github
:
: ```
:
:
:
: 从自定义仓库  `http://plugins.example.com:8080/updatePlugins.xml`  安装 ID 为  `com.example.myplugin`  的插件:
:
:
:
:
: ```SHELL
: idea.sh installPlugins com.example.myplugin http://plugins.example.com:8080/updatePlugins.xml
:
: ```

如果插件以 JAR 存档形式分发，请将 JAR 文件复制到 [plugins 目录](directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html#plugins-directory) 并重新启动 IDE：

Windows:

```GENERIC
copy plugin.jar %APPDATA%\JetBrains\Roaming\<Product><Version>\plugins\

```

macOS:

```GENERIC
cp plugin.jar ~/Library/Application Support/JetBrains/<Product><Version>/plugins/

```

Unix / Linux:

```GENERIC
cp plugin.jar ~/.local/share/JetBrains/<Product><Version>/plugins/

```

插件的开发者在  `plugin.xml` 中指定了插件的唯一标识符—— [插件配置文件](https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html#idea-plugin__id)。 如果是公共插件，您可以在 JetBrains Marketplace 上的插件页面找到其 ID。 向下滚动到   附加信息   部分，并从   插件 ID   形参中复制值。

![插件 ID](https://resources.jetbrains.com/help/img/idea/2026.3/pluginID.png)

