---
schema_version: "1"
id: ce01c6cd4121c579cefe0eff2b595152daf5894d5ed7c3d8a5bfc0ac406a70e4
title: package create
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/package/cli_reference_package_create.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_package_create.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 6ae3fd6a695fd2835ff5ef3a100b5403afce76afe1c4a20f93339fcb24cf17c9
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# 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 |
|------------------|-------------------|-------------|
| <code>&#8209;&#8209;api&#8209;version</code> | N/A | **Type:** Value<br><br>Override the api version used for api requests made by this command |
| <code>&#8209;&#8209;description</code> | <code>&#8209;d</code> | **Type:** Value<br><br>Description of the package. |
| <code>&#8209;&#8209;error&#8209;notification&#8209;username</code> | <code>&#8209;o</code> | **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. |
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;json</code> | N/A | **Type:** Boolean<br><br>Format output as json. |
| <code>&#8209;&#8209;name</code> | <code>&#8209;n</code> | **Type:** Value<br>**Required**<br><br>Name of the package to create. |
| <code>&#8209;&#8209;no&#8209;namespace</code> | <code>&#8209;e</code> | **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. |
| <code>&#8209;&#8209;org&#8209;dependent</code> | 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. |
| <code>&#8209;&#8209;package&#8209;type</code> | <code>&#8209;t</code> | **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. |
| <code>&#8209;&#8209;path</code> | <code>&#8209;r</code> | **Type:** Value<br>**Required**<br><br>Path to directory that contains the contents of the package. |
| <code>&#8209;&#8209;target&#8209;dev&#8209;hub</code> | <code>&#8209;v</code> | **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
```
<!-- prettier-ignore-end -->
