create field group in hook_install() I am using the field_group module and want to programmatically create groups of fields in the hook_install of my module.install file. 

It seems that field_group doesn't have much of an api that can be used by other modules. Does anyone know of a way that I can create a field group and assign field types to it programmatically?
The marked answer is correct here, but I can't comment on it. There's a couple "bugs" in it. The following changes were made to make it work with the object/array that gets exported when using field_group_load_field_group()

Specifically, I changed this line:

'format' =&gt; array('type' =&gt; 'fieldset'),

To:

'format' =&gt; array('type' =&gt; $group['format_type']),

And:

foreach ($group['fields'] as $field_name) {

To:

foreach ($group['children'] as $field_name) {

The final code:

/**
 * Create a field group.
 *
 * The field_group module does not come with an API that can be used by other
 * modules. This method fakes a Drupal new group form submission to create the
 * new group.
 *
 * @param  array  $group
 */
function _field_group_create_group(array $group) {

  drupal_load('module', 'field_group');
  module_load_include('inc', 'field_group', 'field_group.field_ui');

  $defaults = array(
    'entity_type' =&gt; 'node',
    'mode' =&gt; 'form',
    'parent' =&gt; '',
    // TODO: default to heaviest weight
    'weight' =&gt; '',
    'format' =&gt; array('type' =&gt; $group['format_type']),
    'fields' =&gt; array()
  );

  $group = $group + $defaults;

  $form = array(
    '#entity_type' =&gt; $group['entity_type'],
    '#bundle' =&gt; $group['bundle'],
    '#view_mode' =&gt; $group['mode'],
    '#groups' =&gt; array()
  );

  $form_state = array(
    'values' =&gt;  array(
      'fields' =&gt; array(
        '_add_new_group' =&gt; array(
          'group_name' =&gt; $group['group_name'],
          'label' =&gt; $group['label'],
          'parent' =&gt; $group['parent'],
          'parent_wrapper' =&gt; array('hidden_name' =&gt; '_add_new_group'),
          'weight' =&gt; $group['weight'],
          'format' =&gt; $group['format'],
        )
      )
    )
  );

  foreach ($group['children'] as $field_name) {
    $form_state['values']['fields'][$field_name] = array(
      'parent' =&gt; '_add_new_group',
    );
  }

  field_group_field_overview_submit($form, $form_state);
}