Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to install Dia on OSX (and have it run)
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
#########################################################
@Tripazzy
Copy link

Tripazzy commented Dec 15, 2018

This doesn't work on Mojave.

@lama97
Copy link

lama97 commented Feb 4, 2019

Thanks alot ! It worked :)

@andialles
Copy link

andialles commented Feb 15, 2019

Works for me on 10.14.2(Mojave). Thanks a ton!!

@madmuv
Copy link

madmuv commented Mar 13, 2019

thank you so much, my Mojave works!!

@pralhadsapre
Copy link

pralhadsapre commented Mar 19, 2019

Works perfectly on Mojave. Thank you :)

@trankov
Copy link

trankov commented Apr 15, 2019

Doesn't work for my High Sierra (mid2011 cannot be upgraded to Mohave). If somebody won this trouble please tell how. Thanks in advance.

@csbrust
Copy link

csbrust commented Apr 23, 2019

Works for me on High Sierra (MacBook Pro late 2011). BUT, I had to run it from the console window, could not click to open in the Applications. To run dia this way, open a terminal and enter.....
$ cd /Applications
$ ./Dia.app/Contents/Resources/bin/dia

@muhammed-salman
Copy link

muhammed-salman commented Jul 18, 2019

Thanks @csbrust this works for me in Mac OS Mojave

@aalex
Copy link

aalex commented Nov 20, 2019

Works on macOS 10.14.6. Finally! Thank you!

@cristobal85
Copy link

cristobal85 commented Mar 24, 2020

Works on macOS 10.15.3 Catalina. Thanks so much!

@sap00k
Copy link

sap00k commented Apr 8, 2020

on macOS High Sierra 10.13.6 it does not work. any help

@joshuaolusayo
Copy link

joshuaolusayo commented Apr 22, 2020

Works on macOS Mojave 10.14.6. Thanks

@helgardmeyer
Copy link

helgardmeyer commented May 18, 2020

Works on macOS Catalina 10.15.4. Thank you

@maggiekean
Copy link

maggiekean commented Jul 30, 2020

Thank you! Worked like a charm!

@jmattlandrum
Copy link

jmattlandrum commented Sep 3, 2020

Thanks much! Interstingly, Dia was working fine for me. I didn't use it for a month or so, then couldn't get it to work. This did the trick.
(High Sierra 10.13.6).

@alonso-cadenas
Copy link

alonso-cadenas commented Sep 8, 2020

Works on macOS Catalina 10.15.6. Thank you!

@Charffyyy
Copy link

Charffyyy commented Sep 13, 2020

does not work for me on macOS Catalina 10.15.5
When I tried to open Dia, I click it, it says "dia is damaged" and asked me to move it to trash.
Anybody know how to fix this? Thank you!

@ficus
Copy link

ficus commented Feb 8, 2021

Still working in 2021. Thanks.

@motorina0
Copy link

motorina0 commented Feb 12, 2021

Thank you!

@michalliu
Copy link

michalliu commented Feb 15, 2021

Works like a charm, Thank you!

@Romain-N69
Copy link

Romain-N69 commented Feb 17, 2021

Thx !

@jbandoro
Copy link

jbandoro commented Feb 18, 2021

Thanks! Works for me for Dia-0.97.2-7.dmg on mac OS 10.14.6

@juniorcas12
Copy link

juniorcas12 commented Feb 24, 2021

Thanks It worked on minimac catalina 10.15.7 Dia-0.97.2-7.dmg

@Arigye
Copy link

Arigye commented Mar 3, 2021

Thanks it worked for me on 10.12.6

@Pranav-44
Copy link

Pranav-44 commented May 4, 2021

works fine👍🏼. just remember to open the diagram file in a Xcode or some other app to edit it.

@leo0001000
Copy link

leo0001000 commented Jul 24, 2021

Thanks!! It works for me on july 24. MacOS Big Sur

@karobdiaz
Copy link

karobdiaz commented Aug 8, 2021

Thanks!! It works for me on july 24. MacOS Big Sur

Hi! How are u? Could you explain to me how it is installed please?

@vladimir454
Copy link

vladimir454 commented Sep 22, 2021

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; do
if [[ ps aux | grep -v grep | grep startx | wc -l -lt 1 ]]; then
sleep 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


@JacobStrome
Copy link

JacobStrome commented Jan 27, 2022

Worked for me! Thanks!

@tdlmatias
Copy link

tdlmatias commented Feb 7, 2022

It works wonders !! :-). Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment