Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

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've got a problem with using Dia from the command line on OSX 10.7.4. I downloaded and installed the OS X dmg from I've been using it to create graphics for a paper and absolutely love it.

I'm using a makefile to call pdflatex, bibtex, and R so that that it will build everything from scratch if need be, but can't get Dia's command line to work.

I want to use the command line with -e and -t to export the graphics to a specific directory so that pdflatex can put them in the pdf. (

The problem that I'm running into is that anytime I call it from the terminal, it brings up the GUI. Even if I give move to /Applications/ and use the command "./dia -v". It gives me a bunch of errors about "Input method" and then shows the GUI.

I looked on the Dia FAQ and it has a lot of information for the Windows command line, but nothing for OS X.

I'm hoping that someone here has run into this before and knows how to get it to work.

share|improve this question
Looks like dia is an X windows program so I would try… – Mark Jul 18 '12 at 17:52
up vote 2 down vote accepted

On the Mac, dia (specifically /Applications/ is just a shell script wrapper to the compiled dia-bin binary. It sets a number of environmental variables, and then finishes by executing Dia as a GUI:

exec "$CWD/dia-bin" --integrated

You can make a copy (e.g. cp -p dia dia-cmd) and edit that last line in dia-cmd to become:

"$CWD/dia-bin" $@

and then you can use it as dia-cmd within the terminal.

Note: I found that for my locale (en_US.UTF-8), at least, running dia-cmd in the terminal was way too chatty about trying to determine the correct locale, spewing ignorable warnings:

Warning: AppleCollationOrder setting not found, using AppleLocale.
Setting Language: en.UTF8

(process:33043): Gdk-WARNING **: locale not supported by C library

(process:33043): Gtk-WARNING **: Locale not supported by C library.
    Using the fallback 'C' locale.

You can eliminate that by also commenting-out those lines in dia-cmd, and manually forcing the correct locale:

## LANGSTR=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null`
## if [ "x$LANGSTR" == "x" ]
## then
##    echo "Warning: AppleCollationOrder setting not found, using AppleLocale." 1>&2
##    LANGSTR=`defaults read .GlobalPreferences AppleLocale 2>/dev/null | \
##            sed 's/_.*//'`
## fi

# NOTE: Have to add ".UTF-8" to the LANG since omitting causes Dia
#       to crash on startup in locale_from_utf8().
## export LANG="$LANGSTR.UTF8"
 export LANG="en_US.UTF-8"
## echo "Setting Language: $LANG" 1>&2


MYMACHINE:~ lars$ /Applications/ -v
Dia version 0.97.2, compiled 18:51:13 Mar 17 2012
share|improve this answer
You are right on the money. Much appreciated. – Bit Monkey Jul 26 '12 at 3:02

Based on the accepted answer, I created dia-cli and a shortcut, dia:

cd /Applications/
cp -p dia dia-cli

cd /usr/local/bin
touch dia
sudo chmod +x dia

Contents of /Applications/

"$CWD/dia-bin" $@

Contents of /usr/local/bin/dia:

/Applications/ "$@"
share|improve this answer
On --> $sudo port install dia --> Error: Port dia not found – user81881 Jul 12 at 10:06

If you're able to operate the commandline, you might also be interested in compiling Dia yourself on Mac OS X using MacPorts. Such an installation will not include the wrapper script that caused the above mentioned problems. Just install MacPorts from and run sudo port install dia

share|improve this answer

and if you still are running into issues, check this blog link Dia Diagram Mac OSX Yosemite Fix

share|improve this answer
It's probable that this would be better as a comment or with better explanation, as it doesn't stand very well on it's own excepting the link. Try pasting a summary of some sort into the body of your post to supplement it. – JMY1000 Jul 10 at 5:57

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.