| 1 | # Installation Instructions |
| 2 | |
| 3 | `cmd2` works on :simple-linux: Linux, :simple-apple: macOS, and :fontawesome-brands-windows: |
| 4 | Windows. It requires Python 3.11 or higher, [pip](https://pypi.org/project/pip), and |
| 5 | [setuptools](https://pypi.org/project/setuptools). If you've got all that, then you can just: |
| 6 | |
| 7 | ```shell |
| 8 | $ pip install cmd2 |
| 9 | ``` |
| 10 | |
| 11 | !!! note |
| 12 | |
| 13 | Depending on how and where you have installed Python on your system and on what OS you are using, you may need to have administrator or root privileges to install Python packages. If this is the case, take the necessary steps required to run the commands in this section as root/admin, e.g.: on most Linux or Mac systems, you can precede them with `sudo`: |
| 14 | |
| 15 | ```shell |
| 16 | $ sudo pip install <package_name> |
| 17 | ``` |
| 18 | |
| 19 | !!! info |
| 20 | |
| 21 | You can also use an alternative Python package manager such as :simple-astral: [uv](https://github.com/astral-sh/uv), but doing so is beyond the scope of this installation guide. The `cmd2` developers love and highly recommend `uv` and use it for the development of `cmd2` itself. But chances are if you are a sophisticated enough Python developer to be using `uv`, you don't need us to tell you how to use it :smile: |
| 22 | |
| 23 | ## Prerequisites |
| 24 | |
| 25 | If you have Python >=3.11 installed from [python.org](https://www.python.org), you will already have |
| 26 | [pip](https://pypi.org/project/pip) and [setuptools](https://pypi.org/project/setuptools), but may |
| 27 | need to upgrade to the latest versions: |
| 28 | |
| 29 | On Linux or OS X: |
| 30 | |
| 31 | ```shell |
| 32 | $ pip install -U pip setuptools |
| 33 | ``` |
| 34 | |
| 35 | On Windows: |
| 36 | |
| 37 | ```shell |
| 38 | C:\> python -m pip install -U pip setuptools |
| 39 | ``` |
| 40 | |
| 41 | ## Install from PyPI {: #pip_install } |
| 42 | |
| 43 | [pip](https://pypi.org/project/pip) is the recommended installer. Installing packages from |
| 44 | :simple-pypi: [PyPI](https://pypi.org) with pip is easy: |
| 45 | |
| 46 | ```shell |
| 47 | $ pip install cmd2 |
| 48 | ``` |
| 49 | |
| 50 | This will install the required 3rd-party dependencies, if necessary. |
| 51 | |
| 52 | ## Install from GitHub {: #github } |
| 53 | |
| 54 | The latest version of `cmd2` can be installed directly from the main branch on :simple-github: |
| 55 | GitHub using [pip](https://pypi.org/project/pip): |
| 56 | |
| 57 | ```shell |
| 58 | $ pip install -U git+https://github.com/python-cmd2/cmd2.git |
| 59 | ``` |
| 60 | |
| 61 | ## Install from Debian or Ubuntu repos |
| 62 | |
| 63 | We recommend installing from [pip](https://pypi.org/project/pip), but if you wish to install from |
| 64 | :simple-debian: Debian or :simple-ubuntu: Ubuntu repos this can be done with apt-get. |
| 65 | |
| 66 | For Python 3: |
| 67 | |
| 68 | $ sudo apt-get install python3-cmd2 |
| 69 | |
| 70 | This will also install the required 3rd-party dependencies. |
| 71 | |
| 72 | !!! warning |
| 73 | |
| 74 | Versions of `cmd2` before 2.0.0 should be considered to be of unstable "beta" quality and should not be relied upon for production use. If you cannot get a version >= 2.0.0 from your OS repository, then we recommend installing from either PyPI or GitHub - see [Pip Install](installation.md#pip_install) or [Install from GitHub](installation.md#github). |
| 75 | |
| 76 | ## Upgrading cmd2 |
| 77 | |
| 78 | Upgrade an already installed `cmd2` to the latest version from [PyPI](https://pypi.org): |
| 79 | |
| 80 | pip install -U cmd2 |
| 81 | |
| 82 | This will upgrade to the newest stable version of `cmd2` and will also upgrade any dependencies if |
| 83 | necessary. |
| 84 | |
| 85 | ## Uninstalling cmd2 |
| 86 | |
| 87 | If you wish to permanently uninstall `cmd2`, this can also easily be done with |
| 88 | [pip](https://pypi.org/project/pip): |
| 89 | |
| 90 | $ pip uninstall cmd2 |