Is it possible to import one single configuration file by specifying its path, or a group of Yaml files contained in a specific module?

  • You can by enabling the config module and then using the single import page.
    – user21641
    Commented Nov 28, 2016 at 9:11
  • Thanks @IvanJaros, can you expand the comment to an answer with details how to enable the config module and the path to the single import page? Is there any way to achieve the same results with drush or drupal console? If it works, I'll accept the answer. Cheers! Commented Nov 28, 2016 at 9:37
  • i guess you can put the file into config/sync directory and just run drush cim, ive always used ui for single config file.
    – user21641
    Commented Nov 28, 2016 at 9:42
  • That would import all the files in the sync directory. Commented Nov 28, 2016 at 12:40

5 Answers 5


You can use

$ drush cim --partial --source=only-few-configs/

Your help says:

$ drush cim --help
Import config from a config directory.

 drush config-import --partial             Import configuration; do not remove missing configuration.

 label                                     A config directory label (i.e. a key in $config_directories array in 
                                           settings.php). Defaults to 'sync'

 --partial                                 Allows for partial config imports from the source directory. Only updates and new 
                                           configs will be processed with this flag (missing configs will not be deleted).   
 --preview=<list>                          Format for displaying proposed changes. Recognized values: list, diff. Defaults   
                                           to list.                                                                          
 --source                                  An arbitrary directory that holds the configuration files. An alternative to      
                                           label argument

Aliases: cim
  • 16
    That's great, but if you want to import one file you have to move it to another partial directory? That's weird, isn't it?
    – rreiss
    Commented Jul 24, 2018 at 7:53
  • 3
    If running in Lando/Docker, prefix the directory path with /app/ (as suggested in the Drupal Console answer).
    – colan
    Commented Apr 21, 2020 at 16:37
  • @rreiss agree, spot on. +1 Seems another example of an obvious usability that gets overlooked and a detatchment of reality the makers of these tools from what people need. Commented Aug 25, 2020 at 16:51
  • I came here because I can't be sure that core.extension.yml is running before the other config that depends on it is running. I keep getting errors about PlugIns (i.e. Drupal contrib modules) not existing. So I want to import core.extension.yml first hence the need to import just this file. Commented Aug 25, 2020 at 16:55
  • 1
    I had some problems to find out the right path: /cms/web$ drush config-import --partial --source=sites/default/files/config/foo as an working example for my case ... you see the structure ... Commented Oct 12, 2021 at 12:20

You can import one configuration by running the following command:

 drupal config:import:single

If you are trying to run multiple import you can create a chain for that.

Command Documentation - config:import:single

  • 9
    Is there an option for drush aswell?
    – Benedikt
    Commented Oct 16, 2017 at 7:10
  • 11
    Tip for Lando/Docker users - you need to specify the full path when running in a container, e.g. drupal config:import:single --directory="/app/config/sync" --file="foo.settings.yml", rather than just config/sync when you are in /app - otherwise you'll get [ERROR] Value can not be empty. (Fortunately Drupal Console's source code is nice and easy to debug.) Commented Jul 25, 2018 at 5:55
  • This is fantastic. Note that it didn't like working for me using lando, I had to lando ssh so the machine first and then run it natively.
    – Christian
    Commented Jul 28, 2020 at 3:32
  • I've created a feature request on drush for this: github.com/drush-ops/drush/issues/5146
    – malcomio
    Commented May 13, 2022 at 9:08

In case you don't have Drush or Drupal console installed, please use the following steps (executed successfully in D 8.0.1):

  1. Go to Administration->Configuration->Configuration Synchronization. Configuration can be exported for a single item or for entire site. I did for a single user.mail.yml file. Export the required configuration.
    1. Modify the changes to the exported configuration.
    2. Import the modified configuration
    3. Once import is successful, ensure that you clear the existing data from config and cache_config tables(Extract a dump of the database and search for the configuration keywords. That way you will know the tables where the entry is present.)

Note - Always take a backup.

  • Note that in current versions this is found under Administration->Configuration->Development->Configuaration Synchronization->Import at the path /admin/config/development/configuration/full/import
    – diamondsea
    Commented Sep 13, 2021 at 18:07

Even though this was asked 7 years ago, it came up first in a google search for "import config item via drush", so here's yet another way to solve the problem. This will allow you to import a config item using Drush for a config item that is not in the filesystem.

In Acquia environments, the command drush config:set (cset) can be used to import an entire config yml file if you first create a temporary yaml file in the /tmp directory.

  1. Create a tmp file at /tmp/tempfile.yml and paste in the contents of the config item. (In this example it is a search_api server config that does not exist in the filesystem, but needed to be present to get past a race condition error during the config import.) The /tmp directory is writable in Acquia servers, so this is a way to import config that is different from the current code deployment.
  2. This command imports the config from the file: cat /tmp/tempfile.yml | drush cset -y --input-format=yaml search_api.server.acquia_search_server ? -

The search_api.server.acquia_search_server is the name of the config. The - indicates that the values should be read from the piped input, and the ? specifies that multiple individual settings/keys are present in the piped contents.

To answer the question exactly, one could also specify the path to the config file in the config directory instead of the /tmp directory, in order to import just one config item (if the file already exists in the config directory). Ex: cat /var/www/html/config/default/search_api.server.acquia_search_server.yml | drush cset -y --input-format=yaml search_api.server.acquia_search_server ? -


You could run drush config-edit [config-file-without-yml-extension], and then replace the contents with what you have in the file. Seems to work well enough for development.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.