4

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 http://dia-installer.de/download/macosx.html 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. (http://dia-installer.de/doc/en/re01.html)

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/Dia.app/Content/Resources/bin/ 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.

1

4 Answers 4

2

On the Mac, dia (specifically /Applications/Dia.app/Content/Resources/bin/dia) 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

Voila:

MYMACHINE:~ lars$ /Applications/Dia.app/Contents/Resources/bin/dia-cmd -v
Dia version 0.97.2, compiled 18:51:13 Mar 17 2012
1
  • You are right on the money. Much appreciated.
    – Bit Monkey
    Jul 26, 2012 at 3:02
2

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

cd /Applications/Dia.app/Contents/Resources/bin
cp -p dia dia-cli

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

Contents of /Applications/Dia.app/Contents/Resources/bin/dia-cli:

...
"$CWD/dia-bin" $@

Contents of /usr/local/bin/dia:

PATH=$PATH:/Applications/Dia.app/Contents/Resources/bin
/Applications/Dia.app/Contents/Resources/bin/dia-cli "$@"
1
  • On --> $sudo port install dia --> Error: Port dia not found
    – Vivek
    Jul 12, 2016 at 10:06
0

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 http://www.macports.org/ and run sudo port install dia

-1

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

1
  • 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, 2016 at 5:57

You must log in to answer this question.

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