# package create

Create a package.

## Description for package create

First, use this command to create a package. Then create a package version.

If you don’t have a namespace defined in your sfdx-project.json file, use --no-namespace.

Your --name value must be unique within your namespace.

Run 'sf package list to list all packages in the Dev Hub org.

## Aliases for package create

`force:package:create`

## Flags

| Flag Name (Long)                | Flag Name (Short) | Description                                                                                                                                                                                                                                                                                                          |
| ------------------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--api-version`                 | N/A               | **Type:** Value<br><br>Override the api version used for api requests made by this command                                                                                                                                                                                                                           |
| `--description`                 | `-d`              | **Type:** Value<br><br>Description of the package.                                                                                                                                                                                                                                                                   |
| `--error-notification-username` | `-o`              | **Type:** Value<br><br>Active Dev Hub user designated to receive email notifications for package errors.<br><br>Email notifications include information about unhandled Apex exceptions, and install, upgrade, or uninstall failures associated with your package.                                                   |
| `--flags-dir`                   | N/A               | **Type:** Value<br><br>Import flag values from a directory.                                                                                                                                                                                                                                                          |
| `--json`                        | N/A               | **Type:** Boolean<br><br>Format output as json.                                                                                                                                                                                                                                                                      |
| `--name`                        | `-n`              | **Type:** Value<br>**Required**<br><br>Name of the package to create.                                                                                                                                                                                                                                                |
| `--no-namespace`                | `-e`              | **Type:** Boolean<br><br>Create the package with no namespace; available only for unlocked packages.<br><br>This flag is useful when you’re migrating an existing org to packages. But use a namespaced package for new metadata.                                                                                    |
| `--org-dependent`               | N/A               | **Type:** Boolean<br><br>Depends on unpackaged metadata in the installation org; applies to unlocked packages only.<br><br>Use Source Tracking in Sandboxes to develop your org-dependent unlocked package. For more information, see "Create Org-Dependent Unlocked Packages" in the Salesforce DX Developer Guide. |
| `--package-type`                | `-t`              | **Type:** Value<br>**Required**<br>**Valid Values:** `Managed`, `Unlocked`<br><br>Type of package.<br><br>The options for package type are Managed and Unlocked (Managed=DeveloperManagedSubscriberManaged, Unlocked=DeveloperControlledSubscriberEditable). These options determine upgrade and editability rules.  |
| `--path`                        | `-r`              | **Type:** Value<br>**Required**<br><br>Path to directory that contains the contents of the package.                                                                                                                                                                                                                  |
| `--target-dev-hub`              | `-v`              | **Type:** Value<br>**Required**<br><br>Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set.                                                                                                                                                             |

## Examples for package create

Create an unlocked package from the files in the "force-app" directory; uses your default Dev Hub org:

```shell
sf package create --name MyUnlockedPackage --package-type Unlocked --path force-app
```

Create a managed packaged from the "force-app" directory files, give the package a description, and use the specified Dev Hub org:

```shell
sf package create --name MyManagedPackage --description "Your Package Descripton" --package-type Managed --path force-app --target-dev-hub devhub@example.com
```
