Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a solution to create a binary plist file from the command line on OS X?

I want to create the ~/.MacOSX/environment.plist and setup the PATH there.

I know that this plist file has to be in the binary format and I know how to write to it using the defaults write command. Still, I do need to create the file before doing this, and creating an empty file does not work.

Note: I need a command line solution.

share|improve this question

You could also create an XML or old-style property list and convert it with plutil:

plutil -convert binary1 test.plist

It modifies files in place by default. You can specify a different output file with -o or print to stdout with -o -.

share|improve this answer

This piece of bash solved my problem:

if [ ! -f '~/.MacOSX/environment.plist' ]; then
  mkdir -p '~/.MacOSX'
  defaults write ~/.MacOSX/environment.plist TEST_VAR 1

Still, I have to warn others that OS X 10.8 seems not to be loading the file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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