brew cask install dia
After his it won't run because DISPLAY=:0 env var is not set
vim /Applications/Dia.app/Contents/Resources/bin/dia
Add the following content to line 40 (right before the oascript call)
#########################################################
# Ref: http://navkirats.blogspot.de/2014/10/dia-diagram-mac-osx-yosemite-fix-i-use.html
versionOSX=$(sw_vers -productVersion | awk -F '.' '{print $(NF-1)}')
[[ ${versionOSX} -ge 10 ]] && export DISPLAY=:0
#########################################################
hi there. this code is working in macos Big Sur
i just copied the dia bin to dia-cmd
first edit with vim and make changes
look for these part.
Brutally add many things to the PATH. If the directories do not exist, they won't be used anyway.
People should really use ~/.macosx/environment.plist to set environment variables as explained by Apple:
http://developer.apple.com/qa/qa2001/qa1067.html
but since no one does, we correct this by making the 'classic' PATH additions here:
/usr/local/bin which, though standard, doesn't seem to be in the PATH
newer python as recommended by MacPython http://www.python.org/download/mac/
Fink
MacPorts (former DarwinPorts)
LaTeX distribution for Mac OS X
#export PATH="/usr/texbin:/opt/local/bin:/sw/bin/:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/local/bin:$CWD:$PATH"
Check for X11
if [[ "" == $DISPLAY ]]; then
export DISPLAY=:0
fi
startx=
which startx
if [[ "" == $startx ]]; then
if [[ ! -e /opt/X11/bin/startx ]]; then
# Ref: http://navkirats.blogspot.de/2014/10/dia-diagram-mac-osx-yosemite-fix-i-use.html
versionOSX=$(sw_vers -productVersion | awk -F '.' '{print $(NF-1)}')
[[ ${versionOSX} -ge 10 ]] && export DISPLAY=:0
osascript -e 'tell app "System Events" to display dialog "X11 (XQuartz) is not installed or not running. Would you like to visit xquartz.macosforge.org now in order to download and install XQuartz?" with icon 0'
if [[ $? -eq 0 ]]; then
open http://xquartz.macosforge.org
exit
fi
fi
fi
osascript -e 'tell app "XQuartz" to launch'
for i in
seq 1 30
; doif [[
ps aux | grep -v grep | grep startx | wc -l
-lt 1 ]]; thensleep 1
fi
done
if [[ "$DISPLAY" =~ "/tmp" ]]; then
if [[ ! -e $DISPLAY ]]; then
export DISPLAY=:0
fi
fi
and you can use this code
export DISPLAY=:0 # Fixes the "cannot open display".
export LANG="en_US.UTF-8" # Fixes the annoying Xterm window opening.
exec "$CWD/dia-bin" --integrated