2

I'm trying to create new users on my OSX server by importing short & long names from a CSV file. When I attempt to import the CSV I get the following error:

The file couldn't be imported because it isn't in the correct format. Import files must be in delimited format and include a header line.

I've taken the spreadsheet file with the list of short & long names and exported it to a csv file. The top row has header fields with "RealName" and "RecordName". when I open the csv file in another program I can verify that it is comma delimited. What's going on here?

  • What are your headers listed as? – bmike Aug 20 '14 at 21:20
  • "RealName" "RecordName" – NotAMaverick Aug 20 '14 at 21:34
2

Three sources I've poured over when developing my own processes for importing users include: http://support.apple.com/kb/PH15663 and the man pages for dsimport and dsexport.

For OD, it appears you have to define the format of the file you're using to import records. While the help page above indicates there are a handful of required attributes, I found I could import just the two fields you described above and the system automatically assigned UID information.

The top line of the file being used to import the records defines the format. It includes four hex codes, the record type, the number attributes, and a list of the attributes.

The default hex codes work nicely for me:

0x0A       End of record is indicated by a new line
0x5C       The escape character is defined as \
0x3A       The field separator is a : (not a comma)
0x2C       Each value in the field is separated by a comma

For your purpose, the record types are standard users, dsRecTypeStandard:Users.

Your number of desired attributes is 2, and their values are: RealName and RecordName.

So, the file that should work for you is:

0x0A 0x5C 0x3A 0x2C dsRecTypeStandard:Users 2 RealName RecordName
User One:user1
User Two:user2
...
User XXX:userX

Please be aware though that Server.app can fill in some but not all of the missing data. I recommend building an import file that includes all the required attributes.

Also, dsimport provides the --template option that obviates the need for field descriptions if your file has all seven standard fields.

I realize the question is a few months old, but hopefully this will help someone in the future.

  • Apple Link is broken – ankiiiiiii Jul 15 at 17:00
  • 1
    That doesn't surprise me as Apple is no longer supporting Server.app. I suggest simply exploring the man pages. – tim.rohrer Jul 16 at 14:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .