homebrew-zathura
homebrew-zathura copied to clipboard
zathura isn't launched from ViM without --with-synctex
Hello,
I am using ViM with vimtex and zathura on macOS (Catalina), and I've always had issues making zathura work properly through vim. it would simply not open an instance after hitting \ll (continuous compilation by vimtex).
Eventually I found out it won't work if synctex isn't installed properly. I must install zathura with synctex arg
brew install zathura --with-synctex
This way it works seamlessly, with forward-backward search, manage windows etc.
Without the synctex arg, it would work perfectly, refreshing and everything, if I launch zathura from the terminal
zathura "file path"
and it would also load correctly if I'd run it from vim with the following command(but I couldn't edit the vim file until I finish the task which closes the window)
:!zathura %:r.pdf
Also, some zathura versions didn't have synctex (I think 4.3) and installing with this arg would fail. so I had to
brew edit zathura
change the version and link version to 4.2, than install, homebrew would say the excepted sha256 is not as the actual one, copy the actual one, "brew edit zathura" and replace the sha256. this would install the specified version and allow me to use synctex.
Am I doing something wrong that causes this? If not, I would strongly suggest that you'd add the --with-synctex arg to the installation guide.
Thanks a ton for porting zathura to macOS. I love this viewer!
I’ll add it to the readme. I’m happy to hear it works for you because I don’t write much latex anymore myself, so I didn’t really test it.
If you want to install an older version you can do brew install [email protected]
.
That saves you the hassle of having to edit the formula.
It is possible the synctex binding were broken at some point, but I believe the latest version (4.5) should work fine now. If not, please let me know.
Hey there,
first, thank you for brewing. I installed zathura today the way it's explained in the README.md
. Everything seemed fine. Then I noticed that SyncTeX isn't working.
After some recherche I reinstalled with brew install zathura --with-synctex
. Unfortunately forward search (which requires SyncTeX support) is still not working. I tried Visual Studio Code and Vim.
This matter is just new to me so did some basic diagnostics. This is what $ brew info zathura
gave me:
zegervdv/zathura/zathura: stable 0.4.5
https://pwmt.org/projects/zathura/
/usr/local/Cellar/zathura/0.4.5 (53 files, 717.3KB) *
Built from source on 2020-05-01 at 00:12:14 with: --with-synctex
From: https://github.com/zegervdv/homebrew-zathura/blob/master/zathura.rb
==> Dependencies
Required: pkg-config ✔, libmagic ✔, gettext ✔, girara ✔, gnome-icon-theme ✔, glib ✔,
desktop-file-utils ✔, intltool ✔, sphinx-doc ✔, meson --head ✔
Optional: synctex ✔
It seems to me that everything was installed properly.
Then I tried to use SyncTeX manually in the terminal. First with /Applications/Skim.app/Contents/SharedSupport/displayline 100 main.pdf main.tex
to verify SyncTeX works for the test files. It did.
Next I tried zathura --synctex-forward 100:1:main.tex main.pdf
. This gave me the following error message:
error: Could not connect to session bus: Cannot spawn a message bus without a machine-id: Unable to load /usr/local/var/lib/dbus/machine-id or /etc/machine-id: Failed to open file “/usr/local/var/lib/dbus/machine-id”: No such file or directory
error: Got no usable data from SyncTeX or D-Bus failed in some way.
I really have no clue. Probably the error is related to this issue. I thought this info could be helpful to you.
Cheers
Can you try running dbus-uuidgen --ensure
and try again?
Mhh, dbus was missing on my system (MacOS 10.15). So I installed it and did some further try and error. Here is the protocol.
Oh, and first the short answer to your question :)
$ dbus-uuidgen —ensure
generates no output.
Now the protocol:
Install dbus
$ brew install dbus
Set up the unix socket manually according to zbebtly/dbus-osx-examples.
$ mkdir /tmp/dbus
$ chmod u+rwx /tmp/dbus
Set the value of <listen><\listen>
in /usr/local/opt/dbus/share/dbus-1/session.conf
to result of:
$ echo unix:path=/tmp/dbus/$USER.session.usock
Start and register dbus.
$ brew services start dbus
$ launchctl load ~/Library/LaunchAgents/org.freedesktop.dbus-session.plist
Test dbus
$ dbus-launch
DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/dbus/robert.session.usock,guid=58508d8767923a5499222ebd5eabfd93
DBUS_SESSION_BUS_PID=3322
Everthing seems fine so far.
$ dbus-uuidgen —ensure
generates no output.
Test zathura
$ zathura --synctex-forward 100:1:main.tex main.pdf
error: Could not connect to session bus: Cannot autolaunch D-Bus without X11 $DISPLAY
error: Got no usable data from SyncTeX or D-Bus failed in some way.
Ok, now X11 is missing.
Install X11
I discovered XQuartz and installed it.
Test zathura
`$ zathura --synctex-forward 100:1:main.tex main.pdf
'error: Could not connect to session bus: Error spawning command line “dbus-launch --autolaunch=4eb61bab435f1d07d5932c7f5eab61b7 --binary-syntax --close-stderr”: Child process exited with code 1’
What’s the Problem here? I manually run the coommand.
$dbus-launch --autolaunch=4eb61bab435f1d07d5932c7f5eab61b7 --binary-syntax --close-stderr
Autolaunch requested, but X11 support not compiled in.
Cannot continue.
I don't know how to compile dbus with X11 support. There is no such flag for the homebrew dbus formula :/
Ok, i solved the problem. Seems that this X11 autolaunch is only a fallback. I added
export DBUS_SESSION_BUS_ADDRESS='unix:path='$DBUS_LAUNCHD_SESSION_BUS_SOCKET
to my .zshrc
. Now zathura recognizes the dbus session. But then zathura complains about not being able to authenticate with the dbus session.
I just changed the value of <auth><\auth>
in /usr/local/opt/dbus/share/dbus-1/session.conf
from EXTERNAL
to DBUS_COOKIE_SHA1
.
Now everything is working. No need for XQuartz or
Set up the unix socket manually according to zbebtly/dbus-osx-examples. $ mkdir /tmp/dbus $ chmod u+rwx /tmp/dbus
Set the value of
<\listen> in /usr/local/opt/dbus/share/dbus-1/session.conf to result of:
$ echo unix:path=/tmp/dbus/$USER.session.usock
Great! Was trying to reproduce it myself but ran into different issues.
The synctex repository has deleted the 2017 branch which brew uses.
I've managed to update the brew recipe on /usr/local/Homebrew/Library/Taps/zegervdv/homebrew-zathura/synctex.rb
and editing the line 3 end to :branch => "2020"
.
Then it installed successfully. And \ll
now spawns zathura window.
But I have an issue: zathura -x my.pdf
opens a black screen without info, same as spawned window.
Any hints why ?
I updated the synctex package to use branch 2020. Did you reinstall the plugins after reinstalling zathura and follow the after install instructions?
Should this work now? When I run zathura --synctex-forward 9:1:mwe.tex mwe.pdf
from the Terminal in macOS Catalina (without having the .tex file or the .pdf open) nothing at all happens.
When I check brew info zathura
, I'm on 0.4.5 with synctex. I only get the following caveat but that doesn't seem relevant.
zsh completions have been installed to:
/usr/local/share/zsh/site-functions
I'm very much intrigued by what @adir-ux wrote in his opening post (https://github.com/zegervdv/homebrew-zathura/issues/50#issue-608911677) because it suggests that even the \lv
command should work in nvim. I now get the error Vimtex: Viewer cannot find Zathura window ID!
I habe the same problem and tried the solution from @robert-michael but I'm kind of stuck.
I got dbus running:
~ ❯ dbus-launch
DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/dbus/tbsmn.session.usock,guid=097da86b07f7062b4cdbecac5ffd7a37
DBUS_SESSION_BUS_PID=26112
And I did this:
I added
export DBUS_SESSION_BUS_ADDRESS='unix:path='$DBUS_LAUNCHD_SESSION_BUS_SOCKET
to my
.zshrc
. Now zathura recognizes the dbus session. But then zathura complains about not being able to authenticate with the dbus session.I just changed the value of
<auth><\auth>
in/usr/local/opt/dbus/share/dbus-1/session.conf
fromEXTERNAL
toDBUS_COOKIE_SHA1
.
But when I run:
zathura --synctex-forward 1:1:main.tex main.pdf
I get this error:
error: Could not connect to session bus: Connection failed: No such file or directory
error: Got no usable data from SyncTeX or D-Bus failed in some way.
Zathura is working and build with synctex support.
Any Ideas what I could try?
Have been trying for a few hours but also stuck with dbus
problem.
I do seem to need to setup the dbus socket manually. If I don't, I get this error when I run dbus-launch
:
dbus-daemon[2196]: Failed to start message bus: Check-in failed: No such process
EOF in dbus-launch reading address from bus daemon
If I do create it manually, however, I can run dbus-launch
successfully but when I then run zathura --synctex-forward 1:1:main.tex main.pdf
I get a dbus error saying Could not connect: Connection refused
.
I feel like we are close to figuring this one out. @robert-michael would you have any ideas?
Hey there,
currently I am not working with zathura. I have reset my OS since my last post. Thus I had a fresh start on my system with this zathura thing. I tried to follow my installation notes once again.
-
Run
brew install dbus
-
Edit the files according to my last post
-
Run
brew services start dbus
-
Exactly follow the install instructions without the "osx_native_integration" and "Copying to Clipboard" parts
-
eventually reboot (not sure if that was important)
Now i tested it with a tex file and a corresponding pdf file which was explicitly created with synctex and everything is working.
@flimofly
I receive the same error message when running dbus-launch
but when I run ps -A | grep dbus
I get something like
2173 ?? 0:00.01 /usr/local/Cellar/dbus/1.12.20/bin/dbus-daemon --nofork --session
3869 ttys001 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox dbus
So for me it seems like the error originates to a already running dbus session.
After running through the above steps 1-3 it shouldn't be necessary any more to launch dbus manually.
You can run 'dbus-monitor' to connect to your running dbus session and observe messeges on the bus.
@tbsmn
Did you verify that you installed zathura with synctex support by running brew info zathura
Is there a .synctex.gz file next to your .tex and .pdf files? May you have to build your pdf with explicitly enabling synctex support.
Cheers, Robert
Even with the HEAD version according to the "osx_native_section" from the install instructions everything seems to to work.
@robert-michael thanks for the Input.
My sample case works with skim (/Applications/Skim.app/Contents/SharedSupport/displayline 100 main.pdf main.tex
). So the .synctex.gz is in place and I think the file setup can't be the problem.
brew info zuthura
confirms that it is build with synctex support
dbus-launch
gives me this:
DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/dbus/tbsmn.session.usock,guid=37ac277950bab95f49c6e21c5ffdc028
DBUS_SESSION_BUS_PID=58023
and ps -A | grep dbus
this:
26112 ?? 0:00.00 /usr/local/Cellar/dbus/1.12.20/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session
65098 ?? 0:00.00 /usr/local/Cellar/dbus/1.12.20/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session
80926 ?? 0:00.00 /usr/local/Cellar/dbus/1.12.20/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session
81260 ?? 0:00.00 /usr/local/Cellar/dbus/1.12.20/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session
56877 ttys000 0:00.00 grep dbus
dbus-monitor
gives me this error:
Failed to open connection to session bus: '=' character not found or has no value following it
Any ideas?
Brew reinstall dbus fixed it for me. Forward and backward sync are working!! Thanks for all that help you guys rock!
Works here, too, now!
I'm a little puzzled as to what specifically fixed it. I don't think it was only due to the reinstall of dbus (I tried that and it didn't fix it -- but maybe I should have rebooted afterwards). I also reinstalled zathura.