# Installing Packages From The Command Line

**URL:** <https://forum.sublimetext.com/t/installing-packages-from-the-command-line/64029>\
**Category:** Ideas and Feature Requests\
**Created:** [May 17, 2022, 9:00am UTC](https://forum.sublimetext.com/t/installing-packages-from-the-command-line/64029 "2022-05-17T09:00:47Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![UltraInstinct05](https://forum.sublimetext.com/letter_avatar_proxy/v4/letter/u/85e7bf/32.png) [@UltraInstinct05](https://forum.sublimetext.com/u/UltraInstinct05)\
**Post date:** [May 17, 2022, 10:50am UTC](https://forum.sublimetext.com/t/installing-packages-from-the-command-line/64029/4 "2022-05-17T10:50:28Z")

</div>

If you already have Sublime Text installed and `subl` (ST command line helper) is available in `PATH`, then it’s just the matter of

1. Investigating what command is executed when someone normally does `Tools -> Install Package Control ...` for the first time.
2. Finding out if `subl` can run commands ?

For (2), If `subl` can’t run commands, I wouldn’t be making this post 🙂

The general syntax for running commands using `subl` is `subl --command "<name_of_the_command> {<arguments>}"`

For (1), you can simply turn on command logging in the console (by executing `sublime.log_commands(True)`) and finding out the command that was executed. It will be `install_package_control`

Putting (1) and (2) together, to install PC from the command line, you need

`subl --command "install_package_control"`

* * *

Coming to installing packages from the command line.

Once PC is installed, generally users would use `Package Control: Install Package`, which presents them a list of packages in a quick panel, whereby selecting any one would cause PC to install it.

The problem is the command behind `Package Control: Install Package` (`install_package`) doesn’t accept any arguments which we can supply to tell it to install a given package.

Fortunately, PC does provide another command hidden behind `Package Control: Advanced Install Package` (`advanced_install_package`), which can take a `packages` argument, which is a comma seperated list of packages. Normally, a user would pick that option from command palette and enter the packages name in an input panel.

For our case, we can simply do `subl --command "advanced_install_package {\"packages\": \"LSP,LSP-pyright\"}"`, which would then let me install `LSP` & `LSP-pyright` from the command line. You can install any packages this way, provided the names are correct.

* * *

**Final summary**

1. Installing PC from command line: `subl --command "install_package_control"`
2. Installing packages from command line `subl --command "advanced_install_package {\"packages\": \"LSP,LSP-pyright\"}"`

Hope this helps !

---

_[View the full topic](https://forum.sublimetext.com/t/installing-packages-from-the-command-line/64029)._
