Sublime Forum

Environment variables (OSX, specifically for LaTeX)

#1

Hi,

I’ve just moved over to Sublime from TM2, and generally enjoying it, but a bit overwhelmed…

I have downloaded Package Control and LatexTools and the latter is proving very useful.

However, on Mountain Lion, there is a problem: Mountain Lion no longer reads the ~/.MacOSX/environment.plist file, and hence Sublime doesn’t pick up the TEXINPUTS and BSTINPUTS variables. There are several possibilities:

  • set the environment variables globally – this is quite difficult on Mountain Lion (seems to require /etc/launchd.conf), especially on a per-user basis which I would prefer.
  • always run Sublime Text from the command line (so that it uses the variables set in .cshrc or similar)
  • edit the LatexTools package file Latex.sublime-build and an “env” dictionary. If I do this, will that make it impossible for me to update the package with Package Control (i.e., git)?
  • find some way to override the environment variables either globally for Sublime, or just for the build system. Are either of these possible?

Any ideas or best-practice?

Thanks,

Andrew

0 Likes

#2

I am having the same problem on Mountain Lion!
When i try to use the LaTeXTools: View PDF or LaTeXTools: Jump to PDF, nothing happens.
If you find a sulution to the problem, i would be pleased if you would post it here - thanks

0 Likes

#3

Oh no!!!

I’m the developer of the LaTeXTools plugin, and this post just made me very sad :frowning: I thought the days of worrying about OSX’s silly way to handle env variables were behind me…

Well, no matter. Fix #3 (changing the sublime-build file) won’t work because the build command is actually a custimized version, and I don’t think it currently reads the env variable at all. BUT, this is definitely something I need to fix.

I’ve been drifting away from OSX lately (can’t stand Apple’s attitude to “competition” anymore), but I do have Macs in the house. On the other hand, none of them is running Mountain Lion, and I actually wasn’t planning to “upgrade” (not clear what’s in it for me). I’ll do my best, but I can’t give an ETA.

EDIT: the quickest fix would be to actually read the env variable in sublime-build. Then, you could just copy the sublime-build file to the User directory. Whatever ST2 finds there takes precedence over any plugin-specific file, so even if the plugin’s sublime-build gets clobbered, it doesn’t matter. Again, no ETA, but this may be the easiest (though not the cleanest) fix.

0 Likes

#4

Andrew, a question: you customized the envirnoment variables in question, right? I’m asking because, by checking my own old blog posts (yeah, weird, I know!) I remninded myself that, as of last year, it was no longer necessary to specify the path to the TeX binaries using environment.plist. Instead, you use the “path” option in the build file, which is fully supported. Indeed, I myself haven’t used environment.plist ever since.

If you customized other tex-related env variables, the above does not apply to you—the right thing to do is to add the env-injection code to my customized build command. [BTW, the customization is necessary because otherwise you can’t properly support error parsing and forward search after compilation, and do so in a cross-platform way]. Again, no ETAs, but I see that this may be a good thing to put back in.

BTW, In the future, please use github to report issues such as these. I don’t check the ST2 forums that often, but I get automatic notifications as soon as a new issue is reported on github. Thanks! M

0 Likes

#5

I acctually found a fix for the compiling part, so you don’t need to upgrade the package.
It seems that you have to execute the file called subl, from inside the Sublime Text 2 folder, which makes it possible to build and view the .pdf file.
I use Skim Reader to view the .pdf file, after building …
To set up inverse search, go to Preferences, select the Sync tab, choose Custom from the Preset drop-down menu, and enter subl in the Command field and “%file”:%line in the Arguments field. Also make sure the Check for file changes box is not checked.
Thanks for the respond though - appreciate that!

0 Likes